aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-11-10 10:35:54 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-10 10:35:54 +0100
commit83734e1962c11b3e699ece5787caf845cbfa6c0d (patch)
treedfa2fc2d3e7d5547c4d73244df4d60ad06bafda7 /src/dotty/tools/dotc/core/Types.scala
parentf2e3489e419a104ad5f30db68eeaf035a0f3339b (diff)
downloaddotty-83734e1962c11b3e699ece5787caf845cbfa6c0d.tar.gz
dotty-83734e1962c11b3e699ece5787caf845cbfa6c0d.tar.bz2
dotty-83734e1962c11b3e699ece5787caf845cbfa6c0d.zip
Generalize symbolic refs
Previously, there was a switch in SymDenotation#termRef to create a WithFixedSym ref when after erasure. This was done to fix a broken test, but it's clearly incomplete. The scheme is now replaced by one which always creates WithFixedSym Termrefs after erasure.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 5d95fae76..5228c077e 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1183,7 +1183,7 @@ object Types {
// That's why the branch is disabled.
//
// else if (ctx.erasedTypes && lastSymbol != null)
- // denotOfSym(lastSymbol)
+ // denotOfSym(lastSymbol)
else
d.current
}
@@ -1516,7 +1516,7 @@ object Types {
* signature, if denotation is not yet completed.
*/
def apply(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef = {
- if ((prefix eq NoPrefix) || denot.symbol.isFresh)
+ if ((prefix eq NoPrefix) || denot.symbol.isFresh || ctx.erasedTypes)
apply(prefix, denot.symbol.asTerm)
else denot match {
case denot: SymDenotation if denot.isCompleted => withSig(prefix, name, denot.signature)
@@ -1538,7 +1538,7 @@ object Types {
* (2) The name in the term ref need not be the same as the name of the Symbol.
*/
def withSymAndName(prefix: Type, sym: TermSymbol, name: TermName)(implicit ctx: Context): TermRef =
- if ((prefix eq NoPrefix) || sym.isFresh)
+ if ((prefix eq NoPrefix) || sym.isFresh || ctx.erasedTypes)
withFixedSym(prefix, name, sym)
else if (sym.defRunId != NoRunId && sym.isCompleted)
withSig(prefix, name, sym.signature) withSym (sym, sym.signature)
@@ -1549,7 +1549,7 @@ object Types {
* (which must be completed).
*/
def withSig(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRef =
- if ((prefix eq NoPrefix) || sym.isFresh) withFixedSym(prefix, sym.name, sym)
+ if ((prefix eq NoPrefix) || sym.isFresh || ctx.erasedTypes) withFixedSym(prefix, sym.name, sym)
else withSig(prefix, sym.name, sym.signature).withSym(sym, sym.signature)
/** Create a term ref with given prefix, name and signature */
@@ -1558,7 +1558,7 @@ object Types {
/** Create a term ref with given prefix, name, signature, and initial denotation */
def withSigAndDenot(prefix: Type, name: TermName, sig: Signature, denot: Denotation)(implicit ctx: Context): TermRef = {
- if ((prefix eq NoPrefix) || denot.symbol.isFresh)
+ if ((prefix eq NoPrefix) || denot.symbol.isFresh || ctx.erasedTypes)
withFixedSym(prefix, denot.symbol.asTerm.name, denot.symbol.asTerm)
else
withSig(prefix, name, sig)