diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-11-18 22:39:35 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-12-20 13:24:21 -0800 |
commit | f1aa0b3795a8f649e71fa84e52e5b6f86257f3cb (patch) | |
tree | 561c8076e5d27b1498052f7bb0c9309f96c7f51a /test/files/neg | |
parent | 246653f024c13ba0348fec3f83b147de11251fe3 (diff) | |
download | scala-f1aa0b3795a8f649e71fa84e52e5b6f86257f3cb.tar.gz scala-f1aa0b3795a8f649e71fa84e52e5b6f86257f3cb.tar.bz2 scala-f1aa0b3795a8f649e71fa84e52e5b6f86257f3cb.zip |
SI-9636 More precise error pos on apply inference
If a method type arg is inferred Any, warn about the
function and not the innocent arg.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t9636.check | 6 | ||||
-rw-r--r-- | test/files/neg/t9636.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t9636.scala | 17 | ||||
-rw-r--r-- | test/files/neg/warn-inferred-any.check | 2 |
4 files changed, 25 insertions, 1 deletions
diff --git a/test/files/neg/t9636.check b/test/files/neg/t9636.check new file mode 100644 index 0000000000..f36d1d32b2 --- /dev/null +++ b/test/files/neg/t9636.check @@ -0,0 +1,6 @@ +t9636.scala:11: warning: a type was inferred to be `AnyVal`; this may indicate a programming error. + if (signature.sameElements(Array(0x1F, 0x8B))) { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t9636.flags b/test/files/neg/t9636.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/neg/t9636.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/neg/t9636.scala b/test/files/neg/t9636.scala new file mode 100644 index 0000000000..7ad5fb3e9e --- /dev/null +++ b/test/files/neg/t9636.scala @@ -0,0 +1,17 @@ + +import java.io._ +import java.util.zip._ + +class C { + def isWrapper(is: FileInputStream): InputStream = { + val pb = new PushbackInputStream(is, 2) + val signature = new Array[Byte](2) + pb.read(signature) + pb.unread(signature) + if (signature.sameElements(Array(0x1F, 0x8B))) { + new GZIPInputStream(new BufferedInputStream(pb)) + } else { + pb + } + } +} diff --git a/test/files/neg/warn-inferred-any.check b/test/files/neg/warn-inferred-any.check index 8ad81d1529..2b321a83c9 100644 --- a/test/files/neg/warn-inferred-any.check +++ b/test/files/neg/warn-inferred-any.check @@ -9,7 +9,7 @@ warn-inferred-any.scala:17: warning: a type was inferred to be `AnyVal`; this ma ^ warn-inferred-any.scala:25: warning: a type was inferred to be `Any`; this may indicate a programming error. def za = f(1, "one") - ^ + ^ error: No warnings can be incurred under -Xfatal-warnings. four warnings found one error found |