diff options
author | Brian McKenna <brian@precog.com> | 2013-01-07 18:17:05 +1000 |
---|---|---|
committer | Brian McKenna <brian@precog.com> | 2013-01-07 19:22:04 +1000 |
commit | 66fe64f8f72ba7d574e07d3308d72cd3766a5763 (patch) | |
tree | aca5503608b9265e24d73ded3c144cd34ad7e8a0 /test/files/neg/names-defaults-neg.check | |
parent | 766bb97114b5932b75340a9169558de61899997e (diff) | |
download | scala-66fe64f8f72ba7d574e07d3308d72cd3766a5763.tar.gz scala-66fe64f8f72ba7d574e07d3308d72cd3766a5763.tar.bz2 scala-66fe64f8f72ba7d574e07d3308d72cd3766a5763.zip |
SI-6923 Context now buffers warnings as well as errors
Code that was silently typed would not report warnings, even if it
returned a successful result.
This appeared in the following code which didn't show warnings even
with -Ywarn-adapted-args:
def foo(a: Any) = a; foo(1, 2)
While the following would show the expected warning:
def foo[A](a: Any) = a; foo(1, 2)
Diffstat (limited to 'test/files/neg/names-defaults-neg.check')
-rw-r--r-- | test/files/neg/names-defaults-neg.check | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 6f9dc7d127..f6bd703e1f 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -134,9 +134,17 @@ names-defaults-neg.scala:144: error: variable definition needs type because 'x' names-defaults-neg.scala:147: error: variable definition needs type because 'x' is used as a named argument in its body. object t6 { var x = t.f(x = 1) } ^ +names-defaults-neg.scala:147: 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. + object t6 { var x = t.f(x = 1) } + ^ names-defaults-neg.scala:150: error: variable definition needs type because 'x' is used as a named argument in its body. class t9 { var x = t.f(x = 1) } ^ +names-defaults-neg.scala:150: 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 t9 { var x = t.f(x = 1) } + ^ names-defaults-neg.scala:164: error: variable definition needs type because 'x' is used as a named argument in its body. def u3 { var x = u.f(x = 1) } ^ @@ -156,5 +164,5 @@ in the current scope. The resulting type inference error (see above) can be fixe 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) } ^ -two warnings found +four warnings found 41 errors found |