-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not propagate
TypeError
s of ops from TypeComparer#tryAlso
In pos-deep-subtype/i21015.scala:30, we ask the TypeComparer if `M1[Int] <:< M1[A]` `isMatchingApply` first tries `isSubArgs` which succeeds, but then also checks if a weaker constraint is generated by `recur(tp1.superTypeNormalized, tp2.superTypeNormalized)`. The latter throws a `RecursionOverflow` which, before the changes, bypassed the former successful check, and failed the overall subtype test. Fix #21015
- Loading branch information
1 parent
ab48a55
commit 2d0e373
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
type Init[Coll[_], A, T <: Tuple] = T match | ||
case EmptyTuple => A | ||
case head *: rest => InitCons[Coll, A, head, rest] | ||
|
||
type InitCons[Coll[_], A, H, Rest <: Tuple] = H match | ||
case Int => Init[Coll, Coll[A], Rest] | ||
case _ => Unit | ||
|
||
def fillVector[A, T <: Tuple](dims: T)(x: => A): Init[Vector, A, T] = | ||
dims match | ||
case _: EmptyTuple => x | ||
case (p : (head *: rest)) => | ||
val (head *: rest) = p | ||
head match | ||
case size: Int => fillVector(rest)(Vector.fill(size)(x)) | ||
case _ => () | ||
|
||
|
||
object Minimization: | ||
|
||
type M1[A] = Int match | ||
case 1 => M2[A] | ||
|
||
type M2[A] = Int match | ||
case 2 => M1[Option[A]] | ||
|
||
def m1[A](x: A): M1[A] = ??? | ||
|
||
val _: M1[Int] = m1(1) // was error | ||
val _: M1[Int] = m1[Int](1) // ok | ||
val _: M1[Int] = | ||
val x = m1(1) | ||
x // ok | ||
|
||
end Minimization |