aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-03-03 14:15:30 +0100
committerGitHub <noreply@github.com>2017-03-03 14:15:30 +0100
commit761b1fd116ddbf24e54dc46f85017f6ee2397142 (patch)
tree1aa29fc99df1cdf53c84ad96f36eac26d12db22a /compiler/src
parent917a7edad284b180dff917341dd0f800d430291f (diff)
parent2e33a882f4dee2731df3e4604e9af338b5a8ec42 (diff)
downloaddotty-761b1fd116ddbf24e54dc46f85017f6ee2397142.tar.gz
dotty-761b1fd116ddbf24e54dc46f85017f6ee2397142.tar.bz2
dotty-761b1fd116ddbf24e54dc46f85017f6ee2397142.zip
Merge pull request #2031 from dotty-staging/fix-#2030
Fix #2030: Don't chain implicit conversions
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Implicits.scala1
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala2
3 files changed, 3 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index e9df12b42..222717e7e 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -1384,7 +1384,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
else WildcardType)
val commonFormal = defn.FunctionOf(commonParamTypes, WildcardType)
overload.println(i"pretype arg $arg with expected type $commonFormal")
- pt.typedArg(arg, commonFormal)
+ pt.typedArg(arg, commonFormal)(ctx.addMode(Mode.ImplicitsEnabled))
}
}
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index d5afae90c..759cc62e9 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -496,6 +496,7 @@ trait Implicits { self: Typer =>
|| (to isRef defn.UnitClass)
|| (from.tpe isRef defn.NothingClass)
|| (from.tpe isRef defn.NullClass)
+ || !(ctx.mode is Mode.ImplicitsEnabled)
|| (from.tpe eq NoPrefix)) NoImplicitMatches
else
try inferImplicit(to.stripTypeVar.widenExpr, from, from.pos)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 33e320ce5..57e3c1b88 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -2023,7 +2023,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
// try an implicit conversion
inferView(tree, pt) match {
case SearchSuccess(inferred, _, _, _) =>
- adapt(inferred, pt)
+ adapt(inferred, pt)(ctx.retractMode(Mode.ImplicitsEnabled))
case failure: SearchFailure =>
if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits]) tree
else err.typeMismatch(tree, pt, failure)