File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ class PlainPrinter(_ctx: Context) extends Printer {
140
140
case _ => Nil
141
141
})
142
142
143
+ /** Direct references to these symbols are printed without their prefix for convenience.
144
+ * They are either aliased in scala.Predef or in the scala package object, as well as `Object`
145
+ */
146
+ private lazy val printWithoutPrefix : Set [Symbol ] =
147
+ (defn.ScalaPredefModule .termRef.typeAliasMembers
148
+ ++ defn.ScalaPackageObject .termRef.typeAliasMembers).map(_.info.classSymbol).toSet
149
+ + defn.ObjectClass
150
+ + defn.FromJavaObjectSymbol
151
+
143
152
def toTextCaptureSet (cs : CaptureSet ): Text =
144
153
if printDebug && ctx.settings.YccDebug .value && ! cs.isConst then cs.toString
145
154
else if cs == CaptureSet .Fluid then " <fluid>"
@@ -183,6 +192,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
183
192
case tp : TermRef if tp.denot.isOverloaded =>
184
193
" <overloaded " ~ toTextRef(tp) ~ " >"
185
194
case tp : TypeRef =>
195
+ if (printWithoutPrefix.contains(tp.symbol))
196
+ selectionString(tp)
197
+ else
186
198
toTextPrefixOf(tp) ~ selectionString(tp)
187
199
case tp : TermParamRef =>
188
200
ParamRefNameString (tp) ~ lambdaHash(tp.binder) ~ " .type"
You can’t perform that action at this time.
0 commit comments