Skip to content

Commit ba1a113

Browse files
committed
Revert "Approximate MatchTypes with lub of case bodies, if non-recursive"
1 parent 0f7f990 commit ba1a113

File tree

6 files changed

+2
-42
lines changed

6 files changed

+2
-42
lines changed

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

-7
Original file line numberDiff line numberDiff line change
@@ -2897,13 +2897,6 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
28972897
tp
28982898
case tp: HKTypeLambda =>
28992899
tp
2900-
case tp: ParamRef =>
2901-
val st = tp.superTypeNormalized
2902-
if st.exists then
2903-
disjointnessBoundary(st)
2904-
else
2905-
// workaround for when ParamRef#underlying returns NoType
2906-
defn.AnyType
29072900
case tp: TypeProxy =>
29082901
disjointnessBoundary(tp.superTypeNormalized)
29092902
case tp: WildcardType =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

+1-9
Original file line numberDiff line numberDiff line change
@@ -2389,15 +2389,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
23892389
report.error(MatchTypeScrutineeCannotBeHigherKinded(sel1Tpe), sel1.srcPos)
23902390
val pt1 = if (bound1.isEmpty) pt else bound1.tpe
23912391
val cases1 = tree.cases.mapconserve(typedTypeCase(_, sel1Tpe, pt1))
2392-
val bound2 = if tree.bound.isEmpty then
2393-
val lub = cases1.foldLeft(defn.NothingType: Type): (acc, case1) =>
2394-
if !acc.exists then NoType
2395-
else if case1.body.tpe.isProvisional then NoType
2396-
else acc | case1.body.tpe
2397-
if lub.exists then TypeTree(lub, inferred = true)
2398-
else bound1
2399-
else bound1
2400-
assignType(cpy.MatchTypeTree(tree)(bound2, sel1, cases1), bound2, sel1, cases1)
2392+
assignType(cpy.MatchTypeTree(tree)(bound1, sel1, cases1), bound1, sel1, cases1)
24012393
}
24022394

24032395
def typedByNameTypeTree(tree: untpd.ByNameTypeTree)(using Context): ByNameTypeTree = tree.result match

tests/pos/13633.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object Sums extends App:
2121

2222
type Reverse[A] = ReverseLoop[A, EmptyTuple]
2323

24-
type PlusTri[A, B, C] <: Tuple = (A, B, C) match
24+
type PlusTri[A, B, C] = (A, B, C) match
2525
case (false, false, false) => (false, false)
2626
case (true, false, false) | (false, true, false) | (false, false, true) => (false, true)
2727
case (true, true, false) | (true, false, true) | (false, true, true) => (true, false)

tests/pos/Tuple.Drop.scala

-7
This file was deleted.

tests/pos/Tuple.Elem.scala

-7
This file was deleted.

tests/pos/i19710.scala

-11
This file was deleted.

0 commit comments

Comments
 (0)