aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-03-07 16:51:18 +0100
committerodersky <odersky@gmail.com>2016-03-07 16:51:18 +0100
commit742ae7552cc0ebea700ddcb5892a673a1eaca967 (patch)
tree1b000e981bc335af6d52164f0c0a66dd987c6128 /src
parente5c59486ba56993b784f36aa5ae05ecfb2ceb4d4 (diff)
parent42f87c2cd4f704fcb5ea769a4dbc85c2d183ac12 (diff)
downloaddotty-742ae7552cc0ebea700ddcb5892a673a1eaca967.tar.gz
dotty-742ae7552cc0ebea700ddcb5892a673a1eaca967.tar.bz2
dotty-742ae7552cc0ebea700ddcb5892a673a1eaca967.zip
Merge pull request #1142 from dotty-staging/fix/implicit-ctx
Do the implicit search shadowing check in the correct context
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala4
-rw-r--r--src/dotty/tools/dotc/typer/ProtoTypes.scala6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index e3dd113c2..5b336c2e9 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -491,8 +491,8 @@ trait Implicits { self: Typer =>
pt)
val generated1 = adapt(generated, pt)
lazy val shadowing =
- typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)
- (nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
+ typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)(
+ nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
def refMatches(shadowing: Tree): Boolean =
ref.symbol == closureBody(shadowing).symbol || {
shadowing match {
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala
index 7997d1cf4..97b47b2bd 100644
--- a/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -320,10 +320,8 @@ object ProtoTypes {
*/
def constrained(pt: PolyType, owningTree: untpd.Tree)(implicit ctx: Context): (PolyType, List[TypeVar]) = {
val state = ctx.typerState
- def howmany = if (owningTree.isEmpty) "no" else "some"
- def committable = if (ctx.typerState.isCommittable) "committable" else "uncommittable"
- assert(owningTree.isEmpty != ctx.typerState.isCommittable,
- s"inconsistent: $howmany typevars were added to $committable constraint ${state.constraint}")
+ assert(!(ctx.typerState.isCommittable && owningTree.isEmpty),
+ s"inconsistent: no typevars were added to committable constraint ${state.constraint}")
def newTypeVars(pt: PolyType): List[TypeVar] =
for (n <- (0 until pt.paramNames.length).toList)