diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-18 19:29:02 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-12-20 18:33:44 +0100 |
commit | 7c5e36b80e111d17910dbf122c02a458377656d1 (patch) | |
tree | 210ba0cde3e81925aab1af83ab1353c6606a1331 /compiler/src/dotty/tools/dotc/typer/Applications.scala | |
parent | 9c0df5aa3af3906913f6507e04078c32dd2a4742 (diff) | |
download | dotty-7c5e36b80e111d17910dbf122c02a458377656d1.tar.gz dotty-7c5e36b80e111d17910dbf122c02a458377656d1.tar.bz2 dotty-7c5e36b80e111d17910dbf122c02a458377656d1.zip |
More lenient handling of mixed parameterless and nullary methods
When faced with a denotation that combines parameterless and nullary method
definitions (toString is a common example), ignore any redundant () applications.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Applications.scala | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 8a18e63c0..42c24ffb7 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -657,18 +657,20 @@ trait Applications extends Compatibility { self: Typer with Dynamic => case err: ErrorType => untpd.cpy.Apply(tree)(fun1, tree.args).withType(err) case TryDynamicCallType => typedDynamicApply(tree, pt) case _ => - tryEither { - implicit ctx => simpleApply(fun1, proto) - } { - (failedVal, failedState) => - def fail = { failedState.commit(); failedVal } - // Try once with original prototype and once (if different) with tupled one. - // The reason we need to try both is that the decision whether to use tupled - // or not was already taken but might have to be revised when an implicit - // is inserted on the qualifier. - tryWithImplicitOnQualifier(fun1, originalProto).getOrElse( - if (proto eq originalProto) fail - else tryWithImplicitOnQualifier(fun1, proto).getOrElse(fail)) + if (originalProto.isDropped) fun1 + else + tryEither { + implicit ctx => simpleApply(fun1, proto) + } { + (failedVal, failedState) => + def fail = { failedState.commit(); failedVal } + // Try once with original prototype and once (if different) with tupled one. + // The reason we need to try both is that the decision whether to use tupled + // or not was already taken but might have to be revised when an implicit + // is inserted on the qualifier. + tryWithImplicitOnQualifier(fun1, originalProto).getOrElse( + if (proto eq originalProto) fail + else tryWithImplicitOnQualifier(fun1, proto).getOrElse(fail)) } } } |