diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-24 18:51:26 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-24 22:32:32 +0200 |
commit | b56a743edf1fe21ff1f9f070d17e4a23930e59bd (patch) | |
tree | 1da465c9bfaabade7017efb2c70078f4c3fc0780 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | bd8ff1720396bb61d0ef5fede8eb956df663faa5 (diff) | |
download | dotty-b56a743edf1fe21ff1f9f070d17e4a23930e59bd.tar.gz dotty-b56a743edf1fe21ff1f9f070d17e4a23930e59bd.tar.bz2 dotty-b56a743edf1fe21ff1f9f070d17e4a23930e59bd.zip |
Special context for self constructor args
Arguments to this(...) calls need a special contet,
similar to - but different from - the supercall context.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index a7c6a85cf..a126db1ad 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -445,7 +445,9 @@ trait Applications extends Compatibility { self: Typer => def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = { def realApply(implicit ctx: Context): Tree = track("realApply") { - var proto = new FunProto(tree.args, IgnoredProto(pt), this) + def argCtx(implicit ctx: Context) = + if (untpd.isSelfConstrCall(tree)) ctx.thisCallArgContext else ctx + var proto = new FunProto(tree.args, IgnoredProto(pt), this)(argCtx) val fun1 = typedExpr(tree.fun, proto) // Warning: The following line is dirty and fragile. We record that auto-tupling was demanded as @@ -461,7 +463,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) + else new ApplyToUntyped(tree, fun1, funRef, proto, pt)(argCtx) val result = app.result ConstFold(result) } { (failedVal, failedState) => |