summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-10-01 15:04:00 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-11-11 15:52:33 -0800
commita5a62f437f6af1f25ad56e3cf513a4ed13fbc680 (patch)
treec8aee31f68dd7552417721c9427d3c18605b5361 /src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
parent279e785d0b204b816359d5eeb3e3cbbc6215e0ee (diff)
downloadscala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.tar.gz
scala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.tar.bz2
scala-a5a62f437f6af1f25ad56e3cf513a4ed13fbc680.zip
Revert suspicious widening of getter's result type
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala9
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
}