diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 8a95f0a40032..821095dde886 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -1253,15 +1253,15 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def desugarIdent(tree: Ident)(implicit ctx: Context): Tree = { val qual = desugarIdentPrefix(tree) if (qual.isEmpty) tree - else qual.select(tree.symbol).withSpan(tree.span) + else qual.select(tree.symbol) } /** Recover identifier prefix (e.g. this) if it exists */ def desugarIdentPrefix(tree: Ident)(implicit ctx: Context): Tree = tree.tpe match { case TermRef(prefix: TermRef, _) => - ref(prefix).withSpan(tree.span) + ref(prefix) case TermRef(prefix: ThisType, _) => - This(prefix.cls).withSpan(tree.span) + This(prefix.cls) case _ => EmptyTree } diff --git a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index a1a015c22883..548dba2f4de9 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -156,10 +156,8 @@ object TypeTestsCasts { } def interceptTypeApply(tree: TypeApply)(implicit ctx: Context): Tree = trace(s"transforming ${tree.show}", show = true) { - /** Intercept `expr.xyz[XYZ]` */ - def interceptWith(expr: Tree): Tree = { - if (expr.isEmpty) tree - else { + tree.fun match { + case fun @ Select(expr, selector) => val sym = tree.symbol def isPrimitive(tp: Type) = tp.classSymbol.isPrimitiveValueClass @@ -174,7 +172,7 @@ object TypeTestsCasts { def foundCls = effectiveClass(expr.tpe.widen) def inMatch = - tree.fun.symbol == defn.Any_typeTest || // new scheme + fun.symbol == defn.Any_typeTest || // new scheme expr.symbol.is(Case) // old scheme def transformIsInstanceOf(expr: Tree, testType: Type, flagUnrelated: Boolean): Tree = { @@ -308,13 +306,9 @@ object TypeTestsCasts { else if (sym.isTypeCast) transformAsInstanceOf(erasure(tree.args.head.tpe)) else tree - } - } - val expr = tree.fun match { - case Select(expr, _) => expr - case i: Ident => desugarIdentPrefix(i) - case _ => EmptyTree + + case _ => + tree } - interceptWith(expr) } } diff --git a/tests/fuzzy/RE-96bd93de803119f21ab5d429b0ce0793869d86c5.scala b/tests/pending/fuzzy/RE-96bd93de803119f21ab5d429b0ce0793869d86c5.scala similarity index 100% rename from tests/fuzzy/RE-96bd93de803119f21ab5d429b0ce0793869d86c5.scala rename to tests/pending/fuzzy/RE-96bd93de803119f21ab5d429b0ce0793869d86c5.scala diff --git a/tests/fuzzy/RE-d341ba7adb385e80fb9955ca9161dd8f86ad3584.scala b/tests/pending/fuzzy/RE-d341ba7adb385e80fb9955ca9161dd8f86ad3584.scala similarity index 100% rename from tests/fuzzy/RE-d341ba7adb385e80fb9955ca9161dd8f86ad3584.scala rename to tests/pending/fuzzy/RE-d341ba7adb385e80fb9955ca9161dd8f86ad3584.scala diff --git a/tests/pos/i5006.scala b/tests/pos/i5006.scala deleted file mode 100644 index 1bd37e00d765..000000000000 --- a/tests/pos/i5006.scala +++ /dev/null @@ -1,11 +0,0 @@ -object i0 { - def f: Int = asInstanceOf[Int].toInt -} - -class i2 { - def f: Int = asInstanceOf[Int].toInt -} - -trait i3 { - def f: Int = asInstanceOf[Int].toInt -}