File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -204,11 +204,23 @@ class TreeTypeMap(
204204 lazy val origCls = mapped.zip(syms).filter(_._1.isClass).toMap
205205 mapped.filter(_.isClass).foldLeft(substMap) { (tmap, cls) =>
206206 val origDcls = cls.info.decls.toList.filterNot(_.is(TypeParam ))
207- val mappedDcls = mapSymbols(origDcls, tmap, mapAlways = true )
207+ val tmap0 = tmap.withSubstitution(origCls(cls).typeParams, cls.typeParams)
208+ val mappedDcls = mapSymbols(origDcls, tmap0, mapAlways = true )
208209 val tmap1 = tmap.withMappedSyms(
209210 origCls(cls).typeParams ::: origDcls,
210211 cls.typeParams ::: mappedDcls)
211212 origDcls.lazyZip(mappedDcls).foreach(cls.asClass.replace)
212213 tmap1
213214 }
215+
216+ override def toString =
217+ def showSyms (syms : List [Symbol ]) =
218+ syms.map(sym => s " $sym# ${sym.id}" ).mkString(" , " )
219+ s """ TreeTypeMap(
220+ |typeMap = $typeMap
221+ |treeMap = $treeMap
222+ |oldOwners = ${showSyms(oldOwners)}
223+ |newOwners = ${showSyms(newOwners)}
224+ |substFrom = ${showSyms(substFrom)}
225+ |substTo = ${showSyms(substTo)}""" .stripMargin
214226}
Original file line number Diff line number Diff line change 1+ class Test {
2+ inline def test (fun : Any ): Any = ???
3+ test {
4+ class Foo [X ]:
5+ def x : X = ???
6+ def foo : Unit = this .x.toString
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ def fun (a : Any , b : Any = 2 ): Any = ???
2+ def test =
3+ fun(
4+ b = println(1 ),
5+ a = {
6+ class Foo [X ]:
7+ def x : X = ???
8+ def foo : Unit = this .x.toString
9+ locally {
10+ def x : X = ???
11+ println(x.toString)
12+ }
13+ }
14+ )
You can’t perform that action at this time.
0 commit comments