-
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.
Only set
AppliedType#validSuper
after AppliedType#cachedSuper
since cycles are possible when computing `AppliedType#superType`, see tests/neg/i20546.scala for an example leading to an NPE. We could use `ctx.period == validSuper && cachedSuper == null` as condition to detect cycles, but they are already handled in `TypeApplications#appliedTo`, with a better error message. We can update `AppliedType#validSuper` only after the computation is done to fix #20546
- Loading branch information
1 parent
f7ab683
commit 26874bd
Showing
2 changed files
with
25 additions
and
3 deletions.
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,22 @@ | ||
import NamedTuple.{NamedTuple, AnyNamedTuple} | ||
|
||
type And[X <: Boolean, Y <: Boolean] <: Boolean = (X, Y) match | ||
case (true, true) => true | ||
case _ => false | ||
type AndLambda = [X <: Boolean, Y <: Boolean] =>> And[X, Y] | ||
|
||
trait Expr2[Result, Scalar <: Boolean]: | ||
type StripScalar[E] = E match | ||
case Expr2[_, s] => s | ||
|
||
type AllScalar[A <: AnyNamedTuple] = Tuple.Fold[Tuple.Map[NamedTuple.DropNames[A], StripScalar], true, AndLambda] // error: cyclic | ||
|
||
|
||
object Minimization: | ||
type And[X <: Boolean, Y <: Boolean] = (X, Y) match | ||
case (true, true) => true | ||
case _ => false | ||
|
||
type AndLambda = [X <: Boolean, Y <: Boolean] =>> And[X, Y] | ||
|
||
type All[A <: Tuple] = Tuple.Fold[A, true, AndLambda] // error: cyclic |