summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala4
-rw-r--r--test/files/neg/t3977.check4
-rw-r--r--test/files/neg/t3977.scala13
3 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index ca690735a4..27a582f4d9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -911,8 +911,8 @@ trait Implicits {
case SearchFailure if sym == OptManifestClass => wrapResult(gen.mkAttributedRef(NoManifest))
case result => result
}
- case TypeRef(_, sym, _) if sym.isAbstractType =>
- implicitManifestOrOfExpectedType(pt.bounds.lo)
+ case tp@TypeRef(_, sym, _) if sym.isAbstractType =>
+ implicitManifestOrOfExpectedType(tp.bounds.lo) // #3977: use tp (==pt.dealias), not pt (if pt is a type alias, pt.bounds.lo == pt)
case _ =>
searchImplicit(implicitsOfExpectedType, false)
// shouldn't we pass `pt` to `implicitsOfExpectedType`, or is the recursive case
diff --git a/test/files/neg/t3977.check b/test/files/neg/t3977.check
new file mode 100644
index 0000000000..9da118ee91
--- /dev/null
+++ b/test/files/neg/t3977.check
@@ -0,0 +1,4 @@
+t3977.scala:12: error: could not find implicit value for parameter w: False#If[E]
+ new NotNull
+ ^
+one error found
diff --git a/test/files/neg/t3977.scala b/test/files/neg/t3977.scala
new file mode 100644
index 0000000000..f55a832c52
--- /dev/null
+++ b/test/files/neg/t3977.scala
@@ -0,0 +1,13 @@
+trait Bool {
+ type If[T]
+}
+
+trait False extends Bool {
+ type If[F] = F
+}
+
+class Field[E, N <: Bool](implicit val w: N#If[E]) {
+ type NotNull = Field[E, False]
+
+ new NotNull
+} \ No newline at end of file