diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-11-05 16:29:03 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-11-05 16:29:03 +0100 |
commit | b0ab0fca9e7776baf08381a0656cd074a84accc6 (patch) | |
tree | e19f4b18e5fe071deb6714f7b0bab655622c867b /test/files | |
parent | 494914346ed6f27b44283f4850383582a7a7f6d1 (diff) | |
parent | e9843598092579761cccdfcad03a88c61cd5b079 (diff) | |
download | scala-b0ab0fca9e7776baf08381a0656cd074a84accc6.tar.gz scala-b0ab0fca9e7776baf08381a0656cd074a84accc6.tar.bz2 scala-b0ab0fca9e7776baf08381a0656cd074a84accc6.zip |
Merge pull request #4044 from retronym/ticket/5091
SI-5091 Move named-args cycle test from pending to neg
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t5091.check | 9 | ||||
-rw-r--r-- | test/files/neg/t5091.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t6051.scala | 19 |
3 files changed, 39 insertions, 0 deletions
diff --git a/test/files/neg/t5091.check b/test/files/neg/t5091.check new file mode 100644 index 0000000000..abd24e3145 --- /dev/null +++ b/test/files/neg/t5091.check @@ -0,0 +1,9 @@ +t5091.scala:8: error: recursive value xxx needs type + val param = bar(xxx) + ^ +t5091.scala:7: warning: type-checking the invocation of method foo checks if the named argument expression 'param = ...' is a valid assignment +in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for param. + val xxx = foo(param = null) + ^ +one warning found +one error found diff --git a/test/files/neg/t5091.scala b/test/files/neg/t5091.scala new file mode 100644 index 0000000000..217e83f66d --- /dev/null +++ b/test/files/neg/t5091.scala @@ -0,0 +1,11 @@ +object RecursiveValueNeedsType { + + def foo(param: String) = 42 + def bar(n: Int) = 42 + + { + val xxx = foo(param = null) + val param = bar(xxx) + } + +} diff --git a/test/files/pos/t6051.scala b/test/files/pos/t6051.scala new file mode 100644 index 0000000000..854524feb9 --- /dev/null +++ b/test/files/pos/t6051.scala @@ -0,0 +1,19 @@ +object Foo1 { + def foo(x: Int, y: Int = 10) = x*y + lazy val y = foo(x = 20) +} + +object Foo2 { + def foo(x: Int, y: Int = 10) = x*y + val y = foo(x = 20) +} + +object Foo3 { + def foo(x: Int, y: Int = 10) = x*y + def y = foo(x = 20) +} + +object Foo4 { + def foo(x: Int, y: Int = 10) = x*y + var y = foo(x = 20) +} |