Skip to content

Commit aaac006

Browse files
authored
Merge pull request #13592 from dotty-staging/fix-13358
Add regression test for #13358
2 parents 5f47bfd + ea9047a commit aaac006

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/run/i13358.check

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
1
2+
1
3+
1
4+
1
5+
2
6+
2
7+
2
8+
2

tests/run/i13358.scala

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
object Test:
2+
var cnt = 0
3+
4+
trait Foo:
5+
lazy val foo1 = {cnt+=1; cnt}
6+
7+
@scala.annotation.targetName("fooTwo")
8+
lazy val foo2 = {cnt+=1; cnt}
9+
10+
object Bar extends Foo
11+
12+
def main(sa: Array[String]): Unit =
13+
14+
println(Bar.foo1) // Prints 1
15+
println(Bar.foo1) // Prints 1
16+
println(Bar.foo1) // Prints 1
17+
println(Bar.foo1) // Prints 1
18+
19+
println(Bar.foo2) // Prints 2
20+
println(Bar.foo2) // Prints 3 EXPECTED 2
21+
println(Bar.foo2) // Prints 4 EXPECTED 2
22+
println(Bar.foo2) // Prints 5 EXPECTED 2

0 commit comments

Comments
 (0)