diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-12 13:28:06 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-13 02:42:37 -0700 |
commit | 671e6e03c7e096eda0c27262ae8605fa7af76f59 (patch) | |
tree | b415fb7915ec80503605387b6ccd2ab29d9887a2 /src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala | |
parent | 33a819f61b8b9c19708e8ae22bf25adf6cc7ac24 (diff) | |
download | scala-671e6e03c7e096eda0c27262ae8605fa7af76f59.tar.gz scala-671e6e03c7e096eda0c27262ae8605fa7af76f59.tar.bz2 scala-671e6e03c7e096eda0c27262ae8605fa7af76f59.zip |
Corrects behavior of finalResultType.
The implementation had come to depend on finalResultType
accidentally doing things beyond its charter - in particular,
widening types. After hunting down and fixing the call sites
depending on the bugs, I was able to rewrite the method to do
only what it's supposed to do.
I threw in a different way of writing it entirely to suggest how
some correctness might be obtained in the future. It's a lot
harder for a method written like this to break.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 263b5ad784..787c7ebf63 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -413,7 +413,7 @@ trait MethodSynthesis { // starts compiling (instead of failing like it's supposed to) because the typer // expects to be able to identify escaping locals in typedDefDef, and fails to // spot that brand of them. In other words it's an artifact of the implementation. - val tpt = atPos(derivedSym.pos.focus)(derivedSym.tpe.finalResultType match { + val tpt = atPos(derivedSym.pos.focus)(derivedSym.tpe_*.finalResultType.widen match { case ExistentialType(_, _) => TypeTree() case _ if mods.isDeferred => TypeTree() case tp => TypeTree(tp) |