summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-24 16:40:18 -0800
committerPaul Phillips <paulp@improving.org>2013-01-24 16:40:18 -0800
commitbd78be0bed5ad00c3965120311df17f09e656f00 (patch)
treefef7f46abe525908e71302fa76d80256e96f9642 /test
parentac432bcde6b357194203d25df5f204ab8e426416 (diff)
parent96ed055769483d661b09f346cd1641f956f3172a (diff)
downloadscala-bd78be0bed5ad00c3965120311df17f09e656f00.tar.gz
scala-bd78be0bed5ad00c3965120311df17f09e656f00.tar.bz2
scala-bd78be0bed5ad00c3965120311df17f09e656f00.zip
Merge pull request #1954 from retronym/backport/1565
[backport] SI-6567 Warning for Option(implicitView(foo))
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t6567.check7
-rw-r--r--test/files/neg/t6567.flags1
-rw-r--r--test/files/neg/t6567.scala11
3 files changed, 19 insertions, 0 deletions
diff --git a/test/files/neg/t6567.check b/test/files/neg/t6567.check
new file mode 100644
index 0000000000..4c513e64cd
--- /dev/null
+++ b/test/files/neg/t6567.check
@@ -0,0 +1,7 @@
+t6567.scala:8: error: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply.
+ Option[B](a)
+ ^
+t6567.scala:10: error: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply.
+ val b: Option[B] = Option(a)
+ ^
+two errors found
diff --git a/test/files/neg/t6567.flags b/test/files/neg/t6567.flags
new file mode 100644
index 0000000000..e93641e931
--- /dev/null
+++ b/test/files/neg/t6567.flags
@@ -0,0 +1 @@
+-Xlint -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t6567.scala b/test/files/neg/t6567.scala
new file mode 100644
index 0000000000..650e5e39ae
--- /dev/null
+++ b/test/files/neg/t6567.scala
@@ -0,0 +1,11 @@
+class A
+class B
+
+object Test {
+ val a: A = null
+ implicit def a2b(a: A) = new B
+
+ Option[B](a)
+
+ val b: Option[B] = Option(a)
+}