summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-03-12 15:25:14 -0700
committerJason Zaugg <jzaugg@gmail.com>2015-03-12 15:26:57 -0700
commitbf01acd6143552be8a173472a839dfcdee27697c (patch)
treeae36faebd5d3d73ac5f3926867b966332a39742c /test/files/pos
parentfa33395a25c87115c910e8d4a4124aee6134062b (diff)
downloadscala-bf01acd6143552be8a173472a839dfcdee27697c.tar.gz
scala-bf01acd6143552be8a173472a839dfcdee27697c.tar.bz2
scala-bf01acd6143552be8a173472a839dfcdee27697c.zip
SI-9020 Avoid spurious value discarding warning post-typer
Typechecking during the specialization phase was emitting a bogus warning about value discarding. Such warnings in the typer should be guarded by `!isPastTyper` to restrict the analysis to the code the user originally wrote, rather than the results of later typechecking. I've made this change to the value discarding warning. I've also changed a numeric widening warning in the vicinity, although I do not have a test case for that.
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t9020.flags1
-rw-r--r--test/files/pos/t9020.scala10
2 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t9020.flags b/test/files/pos/t9020.flags
new file mode 100644
index 0000000000..efb2dd3e6f
--- /dev/null
+++ b/test/files/pos/t9020.flags
@@ -0,0 +1 @@
+-Ywarn-value-discard -Xfatal-warnings
diff --git a/test/files/pos/t9020.scala b/test/files/pos/t9020.scala
new file mode 100644
index 0000000000..16e31e2572
--- /dev/null
+++ b/test/files/pos/t9020.scala
@@ -0,0 +1,10 @@
+trait ValueDiscard[@specialized U] {
+ def u: U
+}
+/* Was:
+scalac-hash v2.11.5 -Ywarn-value-discard test/files/pos/t9020.scala
+test/files/pos/t9020.scala:2: warning: discarded non-Unit value
+ def u: U
+ ^
+one warning found
+*/