diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-17 18:32:11 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-17 18:32:37 +0100 |
commit | c1c933d6f936a7975ca316c69d7639145eed36e7 (patch) | |
tree | 5ea46185fa361532d0914336c7eda1fddb7c8b5b /src/dotty/tools/dotc/typer/Applications.scala | |
parent | d0b09e431ad6974c7ebc0a7734d46050ec712fa1 (diff) | |
download | dotty-c1c933d6f936a7975ca316c69d7639145eed36e7.tar.gz dotty-c1c933d6f936a7975ca316c69d7639145eed36e7.tar.bz2 dotty-c1c933d6f936a7975ca316c69d7639145eed36e7.zip |
Fixes for by-name arguments
Previously, we did not strip off the => when comparing against expected type.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 857ff31ff..6f65cd231 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -360,7 +360,7 @@ trait Applications extends Compatibility { self: Typer => init() def addArg(arg: Tree, formal: Type): Unit = - typedArgBuf += adaptInterpolated(arg, formal) + typedArgBuf += adaptInterpolated(arg, formal.widenByName) def makeVarArg(n: Int, elemFormal: Type): Unit = { val args = typedArgBuf.takeRight(n).toList @@ -411,7 +411,7 @@ trait Applications extends Compatibility { self: Typer => val result = { var typedArgs = typedArgBuf.toList - val ownType = ctx.traceIndented(i"apply $methRef to $typedArgs%, %", show = true) { + val ownType = if (!success) ErrorType else { if (!sameSeq(args, orderedArgs)) { @@ -426,7 +426,6 @@ trait Applications extends Compatibility { self: Typer => typedArgs = args.asInstanceOf[List[Tree]] methodType.instantiate(typedArgs.tpes) } - } wrapDefs(liftedDefs, cpy.Apply(app, normalizedFun, typedArgs).withType(ownType)) } } @@ -434,7 +433,7 @@ trait Applications extends Compatibility { self: Typer => /** Subclass of Application for type checking an Apply node with untyped arguments. */ class ApplyToUntyped(app: untpd.Apply, fun: Tree, methRef: TermRef, proto: FunProto, resultType: Type)(implicit ctx: Context) extends TypedApply(app, fun, methRef, proto.args, resultType) { - def typedArg(arg: untpd.Tree, formal: Type): TypedArg = proto.typedArg(arg, formal) + def typedArg(arg: untpd.Tree, formal: Type): TypedArg = proto.typedArg(arg, formal.widenByName) def treeToArg(arg: Tree): untpd.Tree = untpd.TypedSplice(arg) } |