aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-01-09 09:52:00 +0100
committerMartin Odersky <odersky@gmail.com>2015-01-09 09:52:37 +0100
commit90f2668220645df7b654827c2dfdd1100c878ac2 (patch)
tree8cd20e382467cbceffa7767d65563b76a61cdb39 /src/dotty/tools/dotc/core/Types.scala
parent9f745338242524c6607fa7b2930157b0c71be939 (diff)
downloaddotty-90f2668220645df7b654827c2dfdd1100c878ac2.tar.gz
dotty-90f2668220645df7b654827c2dfdd1100c878ac2.tar.bz2
dotty-90f2668220645df7b654827c2dfdd1100c878ac2.zip
Optimize for case where RefinedThis is absent
Since we cache the information whether a refinement contains RefinedThis occurrences to the refinement itself, we can use this info to avoid substututing RefinedThis types. Used in findMember and hasMatchingMember. The commit uncovered an issue with constraint handling that will be fixed in the next commit.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 920c9c6f8..21997c5fa 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -438,7 +438,9 @@ object Types {
val pdenot = go(tp.parent)
val rinfo = pre match {
case pre: RefinedType => tp.refinedInfo.substThis0(tp, RefinedThis(pre, -1))
- case _ => tp.refinedInfo.substRefinedThis(0, pre)
+ case _ =>
+ if (tp.refinementRefersToThis) tp.refinedInfo.substRefinedThis(0, pre)
+ else tp.refinedInfo
}
if (Types.goRefinedCheck) {
val rinfo0 = tp.refinedInfo.substThis0(tp, pre)