Skip to content

Commit 7e2e042

Browse files
committed
Fix printing of TermParamRefs
The change that TermParamRefs are Singletons caused a change how they are printed, which this commit reverts. We had before def f(x: T): x.type def f(x: T): x.type # M Once TermParamRefs were singletons we got: def f(x: T): T (x) def f(x: T): x.M With this commit we now get: def f(x: T): x.type def f(x: T): x.M
1 parent 5cb78bb commit 7e2e042

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,14 @@ class PlainPrinter(_ctx: Context) extends Printer {
146146
toTextRef(tp) ~ ".type"
147147
case tp: TermRef if tp.denot.isOverloaded =>
148148
"<overloaded " ~ toTextRef(tp) ~ ">"
149-
case tp: SingletonType =>
150-
toTextLocal(tp.underlying) ~ "(" ~ toTextRef(tp) ~ ")"
151149
case tp: TypeRef =>
152150
toTextPrefix(tp.prefix) ~ selectionString(tp)
151+
case tp: TermParamRef =>
152+
ParamRefNameString(tp) ~ ".type"
153+
case tp: TypeParamRef =>
154+
ParamRefNameString(tp) ~ lambdaHash(tp.binder)
155+
case tp: SingletonType =>
156+
toTextLocal(tp.underlying) ~ "(" ~ toTextRef(tp) ~ ")"
153157
case AppliedType(tycon, args) =>
154158
(toTextLocal(tycon) ~ "[" ~ Text(args map argText, ", ") ~ "]").close
155159
case tp: RefinedType =>
@@ -196,10 +200,6 @@ class PlainPrinter(_ctx: Context) extends Printer {
196200
"]" ~ lambdaHash(tp) ~ (" => " provided !tp.resultType.isInstanceOf[MethodType]) ~
197201
toTextGlobal(tp.resultType)
198202
}
199-
case tp: TypeParamRef =>
200-
ParamRefNameString(tp) ~ lambdaHash(tp.binder)
201-
case tp: TermParamRef =>
202-
ParamRefNameString(tp) ~ ".type"
203203
case AnnotatedType(tpe, annot) =>
204204
toTextLocal(tpe) ~ " " ~ toText(annot)
205205
case tp: TypeVar =>

0 commit comments

Comments
 (0)