diff --git a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 4b31f5ae28cf..a77f892d9c46 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -168,7 +168,8 @@ object TypeTestsCasts { cpy.TypeApply(tree)(expr1.select(sym).withSpan(expr.span), List(TypeTree(tp))) def effectiveClass(tp: Type): Symbol = - if (tp.isRef(defn.PairClass)) effectiveClass(erasure(tp)) + if tp.isRef(defn.PairClass) then effectiveClass(erasure(tp)) + else if tp.isRef(defn.AnyValClass) then defn.AnyClass else tp.classSymbol def foundCls = effectiveClass(expr.tpe.widen) diff --git a/tests/run/i7783.scala b/tests/run/i7783.scala new file mode 100644 index 000000000000..04a4a2a69f8c --- /dev/null +++ b/tests/run/i7783.scala @@ -0,0 +1,6 @@ +object Test extends App { + def foo(t: AnyVal): Unit = t match { + case _: Int => + } + foo(3) +} \ No newline at end of file