Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix checkKindBoundsHK for higher kinds
We need to flip the direction of the checks on every other level. This is similar to contravariance of higher-order function types.
- Loading branch information
Showing
3 changed files
with
35 additions
and
5 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,11 @@ | ||
subkinding.scala:5: error: kinds of the type arguments (Test1.C) do not conform to the expected kinds of the type parameters (type B) in trait A. | ||
Test1.C's type parameters do not match type B's expected parameters: | ||
type Y's bounds <: X are stricter than type S's declared bounds >: Nothing <: Any | ||
type T = A[C] | ||
^ | ||
subkinding.scala:12: error: kinds of the type arguments (Test2.C) do not conform to the expected kinds of the type parameters (type T) in trait A. | ||
Test2.C's type parameters do not match type T's expected parameters: | ||
type _ is invariant, but type _ is declared covariant | ||
type T = A[C] | ||
^ | ||
2 errors |
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,13 @@ | ||
object Test1 { | ||
trait A[B[D[X, Y <: X]]] | ||
trait C[E[T, S]] | ||
trait P[U, V <: U] | ||
type T = A[C] | ||
} | ||
|
||
object Test2 { | ||
class P[Y](val y : Y) | ||
trait A[T[_[_]]] | ||
trait C[X[+_]] | ||
type T = A[C] | ||
} |