Skip to content

Commit a345e9e

Browse files
committed
Reduce matches on creation
1 parent a19e2cc commit a345e9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3623,8 +3623,10 @@ object Types {
36233623
class CachedMatchType(bound: Type, scrutinee: Type, cases: List[Type]) extends MatchType(bound, scrutinee, cases)
36243624

36253625
object MatchType {
3626-
def apply(bound: Type, scrutinee: Type, cases: List[Type])(implicit ctx: Context) =
3627-
unique(new CachedMatchType(bound, scrutinee, cases))
3626+
def apply(bound: Type, scrutinee: Type, cases: List[Type])(implicit ctx: Context) = {
3627+
val mt = unique(new CachedMatchType(bound, scrutinee, cases))
3628+
mt.reduced.orElse(mt)
3629+
}
36283630
}
36293631

36303632
// ------ ClassInfo, Type Bounds --------------------------------------------------

0 commit comments

Comments
 (0)