forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow poly-kinded GADT vars to infer constraints
Allowing the types to flow through in thirdTryNamed requires a tweak to baseType. Given "class C[T <: Int]" (from tests/pos-macros/i10864a) the basetype of a TypeRef of just "C", with the Any class symbol, shouldn't return Any because "C" is not a proper/value type. That is, in baseType, we need to short-circuit TypeProxy.superType (i.e. underlying), which is returns resultType for a HKLambda.
- Loading branch information
Showing
4 changed files
with
42 additions
and
6 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
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,21 @@ | ||
sealed trait Wrap[A <: AnyKind] | ||
|
||
trait Foo[T <: AnyKind, X[_ <: T]] | ||
|
||
trait Bar[T <: AnyKind, X[_ <: T]] { | ||
|
||
def foo: Foo[ | ||
Wrap[? <: T], | ||
[x <: Wrap[? <: T]] =>> x match { case Wrap[a] => X[a] } | ||
] | ||
|
||
} | ||
|
||
object Qux extends Bar[Any, [_] =>> Unit] { | ||
|
||
override def foo: Foo[ | ||
Wrap[? <: Any], | ||
[x <: Wrap[? <: Any]] =>> x match { case Wrap[a] => Unit } | ||
] = ??? | ||
|
||
} |
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,15 @@ | ||
sealed trait Bx[AK1 <: AnyKind] | ||
trait C1[AK2 <: AnyKind, X[_ <: AK2]] | ||
trait C2[AK3 <: AnyKind, Y[_ <: AK3]]: | ||
def mm: C1[Bx[? <: AK3], [x <: Bx[? <: AK3]] =>> x match { case Bx[a] => Y[a] }] | ||
class C3 extends C2[Any, [_] =>> Unit]: | ||
override def mm: C1[Bx[? <: Any], [y <: Bx[? <: Any]] =>> y match { case Bx[b] => Unit }] = ??? | ||
|
||
/* | ||
C1[Bx[?], [y <: Bx[?]] =>> y match { case Bx[b] => Unit } <: Unit] <: C1[Bx[?], [x <: Bx[?]] =>> x match { case Bx[a] => Unit } <: Unit] | ||
[x <: Bx[?]] =>> x match { case Bx[a] => Unit } <: Unit <: [y <: Bx[?]] =>> y match { case Bx[b] => Unit } <: Unit | ||
x match { case Bx[a] => Unit } <: Unit <: x match { case Bx[b] => Unit } <: Unit | ||
[a] =>> case Bx[a] => Unit <: [b <: AnyKind] =>> case Bx[b] => Unit | ||
[ <: AnyKind] <: [] | ||
AnyKind <: Any = false | ||
*/ |