summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2014-08-05 23:03:41 -0700
committerSom Snytt <som.snytt@gmail.com>2014-08-12 08:41:14 -0700
commit606a553e12dbc1bda25939dbda3e7fcaaaa678b9 (patch)
treefada590b863e805aa5ace25481e6a36255213b97 /test
parent2e3583b3644f3acd67933b54b9b61e6d60e9b6bb (diff)
downloadscala-606a553e12dbc1bda25939dbda3e7fcaaaa678b9.tar.gz
scala-606a553e12dbc1bda25939dbda3e7fcaaaa678b9.tar.bz2
scala-606a553e12dbc1bda25939dbda3e7fcaaaa678b9.zip
SI-8512 Infer Any for the q
Avoid the widening bug for q. This resolution also suffers from the inference of Any, which can trigger a warning and an anxiety attack. But that's still better than doing the wrong thing. Right?
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t8013.flags2
-rw-r--r--test/junit/scala/reflect/QTest.scala23
2 files changed, 24 insertions, 1 deletions
diff --git a/test/files/pos/t8013.flags b/test/files/pos/t8013.flags
index 954eaba352..3955bb6710 100644
--- a/test/files/pos/t8013.flags
+++ b/test/files/pos/t8013.flags
@@ -1 +1 @@
--Xfatal-warnings -Xlint
+-Xfatal-warnings -Xlint:-infer-any,_
diff --git a/test/junit/scala/reflect/QTest.scala b/test/junit/scala/reflect/QTest.scala
new file mode 100644
index 0000000000..24c35dc401
--- /dev/null
+++ b/test/junit/scala/reflect/QTest.scala
@@ -0,0 +1,23 @@
+
+package scala.reflect
+
+import org.junit.Test
+import org.junit.Assert._
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+import scala.tools.testing.AssertUtil._
+
+@RunWith(classOf[JUnit4])
+class QTest {
+
+ import reflect.runtime._
+ import universe._
+ @Test def qConstantsNotHomogenized() = {
+ //Apply(Select(Literal(Constant(1.0)), TermName("$plus")), List(Literal(Constant(1.0))))
+ val t = q"${1} + ${1.0}"
+ val Apply(Select(Literal(Constant(i)), TermName("$plus")), List(Literal(Constant(j)))) = t
+ assertEquals(1, i)
+ assertEquals(1.0, j)
+ }
+}