diff options
author | Martin Odersky <odersky@gmail.com> | 2016-06-30 11:12:33 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:07 +0200 |
commit | b6a8bc77fe3af4f6f722fdbaed8a0f7c8c6774ac (patch) | |
tree | 9a5e8fd49aae145e7b74b58692319064f71be0a3 | |
parent | 30e15aba1226c940493c9fecd68467d7823f2c3d (diff) | |
download | dotty-b6a8bc77fe3af4f6f722fdbaed8a0f7c8c6774ac.tar.gz dotty-b6a8bc77fe3af4f6f722fdbaed8a0f7c8c6774ac.tar.bz2 dotty-b6a8bc77fe3af4f6f722fdbaed8a0f7c8c6774ac.zip |
Revert complications in asMemberOf
We needed fairly specific code to make the refinement based
hk encoding work without cyclic references. With the new
encoding these complications are no longer needed.
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 5 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 24 |
2 files changed, 4 insertions, 25 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 54884a24c..dbde4d6f2 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -92,11 +92,6 @@ trait SymDenotations { this: Context => explain("denotation is not a SymDenotation") } } - - /** An anonymous type denotation with an info `>: Nothing <: Any`. Used to - * avoid stackoverflows when computing members of TypeRefs - */ - lazy val anyTypeDenot = new JointRefDenotation(NoSymbol, TypeBounds.empty, Period.allInRun(ctx.runId)) } object SymDenotations { diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index a2b52d338..6f08971ec 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1594,26 +1594,10 @@ object Types { } } - protected def asMemberOf(prefix: Type)(implicit ctx: Context): Denotation = { - // we might now get cycles over members that are in a refinement but that lack - // a symbol. Without the following precaution i974.scala stackoverflows when compiled - // with new hk scheme. - // TODO: Do we still need the complications here? - val savedDenot = lastDenotation - val savedSymbol = lastSymbol - if (prefix.isInstanceOf[RecThis] && name.isTypeName) { - lastDenotation = ctx.anyTypeDenot - lastSymbol = NoSymbol - } - try - if (name.isShadowedName) prefix.nonPrivateMember(name.revertShadowed) - else prefix.member(name) - finally - if (lastDenotation eq ctx.anyTypeDenot) { - lastDenotation = savedDenot - lastSymbol = savedSymbol - } - } + protected def asMemberOf(prefix: Type)(implicit ctx: Context): Denotation = + if (name.isShadowedName) prefix.nonPrivateMember(name.revertShadowed) + else prefix.member(name) + /** (1) Reduce a type-ref `W # X` or `W { ... } # U`, where `W` is a wildcard type * to an (unbounded) wildcard type. |