aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-07 17:49:15 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-07 17:51:55 +0200
commit422b06126d3809f4db11dba0988cd21857e1f9de (patch)
treecaf644d0c3a7e57fffb331ae34a6548fcdf0fe97 /src/dotty/tools/dotc/typer/Applications.scala
parent4ca4fa1b507995e9e554aff3b0c141cf89709dd5 (diff)
downloaddotty-422b06126d3809f4db11dba0988cd21857e1f9de.tar.gz
dotty-422b06126d3809f4db11dba0988cd21857e1f9de.tar.bz2
dotty-422b06126d3809f4db11dba0988cd21857e1f9de.zip
Search implicit arguments in the same context as typing explicit ones
For explicit arguments of this(...) constrictor calls we have a special context that hides members of the current class. But for implicit arguments we did not. This led to implicit shadowing errors for scala.collection.immutable.PagedSeq when secondary constructor type parameters were fixed (as done in subsequent commits).
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index f3903e539..ec2508580 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -531,12 +531,16 @@ trait Applications extends Compatibility { self: Typer =>
def treeToArg(arg: Tree): Tree = arg
}
+ /** If `app` is a `this(...)` constructor call, the this-call argument context,
+ * otherwise the current context.
+ */
+ def argCtx(app: untpd.Tree)(implicit ctx: Context): Context =
+ if (untpd.isSelfConstrCall(app)) ctx.thisCallArgContext else ctx
+
def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = {
def realApply(implicit ctx: Context): Tree = track("realApply") {
- def argCtx(implicit ctx: Context) =
- if (untpd.isSelfConstrCall(tree)) ctx.thisCallArgContext else ctx
- var proto = new FunProto(tree.args, IgnoredProto(pt), this)(argCtx)
+ var proto = new FunProto(tree.args, IgnoredProto(pt), this)(argCtx(tree))
val fun1 = typedExpr(tree.fun, proto)
// Warning: The following line is dirty and fragile. We record that auto-tupling was demanded as
@@ -554,7 +558,7 @@ trait Applications extends Compatibility { self: Typer =>
tryEither { implicit ctx =>
val app =
if (proto.argsAreTyped) new ApplyToTyped(tree, fun1, funRef, proto.typedArgs, pt)
- else new ApplyToUntyped(tree, fun1, funRef, proto, pt)(argCtx)
+ else new ApplyToUntyped(tree, fun1, funRef, proto, pt)(argCtx(tree))
val result = app.result
convertNewArray(ConstFold(result))
} { (failedVal, failedState) =>