File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -432,15 +432,10 @@ class TreePickler(pickler: TastyPickler) {
432432 bindings.foreach(preRegister)
433433 withLength { pickleTree(call); pickleTree(expansion); bindings.foreach(pickleTree) }
434434 case Bind (name, body) =>
435- val sym = tree.symbol
436- // If name is a type wildcard, symbol was removed by Typer#indexPattern.
437- // Use the type(-bounds) of the body instead as type of the Bind
438- if (sym.exists) registerDef(sym) else assert(name == tpnme.WILDCARD )
435+ registerDef(tree.symbol)
439436 writeByte(BIND )
440437 withLength {
441- pickleName(name)
442- pickleType(if (sym.exists) sym.info else body.tpe)
443- pickleTree(body)
438+ pickleName(name); pickleType(tree.symbol.info); pickleTree(body)
444439 }
445440 case Alternative (alts) =>
446441 writeByte(ALTERNATIVE )
Original file line number Diff line number Diff line change @@ -1026,9 +1026,7 @@ class TreeUnpickler(reader: TastyReader,
10261026 val sym = symAtAddr.getOrElse(start, forkAt(start).createSymbol())
10271027 readName()
10281028 readType()
1029- val body = readTerm()
1030- if (sym.name == tpnme.WILDCARD ) untpd.Bind (sym.name, body).withType(body.tpe)
1031- else Bind (sym, body)
1029+ Bind (sym, readTerm())
10321030 case ALTERNATIVE =>
10331031 Alternative (until(end)(readTerm()))
10341032 case UNAPPLY =>
Original file line number Diff line number Diff line change @@ -1010,10 +1010,17 @@ class Typer extends Namer
10101010 override def transform (trt : Tree )(implicit ctx : Context ) =
10111011 super .transform(trt.withType(elimWildcardSym(trt.tpe))) match {
10121012 case b : Bind =>
1013- if (ctx.scope.lookup(b.name) == NoSymbol ) ctx.enter(b.symbol)
1014- else ctx.error(new DuplicateBind (b, tree), b.pos)
1015- b.symbol.info = elimWildcardSym(b.symbol.info)
1016- b
1013+ val sym = b.symbol
1014+ if (sym.exists) {
1015+ if (ctx.scope.lookup(b.name) == NoSymbol ) ctx.enter(sym)
1016+ else ctx.error(new DuplicateBind (b, tree), b.pos)
1017+ sym.info = elimWildcardSym(sym.info)
1018+ b
1019+ }
1020+ else {
1021+ assert(b.name == tpnme.WILDCARD )
1022+ b.body
1023+ }
10171024 case t => t
10181025 }
10191026 }
You can’t perform that action at this time.
0 commit comments