Skip to content

Commit f819617

Browse files
authored
Merge pull request #13408 from dotty-staging/committed-ownedVars
Don't crash when calling gc() on a committed TyperState
2 parents 427d313 + a040cc6 commit f819617

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

compiler/src/dotty/tools/dotc/core/TyperState.scala

+1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class TyperState() {
162162
targetState.mergeConstraintWith(this)
163163
targetState.gc()
164164
isCommitted = true
165+
ownedVars = SimpleIdentitySet.empty
165166
}
166167

167168
/** Ensure that this constraint does not associate different TypeVars for the

tests/neg/i13407.scala

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import scala.quoted.Type
2+
3+
trait Tensor[S <: Tuple] {
4+
def sum[Axis <: Shape: Type](axis: Axis): Tensor[S] = { // error
5+
Tensor.mk
6+
}
7+
}
8+
9+
object Tensor {
10+
def mk[S <: Tuple]: Tensor[S] = new Tensor {}
11+
}
12+
13+
object Foo {
14+
val t1: Tensor[("batch", "len", "embed")] = Tensor.mk
15+
def foo(x: Any) = {
16+
17+
}
18+
foo(foo(t1.sum("len"))) // error
19+
}

0 commit comments

Comments
 (0)