-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
assertion failed: Inconsistent state in TS[212X, 211, 2, 1, 0]: it owns TypeVar(TypeParamRef(S2)) whose owningState is TS[211, 2, 1, 0] #13407
Comments
Same on head. |
Here's another slightly different repro: sealed trait Assertion[Cond <: Boolean]
object Assertion {
given Assertion[true] with {
}
}
type IsPermutation[T <: Tuple, T2 <: Tuple] <: Boolean = T match {
case EmptyTuple => T2 match {
case EmptyTuple => true
case _ => false
}
case h *: tail => T2 match {
case EmptyTuple => false
case _ => IsPermutation[tail, Remove[T2, h]]
}
}
type Remove[T <: Tuple, X] <: Tuple = T match {
case EmptyTuple => EmptyTuple
case head *: tail => head match {
case X => tail
case _ => head *: Remove[tail, X]
}
}
trait Tensor[S <: Tuple] {
// === isn't defined
def +[S2 <: Tuple](other: Tensor[S2])(using Assertion[IsPermutation[S, S2]]): Tensor[S] = new Tensor {}
}
object Tensor {
def mk[S <: Tuple]: Tensor[S] = new Tensor {}
}
object Foo {
val t1: Tensor[("batch", "len", "embed")] = Tensor.mk
val t2: Tensor[("embed", "hid")] = Tensor.mk
def foo(x: Any) = x
// ok
// foo(t1 + t2)
def bar(x: Any) = {
x
}
bar ( foo (t1 +t2))
} |
(I don't know why it matters, but the expression has to be doubly nested... Singly doesn't trigger it) |
here's a shorter one I accidentally stumbled on:
|
smarter
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 28, 2021
An already-committed TyperState might be committed again when errors are flushed (cf scala#12827, scala#13150) and `commit()` calls `gc()`. This operation could crash before this commit because we attempted to instantiate type variables no longer owned by the TyperState. We fix this by clearing `ownedVars` when committing a TyperState (because after committing it no longer owns any type variable). Fixes scala#13407.
olsdavis
pushed a commit
to olsdavis/dotty
that referenced
this issue
Apr 4, 2022
An already-committed TyperState might be committed again when errors are flushed (cf scala#12827, scala#13150) and `commit()` calls `gc()`. This operation could crash before this commit because we attempted to instantiate type variables no longer owned by the TyperState. We fix this by clearing `ownedVars` when committing a TyperState (because after committing it no longer owns any type variable). Fixes scala#13407.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe related to #13101 but I can repro in latest RC, which I think has a fix for that.
Compiler version
3.0.1, 3.0.2-RC1, 3.0.2-RC2
Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: