summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/neg/t6436.check10
-rw-r--r--test/files/neg/t6436.scala9
-rw-r--r--test/files/neg/t6436b.check10
-rw-r--r--test/files/neg/t6436b.scala9
5 files changed, 39 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index c25b6c3726..335d93f387 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4578,7 +4578,7 @@ trait Typers extends Modes with Adaptations with Tags {
// xml member to StringContext, which in turn has an unapply[Seq] method)
if (name != nme.CONSTRUCTOR && inExprModeOr(mode, PATTERNmode)) {
val qual1 = adaptToMemberWithArgs(tree, qual, name, mode, true, true)
- if (qual1 ne qual)
+ if ((qual1 ne qual) && !qual1.isErrorTyped)
return typed(treeCopy.Select(tree, qual1, name), mode, pt)
}
NoSymbol
diff --git a/test/files/neg/t6436.check b/test/files/neg/t6436.check
new file mode 100644
index 0000000000..ecb28f9100
--- /dev/null
+++ b/test/files/neg/t6436.check
@@ -0,0 +1,10 @@
+t6436.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(q"a")
+ ^
+one error found
diff --git a/test/files/neg/t6436.scala b/test/files/neg/t6436.scala
new file mode 100644
index 0000000000..2c40502538
--- /dev/null
+++ b/test/files/neg/t6436.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(q"a")
+}
diff --git a/test/files/neg/t6436b.check b/test/files/neg/t6436b.check
new file mode 100644
index 0000000000..b3c2d73739
--- /dev/null
+++ b/test/files/neg/t6436b.check
@@ -0,0 +1,10 @@
+t6436b.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(StringContext("a").q())
+ ^
+one error found
diff --git a/test/files/neg/t6436b.scala b/test/files/neg/t6436b.scala
new file mode 100644
index 0000000000..8023329e90
--- /dev/null
+++ b/test/files/neg/t6436b.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(StringContext("a").q())
+}