summaryrefslogtreecommitdiff
path: root/test/files/neg/t8450.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-03-26 17:33:26 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-03-26 17:43:09 -0700
commit92460c57eb7a0a8cfcff563d868aa39015f0b764 (patch)
tree4aac751880d650a66548d224ae8a5976b044427c /test/files/neg/t8450.scala
parentc34826d1ca183a29f73eb056f69c59a50091ec4d (diff)
downloadscala-92460c57eb7a0a8cfcff563d868aa39015f0b764.tar.gz
scala-92460c57eb7a0a8cfcff563d868aa39015f0b764.tar.bz2
scala-92460c57eb7a0a8cfcff563d868aa39015f0b764.zip
SI-8450 no "implicit numeric widening" in silent mode
Before this fix, we get a second, spurious warning. ``` t8450.scala:5: warning: implicit numeric widening def elapsed: Foo = (System.nanoTime - 100L).foo ^ t8450.scala:11: warning: implicit numeric widening def elapsed: Foo = (System.nanoTime - 100L).foo ^ error: No warnings can be incurred under -Xfatal-warnings. two warnings found one error found ``` By respecting silent contexts, we now get only one. I sneakily fixed similar occurrences without adding a test.
Diffstat (limited to 'test/files/neg/t8450.scala')
-rw-r--r--test/files/neg/t8450.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/neg/t8450.scala b/test/files/neg/t8450.scala
new file mode 100644
index 0000000000..f20ed2bc31
--- /dev/null
+++ b/test/files/neg/t8450.scala
@@ -0,0 +1,12 @@
+trait Foo
+
+class WarnWidening {
+ implicit class FooDouble(d: Double) { def foo = new Foo {} }
+ def elapsed: Foo = (System.nanoTime - 100L).foo
+}
+
+class NoWarnWidening {
+ implicit class FooLong(l: Long) { def foo = new Foo {} }
+ implicit class FooDouble(d: Double) { def foo = new Foo {} }
+ def elapsed: Foo = (System.nanoTime - 100L).foo
+}