forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
EnzeXing
committed
Sep 7, 2024
1 parent
f97db49
commit 286f0c1
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
tests/init-global/pos/shared-local-var-between-recursion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
trait Foo: | ||
def f(): Int | ||
|
||
object O1 extends Foo: | ||
var a1: Int = bar(this).f() | ||
|
||
def bar(param: Foo): Foo = | ||
var local = param | ||
bar(O2) | ||
local | ||
override def f(): Int = 0 | ||
|
||
object O2 extends Foo: | ||
var a2 = 0 | ||
override def f(): Int = a2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
object O1: | ||
val a = O2.b() | ||
|
||
object O2: | ||
val b = f() | ||
def f(): () => Int = | ||
var local = 0 | ||
() => local // warn |