aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-12-30 20:45:21 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-01-18 16:49:16 +0100
commit06e18c6e7761c458b33af3471f013a4dd3cee3f1 (patch)
tree21e8cf8e21ebdca1cef7252d5cdc83de407ba66b /src/dotty/tools/dotc/core/Denotations.scala
parent3c29bbe7953f31f35dd404577cd04b4de95f74bb (diff)
downloaddotty-06e18c6e7761c458b33af3471f013a4dd3cee3f1.tar.gz
dotty-06e18c6e7761c458b33af3471f013a4dd3cee3f1.tar.bz2
dotty-06e18c6e7761c458b33af3471f013a4dd3cee3f1.zip
Avoid infinite subtyping checks when intersecting denotations
This allows us to run compileStdLib without deep subtypes again.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index fcd60ef16..00ad90354 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -259,11 +259,12 @@ object Denotations {
*
* If there is no preferred accessible denotation, return a JointRefDenotation
* with one of the operand symbols (unspecified which one), and an info which
- * is intersection (&) of the infos of the operand denotations.
+ * is the intersection (using `&` or `safe_&` if `safeIntersection` is true)
+ * of the infos of the operand denotations.
*
* If SingleDenotations with different signatures are joined, return NoDenotation.
*/
- def & (that: Denotation, pre: Type)(implicit ctx: Context): Denotation = {
+ def & (that: Denotation, pre: Type, safeIntersection: Boolean = false)(implicit ctx: Context): Denotation = {
/** Try to merge denot1 and denot2 without adding a new signature. */
def mergeDenot(denot1: Denotation, denot2: SingleDenotation): Denotation = denot1 match {
@@ -317,7 +318,11 @@ object Denotations {
else if (preferSym(sym2, sym1)) sym2
else sym1
val jointInfo =
- try info1 & info2
+ try
+ if (safeIntersection)
+ info1 safe_& info2
+ else
+ info1 & info2
catch {
case ex: MergeError =>
if (pre.widen.classSymbol.is(Scala2x) || ctx.scala2Mode)