File tree Expand file tree Collapse file tree 6 files changed +25
-13
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 6 files changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
257257 Text (lam.paramNames.lazyZip(lam.paramInfos).map(paramText), " , " )
258258 }
259259
260- protected def ParamRefNameString (name : Name ): String = name.toString
260+ protected def ParamRefNameString (name : Name ): String = nameString( name)
261261
262262 protected def ParamRefNameString (param : ParamRef ): String =
263263 ParamRefNameString (param.binder.paramNames(param.paramNum))
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import typer.ProtoTypes._
2020import Trees ._
2121import TypeApplications ._
2222import Decorators ._
23+ import NameKinds .WildcardParamName
2324import util .Chars .isOperatorPart
2425import transform .TypeUtils ._
2526import transform .SymUtils ._
@@ -76,8 +77,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
7677 }
7778
7879 override def nameString (name : Name ): String =
79- if ctx.settings.YdebugNames .value
80- then name.debugString
80+ if ctx.settings.YdebugNames .value then name.debugString
81+ else if name.isTypeName && name.is( WildcardParamName ) && ! printDebug then " _ "
8182 else super .nameString(name)
8283
8384 override protected def simpleNameString (sym : Symbol ): String =
@@ -963,9 +964,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
963964 def optText [T >: Untyped ](tree : List [Tree [T ]])(encl : Text => Text ): Text =
964965 if (tree.exists(! _.isEmpty)) encl(blockText(tree)) else " "
965966
966- override protected def ParamRefNameString (name : Name ): String =
967- name.toString
968-
969967 override protected def treatAsTypeParam (sym : Symbol ): Boolean = sym.is(TypeParam )
970968
971969 override protected def treatAsTypeArg (sym : Symbol ): Boolean =
Original file line number Diff line number Diff line change @@ -1560,9 +1560,9 @@ class Typer extends Namer
15601560 super .transform(trt.withType(stripTypeVars(trt.tpe))) match {
15611561 case b : Bind =>
15621562 val sym = b.symbol
1563- if (sym.name != tpnme.WILDCARD )
1564- if ( ctx.scope.lookup(b.name) == NoSymbol ) ctx.enter(sym)
1565- else report.error(new DuplicateBind (b, cdef), b.srcPos)
1563+ assert (sym.name != tpnme.WILDCARD )
1564+ if ctx.scope.lookup(b.name) == NoSymbol then ctx.enter(sym)
1565+ else report.error(new DuplicateBind (b, cdef), b.srcPos)
15661566 if (! ctx.isAfterTyper) {
15671567 val bounds = ctx.gadt.fullBounds(sym)
15681568 if (bounds != null ) sym.info = bounds
@@ -1969,8 +1969,9 @@ class Typer extends Namer
19691969 // val ptt = if (lo.isEmpty && hi.isEmpty) pt else
19701970 if (ctx.isAfterTyper) tree1
19711971 else {
1972- val wildcardSym = newPatternBoundSymbol(tpnme.WILDCARD , tree1.tpe & pt, tree.span)
1973- untpd.Bind (tpnme.WILDCARD , tree1).withType(wildcardSym.typeRef)
1972+ val boundName = WildcardParamName .fresh().toTypeName
1973+ val wildcardSym = newPatternBoundSymbol(boundName, tree1.tpe & pt, tree.span)
1974+ untpd.Bind (boundName, tree1).withType(wildcardSym.typeRef)
19741975 }
19751976 else tree1
19761977 }
Original file line number Diff line number Diff line change 99-- Error: tests/neg-custom-args/kind-projector.scala:6:22 --------------------------------------------------------------
10106 |class Bar2 extends Foo[*] // error
1111 | ^
12- | Type argument _$4 does not have the same kind as its bound [_$1]
12+ | Type argument _ does not have the same kind as its bound [_$1]
Original file line number Diff line number Diff line change 6161-- Error: tests/neg/i4986c.scala:62:19 ---------------------------------------------------------------------------------
626262 | i.m[Option[Long]] // error
6363 | ^
64- | String; List; [A, _$6 ] =>> List[Option[?]]; Int; Option[Long];
64+ | String; List; [A, _] =>> List[Option[?]]; Int; Option[Long];
Original file line number Diff line number Diff line change 1+ class Property [T ]
2+
3+ class VObject {
4+ def properties () = {
5+ List .empty[Property [? ]].collect {
6+ case p : Property [? ] => List (p)
7+ }
8+ }
9+ }
10+
11+ class Event extends VObject {
12+ override def properties () = ???
13+ }
You can’t perform that action at this time.
0 commit comments