Skip to content

Commit 9830ea3

Browse files
committed
Fix #5006: Normalize prefixes of TypeApply in Erasure
1 parent a35d724 commit 9830ea3

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ object TypeTestsCasts {
156156
}
157157

158158
def interceptTypeApply(tree: TypeApply)(implicit ctx: Context): Tree = trace(s"transforming ${tree.show}", show = true) {
159-
tree.fun match {
159+
val treeFun = tree.fun match {
160+
case i: Ident => desugarIdent(i).withSpan(tree.fun.span)
161+
case t => t
162+
}
163+
treeFun match {
160164
case fun @ Select(expr, selector) =>
161165
val sym = tree.symbol
162166

tests/pos/i5006.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object i0 {
2+
def f: Int = asInstanceOf[Int].toInt
3+
}
4+
5+
class i2 {
6+
def f: Int = asInstanceOf[Int].toInt
7+
}
8+
9+
trait i3 {
10+
def f: Int = asInstanceOf[Int].toInt
11+
}

0 commit comments

Comments
 (0)