Skip to content

Commit def7c9d

Browse files
dwijnandWojciechMazur
authored andcommitted
Use isProvisional instead of has LazyRef
[Cherry-picked 55ecbfc]
1 parent b956839 commit def7c9d

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,8 +2281,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
22812281
val bound2 = if tree.bound.isEmpty then
22822282
val lub = cases1.foldLeft(defn.NothingType: Type): (acc, case1) =>
22832283
if !acc.exists then NoType
2284-
else if case1.body.tpe.existsPart(_.isInstanceOf[LazyRef]) then NoType
2285-
else acc | TypeOps.avoid(case1.body.tpe, patVars(case1))
2284+
else if case1.body.tpe.isProvisional then NoType
2285+
else acc | case1.body.tpe
22862286
if lub.exists then TypeTree(lub, inferred = true)
22872287
else bound1
22882288
else bound1

tests/pos/Tuple.Drop.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import compiletime.ops.int.*
2+
3+
type Drop[T <: Tuple, N <: Int] <: Tuple = N match
4+
case 0 => T
5+
case S[n1] => T match
6+
case EmptyTuple => EmptyTuple
7+
case x *: xs => Drop[xs, n1]

tests/pos/Tuple.Elem.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import compiletime.ops.int.*
2+
3+
type Elem[T <: Tuple, I <: Int] = T match
4+
case h *: tail =>
5+
I match
6+
case 0 => h
7+
case S[j] => Elem[tail, j]

0 commit comments

Comments
 (0)