summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-10-10 16:02:17 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-10-10 16:05:29 +1000
commit5f6663ee19a95289b5466dab6b1caa92c579bc73 (patch)
tree3498424c11b08002652c03ff7fe55f10790affbb /test/files/neg
parent22233f40f641815fe7b9304bb386ee27c8422603 (diff)
downloadscala-5f6663ee19a95289b5466dab6b1caa92c579bc73.tar.gz
scala-5f6663ee19a95289b5466dab6b1caa92c579bc73.tar.bz2
scala-5f6663ee19a95289b5466dab6b1caa92c579bc73.zip
SI-5091 Move named-args cycle test from pending to neg
There is a typechecking cycle, and since 4669ac180e5 we now report this in a clearer manner. Once we change the language to unconditionally interpret an assignent in argument position as a named argument would be the only way to get this over to `pos`.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t5091.check9
-rw-r--r--test/files/neg/t5091.scala11
2 files changed, 20 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)
+ }
+
+}