diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-19 18:33:43 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-19 18:33:43 +0200 |
commit | c03b9655be4ea08d02c28771b3e203a4a91d29f2 (patch) | |
tree | 04fafe9d3f6a8a61399a2969693a43e3820d76b8 /tests/run | |
parent | 76a056f5e1ea01b3cfdc8832e2a164562da770ab (diff) | |
download | dotty-c03b9655be4ea08d02c28771b3e203a4a91d29f2.tar.gz dotty-c03b9655be4ea08d02c28771b3e203a4a91d29f2.tar.bz2 dotty-c03b9655be4ea08d02c28771b3e203a4a91d29f2.zip |
Fix problem in eta expansion.
Failure to do a widen caused by-name parameters to go undetected.
Diffstat (limited to 'tests/run')
-rw-r--r-- | tests/run/t5610a.check | 1 | ||||
-rw-r--r-- | tests/run/t5610a.scala | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/run/t5610a.check b/tests/run/t5610a.check new file mode 100644 index 000000000..2aa46b3b9 --- /dev/null +++ b/tests/run/t5610a.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/tests/run/t5610a.scala b/tests/run/t5610a.scala new file mode 100644 index 000000000..3787c0984 --- /dev/null +++ b/tests/run/t5610a.scala @@ -0,0 +1,19 @@ +object Test extends dotty.runtime.LegacyApp { + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) + + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } +} |