We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 758782a commit 8c6c421Copy full SHA for 8c6c421
compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -3808,7 +3808,10 @@ class Typer extends Namer
3808
mapOver(tp)
3809
}
3810
3811
- if tree.symbol.isOneOf(Module | Enum)
+ val sym = tree.symbol
3812
+
3813
+ // Is it certain that a value of `tree.tpe` is never a subtype of `pt`
3814
+ if (!sym.info.classSymbol.isNumericValueClass || !pt.classSymbol.isNumericValueClass)
3815
&& !(tree.tpe frozen_<:< pt) // fast track
3816
&& !(tree.tpe frozen_<:< approx(pt))
3817
then
tests/neg/i9166.scala
@@ -0,0 +1,6 @@
1
+object UnitTest extends App {
2
+ def foo(m: Unit) = m match {
3
+ case runtime.BoxedUnit.UNIT => println("ok") // error
4
+ }
5
+ foo(())
6
+}
0 commit comments