From 4669ac180e58daf97ac7f73af4622434b439631d Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 16 May 2012 15:24:59 +0200 Subject: better feedback for SI-5044 --- test/files/neg/names-defaults-neg.check | 6 +++++- test/files/neg/t5044.check | 9 +++++++++ test/files/neg/t5044.scala | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/files/neg/t5044.check create mode 100644 test/files/neg/t5044.scala (limited to 'test/files') diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 01bbe2de4e..6bbe2f580a 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -149,8 +149,12 @@ names-defaults-neg.scala:170: error: reference to x is ambiguous; it is both a m names-defaults-neg.scala:177: error: variable definition needs type because 'x' is used as a named argument in its body. class u15 { var x = u.f(x = 1) } ^ +names-defaults-neg.scala:177: warning: type-checking the invocation of method f checks if the named argument expression 'x = ...' 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 x. + class u15 { var x = u.f(x = 1) } + ^ names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a method parameter and a variable in scope. class u18 { var x: Int = u.f(x = 1) } ^ -one warning found +two warnings found 41 errors found diff --git a/test/files/neg/t5044.check b/test/files/neg/t5044.check new file mode 100644 index 0000000000..197da2a4e8 --- /dev/null +++ b/test/files/neg/t5044.check @@ -0,0 +1,9 @@ +t5044.scala:7: error: recursive value a needs type + val id = m(a) + ^ +t5044.scala:6: warning: type-checking the invocation of method foo checks if the named argument expression 'id = ...' 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 id. + val a = foo(id = 1) + ^ +one warning found +one error found diff --git a/test/files/neg/t5044.scala b/test/files/neg/t5044.scala new file mode 100644 index 0000000000..2663ec1bbb --- /dev/null +++ b/test/files/neg/t5044.scala @@ -0,0 +1,9 @@ +class T { + def foo[T](id: T) = 0 + def m(a: Int) = 0 + + def f { + val a = foo(id = 1) + val id = m(a) + } +} -- cgit v1.2.3