Skip to content

Commit bbfa7bc

Browse files
Revert "Approximate MatchTypes with lub of case bodies, if non-recursive" in 3.4.3 (#21268)
Reverts #19761 in 3.4.3-RC1 as discussed in #21258 and accepted by the core compiler team.
2 parents 5f36df2 + ff34648 commit bbfa7bc

File tree

8 files changed

+10
-44
lines changed

8 files changed

+10
-44
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

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionScalaCliSuite.scala

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dotty.tools.pc.tests.completion
33
import dotty.tools.pc.base.BaseCompletionSuite
44

55
import org.junit.Test
6+
import org.junit.Ignore
67

78
class CompletionScalaCliSuite extends BaseCompletionSuite:
89

@@ -28,7 +29,8 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
2829
|// //> using lib ???
2930
|//> using lib io.circe::circe-core_native0.4
3031
|package A
31-
|""".stripMargin
32+
|""".stripMargin,
33+
assertSingleItem = false
3234
)
3335

3436
@Test def `version-sort` =
@@ -43,6 +45,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
4345
|""".stripMargin,
4446
)
4547

48+
@Ignore
4649
@Test def `single-colon` =
4750
check(
4851
"""|//> using lib "io.circe:circe-core_na@@
@@ -73,6 +76,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
7376
|""".stripMargin,
7477
)
7578

79+
@Ignore
7680
@Test def `multiple-libs` =
7781
check(
7882
"""|//> using lib "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"
@@ -81,6 +85,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
8185
"circe-core_native0.4"
8286
)
8387

88+
@Ignore
8489
@Test def `script` =
8590
check(
8691
scriptWrapper(
@@ -133,6 +138,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite:
133138
|io.circul""".stripMargin
134139
)
135140

141+
@Ignore
136142
@Test def `multiple-deps2` =
137143
check(
138144
"""|//> using libs "io.circe::circe-core:0.14.0", "io.circe::circe-core_na@@"

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.

tests/run-macros/type-show/Test_2.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Test {
2323
"""TypeRef(ThisType(TypeRef(NoPrefix(), "scala")), "Nothing"), """+
2424
"""TypeRef(ThisType(TypeRef(NoPrefix(), "scala")), "Any"))), """+
2525
"""MatchType("""+
26-
"""TypeRef(TermRef(ThisType(TypeRef(NoPrefix(), "<root>")), "scala"), "Int"), """+ // match type bound
26+
"""TypeRef(ThisType(TypeRef(NoPrefix(), "scala")), "Any"), """+ // match type bound
2727
"""ParamRef(binder, 0), """+
2828
"""List("""+
2929
"""MatchCase("""+

0 commit comments

Comments
 (0)