Skip to content

Commit 6cc105c

Browse files
committed
1 parent 8f613a0 commit 6cc105c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,15 @@ object TypeTestsCasts {
140140
}
141141

142142
def interceptTypeApply(tree: TypeApply)(implicit ctx: Context): Tree = trace(s"transforming ${tree.show}", show = true) {
143-
tree.fun match {
143+
interceptTypeApply1(tree, tree.fun match {
144+
case i: Ident =>
145+
desugarIdent(i).withPos(tree.fun)
146+
case t => t
147+
})
148+
}
149+
150+
private def interceptTypeApply1(tree: TypeApply, treeFun: Tree)(implicit ctx: Context): Tree = {
151+
treeFun match {
144152
case fun @ Select(expr, selector) =>
145153
val sym = tree.symbol
146154

tests/neg/i5006.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object i0 {
2+
// Adding anything in front of asInstanceOf,
3+
// i0 or this, makes the error go away.
4+
def i1: Int = asInstanceOf[Int].toInt
5+
6+
val i2 = asInstanceOf[Int]
7+
}

0 commit comments

Comments
 (0)