Skip to content

Commit 363802f

Browse files
authored
Add init test for cacheResult flag (#17150)
This test checks for the presence of the `cacheResult = true` flag on the call to cachedEval from [Semantic.scala:992](https://github.com/lampepfl/dotty/blob/e3aeed198717e6764f2a27b70a22a03b03a87a0b/compiler/src/dotty/tools/dotc/transform/init/Semantic.scala#L992). Without that flag, the compiler crashes on this test with `-Ysafe-init`.
2 parents d4e80c4 + e3aeed1 commit 363802f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/init/pos/recursive.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class A {
2+
def p(cb: Int => Int): Int = cb(0)
3+
4+
val q: List[Int] = {
5+
def f(x: Int): Int => Int = y => p(f(y))
6+
List(1, 2).map(f(3))
7+
}
8+
val n: Int = 4
9+
}

0 commit comments

Comments
 (0)