File tree 3 files changed +35
-1
lines changed
compiler/src/dotty/tools/dotc/ast 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -204,11 +204,23 @@ class TreeTypeMap(
204
204
lazy val origCls = mapped.zip(syms).filter(_._1.isClass).toMap
205
205
mapped.filter(_.isClass).foldLeft(substMap) { (tmap, cls) =>
206
206
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 )
208
209
val tmap1 = tmap.withMappedSyms(
209
210
origCls(cls).typeParams ::: origDcls,
210
211
cls.typeParams ::: mappedDcls)
211
212
origDcls.lazyZip(mappedDcls).foreach(cls.asClass.replace)
212
213
tmap1
213
214
}
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
214
226
}
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