Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in subkinding #2067

Closed
scabug opened this issue Jun 17, 2009 · 2 comments · Fixed by scala/scala#9414
Closed

Mistake in subkinding #2067

scabug opened this issue Jun 17, 2009 · 2 comments · Fixed by scala/scala#9414
Assignees
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) has PR should not compile tcpoly typer
Milestone

Comments

@scabug
Copy link

scabug commented Jun 17, 2009

trait A[B[D[X, Y <: X]]] {
 def f() : B[P]
}

trait C[E[T, S]]

trait P[U, V <: U]

Now, the kinds are:

D : X@* -> *(Nothing,X) -> *
B : (X@* -> *(Nothing,X) -> *) -> *

E : * -> * -> *
C : (* -> * -> *) -> *

In type application A[C], C is substituted instead of the type parameter B, which leads to the ill-kinded type application C[P] in the return type of f().

So (* -> * -> *) -> * must be a subkind of (X@* -> *(Nothing,X) -> *) -> *.
Contravariantly, X@* -> *(Nothing,X) -> * must be a subkind of * -> * -> *.
Contravariantly, * must be a subkind of *(Nothing,X), but this is not the case.

@scabug
Copy link
Author

scabug commented Jun 17, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2067?orig=1
Reporter: Vladimir Reshetnikov (nikov)

@scabug
Copy link
Author

scabug commented Jun 17, 2009

Vladimir Reshetnikov (nikov) said:
A similar problem exists for variance annotations:

class P[Y](val y : Y)

trait A[T[_[_]]] {
  def g() : T[P] = error("")
}

trait C[X[+_]] {
  def f(x : X[Int]) : X[Any] = x
}

Type application A[C] should be rejected as ill-kinded, because C[P] is ill-kinded.

@scabug scabug added this to the Backlog milestone Apr 6, 2017
@scala scala deleted a comment from scabug Mar 3, 2018
@SethTisue SethTisue assigned SethTisue and unassigned SethTisue Jan 5, 2021
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Jan 5, 2021
@dwijnand dwijnand modified the milestones: Backlog, 2.13.5 Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) has PR should not compile tcpoly typer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants