-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eval-captured-value-class test with TODO fix
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
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,25 @@ | ||
break Test$ 14 | ||
eval new A("foo") | ||
result fo | ||
eval m("bar") | ||
result ba | ||
|
||
break Test$A$1 9 | ||
eval size | ||
result 2 | ||
eval size.value | ||
result 2 | ||
eval new A("foo") | ||
result fo | ||
// TODO fix eval m("bar") | ||
// TODO fix result ba | ||
|
||
break Test$ 12 | ||
eval size | ||
result 2 | ||
eval size.value | ||
result 2 | ||
eval new A("foo") | ||
result fo | ||
eval m("bar") | ||
result ba |
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 @@ | ||
class Size(val value: Int) extends AnyVal | ||
|
||
object Test: | ||
def main(args: Array[String]): Unit = | ||
val size = new Size(2) | ||
|
||
class A(msg: String): | ||
override def toString: String = | ||
msg.take(size.value) | ||
|
||
def m(msg: String): String = | ||
msg.take(size.value) | ||
|
||
println(new A("foo")) | ||
println(m("bar")) |