diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-10-01 15:04:00 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-11-11 15:52:33 -0800 |
commit | a5a62f437f6af1f25ad56e3cf513a4ed13fbc680 (patch) | |
tree | c8aee31f68dd7552417721c9427d3c18605b5361 /src | |
parent | 279e785d0b204b816359d5eeb3e3cbbc6215e0ee (diff) | |
download | scala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.tar.gz scala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.tar.bz2 scala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.zip |
Revert suspicious widening of getter's result type
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index f3632b144d..f655e4e1cb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -395,12 +395,13 @@ 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 = derivedSym.tpe_*.finalResultType.widen match { + val getterTp = derivedSym.tpe_*.finalResultType + val tpt = getterTp.widen match { // Range position errors ensue if we don't duplicate this in some // circumstances (at least: concrete vals with existential types.) - case ExistentialType(_, _) => TypeTree() setOriginal (tree.tpt.duplicate setPos tree.tpt.pos.focus) - case _ if isDeferred => TypeTree() setOriginal tree.tpt // keep type tree of original abstract field - case tp => TypeTree(tp) + case _: ExistentialType => TypeTree() setOriginal (tree.tpt.duplicate setPos tree.tpt.pos.focus) + case _ if isDeferred => TypeTree() setOriginal tree.tpt // keep type tree of original abstract field + case _ => TypeTree(getterTp) } tpt setPos tree.tpt.pos.focus } |