aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-08 18:10:07 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-14 14:30:08 +0100
commit4900abc7edcd209608cf7539a968cb375bdcb9c1 (patch)
tree1894346d9b1a4f89ad0aefb89ed5aaf6abceda01 /src/dotty/tools/dotc/typer/Applications.scala
parent9b2d9b2f8a9cd3ea0b7c97e78771943aad165a64 (diff)
downloaddotty-4900abc7edcd209608cf7539a968cb375bdcb9c1.tar.gz
dotty-4900abc7edcd209608cf7539a968cb375bdcb9c1.tar.bz2
dotty-4900abc7edcd209608cf7539a968cb375bdcb9c1.zip
Avoid unassigned type errors when typing curried functions.
If a partial application of a function has an error type, make sure the whole tree also has an error type. Before, sometimes the type was missing which led to a partial application error.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 941b35d71..8370b3059 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -541,27 +541,27 @@ trait Applications extends Compatibility { self: Typer =>
// a modified tree but this would be more convoluted and less efficient.
if (proto.isTupled) proto = proto.tupled
- methPart(fun1).tpe match {
- case funRef: TermRef =>
- 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)
- val result = app.result
- convertNewArray(ConstFold(result))
- } { (failedVal, failedState) =>
- val fun2 = tryInsertImplicitOnQualifier(fun1, proto)
- if (fun1 eq fun2) {
- failedState.commit()
- failedVal
- } else typedApply(
- cpy.Apply(tree)(untpd.TypedSplice(fun2), proto.typedArgs map untpd.TypedSplice), pt)
- }
- case _ =>
- fun1.tpe match {
- case ErrorType => tree.withType(ErrorType)
- case tp => handleUnexpectedFunType(tree, fun1)
- }
+ fun1.tpe match {
+ case ErrorType => tree.withType(ErrorType)
+ case _ => methPart(fun1).tpe match {
+ case funRef: TermRef =>
+ 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)
+ val result = app.result
+ convertNewArray(ConstFold(result))
+ } { (failedVal, failedState) =>
+ val fun2 = tryInsertImplicitOnQualifier(fun1, proto)
+ if (fun1 eq fun2) {
+ failedState.commit()
+ failedVal
+ } else typedApply(
+ cpy.Apply(tree)(untpd.TypedSplice(fun2), proto.typedArgs map untpd.TypedSplice), pt)
+ }
+ case _ =>
+ handleUnexpectedFunType(tree, fun1)
+ }
}
}