-
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.
used derived types to type arguments of dependent function type (#19838)
We don't need to repeat the tree twice, instead derive a type tree from the original tree, and reuse its spans. fixes #19629
- Loading branch information
Showing
5 changed files
with
45 additions
and
4 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,10 @@ | ||
trait CP[A,B] | ||
trait TypeEqK[F[_], G[_]] | ||
|
||
trait Knit[CP[_, _], F[_]] { | ||
type Res | ||
|
||
def visit[R]( | ||
caseInFst: [F1[_], Y] => (k: Knit[CP, F1]) => (ev: TypeEqK[F, [x] =>> CP[F1[x], Y]]) => R | ||
): R | ||
} |
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,12 @@ | ||
|
||
class Container[Y1, G[_]]: | ||
lazy val outer: Knit[CP, G] = new: | ||
type Res = Y1 | ||
def visit[R](caseInFst: [F1[_], Y] => (k: Knit[CP, F1]) => (ev: TypeEqK[G, [x] =>> CP[F1[x], Y]]) => R): R = | ||
caseInFst[G, Res](outer)(new TypeEqK[G, [x] =>> CP[G[x], Res]] {}) | ||
|
||
@main def Test = | ||
val knit = new Container[Unit, Option].outer | ||
val res = knit.visit: | ||
[F1[_], Y] => (k: Knit[CP, F1]) => (ev: TypeEqK[Option, [x] =>> CP[F1[x], Y]]) => 42 | ||
assert(res == 42) |
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,10 @@ | ||
trait CP[A,B] | ||
trait TypeEqK[F[_], G[_]] | ||
|
||
trait Knit[CP[_, _], F[_]] { | ||
type Res | ||
|
||
def visit[R]( | ||
caseInFst: [F1[_], Y] => (k: Knit[CP, F1]) => (ev: TypeEqK[F, [x] =>> CP[F1[x], Y]]) => R | ||
): R | ||
} |