Skip to content

Commit 1c3a286

Browse files
committed
Constrain patterns by both GADT upper bound & upcast
1 parent 9dca4a6 commit 1c3a286

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/PatternTypeConstrainer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ trait PatternTypeConstrainer { self: TypeComparer =>
144144
case tb: TypeBounds =>
145145
val hi = tb.hi
146146
constrainPatternType(pat, hi)
147-
case null => false
147+
case null => true
148148
}
149-
case _ => false
149+
case _ => true
150150
}
151151

152152
def trySuperType =
@@ -159,7 +159,7 @@ trait PatternTypeConstrainer { self: TypeComparer =>
159159
tryConstrainSimplePatternType(pat, upcasted) || constrainUpcasted(upcasted)
160160
else true
161161

162-
tryGadtBounds || trySuperType
162+
tryGadtBounds && trySuperType
163163
}
164164
}
165165

0 commit comments

Comments
 (0)