File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -3808,9 +3808,12 @@ class Typer extends Namer
3808
3808
mapOver(tp)
3809
3809
}
3810
3810
3811
- if tree.symbol.isOneOf(Module | Enum )
3812
- && ! (tree.tpe frozen_<:< pt) // fast track
3813
- && ! (tree.tpe frozen_<:< approx(pt))
3811
+ val sym = tree.symbol
3812
+
3813
+ if ! sym.info.classSymbol.asClass.mayHaveCommonChild(pt.classSymbol.asClass)
3814
+ || sym.isOneOf(Module | Enum )
3815
+ && ! (tree.tpe frozen_<:< pt) // fast track
3816
+ && ! (tree.tpe frozen_<:< approx(pt))
3814
3817
then
3815
3818
// We could check whether `equals` is overriden.
3816
3819
// Reasons for not doing so:
Original file line number Diff line number Diff line change
1
+ object UnitTest extends App {
2
+ def foo (m : Unit ) = m match {
3
+ case runtime.BoxedUnit .UNIT => println(" ok" ) // error
4
+ }
5
+ foo(())
6
+ }
You can’t perform that action at this time.
0 commit comments