diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-01 18:26:02 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-01 18:26:02 +0100 |
commit | f920a3186427e9df2fbac97197f2f11331ef4ef3 (patch) | |
tree | 62ab9a95f08650901c91a6ae82361886d67b63a4 /src/dotty/tools/dotc/core/Scopes.scala | |
parent | 1c17a0f83639ddc4b0fd3ffd294a6a97c887aae3 (diff) | |
download | dotty-f920a3186427e9df2fbac97197f2f11331ef4ef3.tar.gz dotty-f920a3186427e9df2fbac97197f2f11331ef4ef3.tar.bz2 dotty-f920a3186427e9df2fbac97197f2f11331ef4ef3.zip |
Changed handling of signatures in TermRefs.
Previously, plain TermRefs had signature NotAMethod. The problem is if the TermRef represents an overloaded term and one of the alternatives is NotAMethod. Then creating the alternative will overwrite (via hash-consing) the overloaded ref.
Solution: Introduc new pseudo-signature "UnknownSignature" which is given to plain TermRefs. Also, need to be careful now that all members that denote a specific alternative of a possibly overloaded denotation are referenced by a TermRefWithSig, not a plain TermRef. Previously, implicit members did not follow that, which meant that, what worked, worked only by accident.
Still to do: Clean up signatures, termref creation methods. Should TermRef.withDenot automatically set the signature?
Diffstat (limited to 'src/dotty/tools/dotc/core/Scopes.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Scopes.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index bd67801e1..46cbee99d 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -292,8 +292,10 @@ object Scopes { var irefs = new ListBuffer[TermRef] var e = lastEntry while (e ne null) { - if (e.sym is Implicit) - irefs += TermRef.withSym(NoPrefix, e.sym.asTerm).withDenot(e.sym.denot) + if (e.sym is Implicit) { + val d = e.sym.denot + irefs += TermRef.withSig(NoPrefix, e.sym.asTerm.name, d.signature).withDenot(e.sym.denot) + } e = e.prev } irefs.toList |