File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2388,7 +2388,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
23882388 case Atoms .Range (lo2, hi2) =>
23892389 if hi1.subsetOf(lo2) then return tp2
23902390 if hi2.subsetOf(lo1) then return tp1
2391- if (hi1 & hi2).isEmpty then return orType(tp1, tp2)
2391+ if (hi1 & hi2).isEmpty then return orType(tp1, tp2, isSoft = isSoft )
23922392 case none =>
23932393 case none =>
23942394 val t1 = mergeIfSuper(tp1, tp2, canConstrain)
Original file line number Diff line number Diff line change 1+ sealed trait Animal
2+ object Cat extends Animal
3+ object Dog extends Animal
4+
5+ type Mammal = Cat .type | Dog .type
6+
7+ class Test :
8+ def t1 =
9+ val mammals : List [Mammal ] = ???
10+ val result = mammals.head
11+ val mammal : Mammal = result // was: Type Mismatch Error:
12+ // Found: (result : Animal)
13+ // Required: Mammal
14+ ()
You can’t perform that action at this time.
0 commit comments