aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala6
-rw-r--r--src/dotty/tools/dotc/core/Types.scala2
-rw-r--r--tests/new/S5.scala31
-rw-r--r--tests/pos/SI-7638.scala (renamed from tests/pending/pos/SI-7638.scala)0
4 files changed, 6 insertions, 33 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 635390ef5..b11e77ef2 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -170,7 +170,11 @@ object Contexts {
if (implicitsCache == null )
implicitsCache = {
val implicitRefs: List[TermRef] =
- if (isClassDefContext) owner.thisType.implicitMembers
+ if (isClassDefContext)
+ try owner.thisType.implicitMembers
+ catch {
+ case ex: CyclicReference => Nil
+ }
else if (isImportContext) importInfo.importedImplicits
else if (isNonEmptyScopeContext) scope.implicitDecls
else Nil
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 141b29ab7..b8e0a48c1 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2976,7 +2976,7 @@ object Types {
val ex = new CyclicReference(denot)
if (!(ctx.mode is typer.Mode.CheckCyclic)) {
cyclicErrors.println(ex.getMessage)
- for (elem <- ex.getStackTrace take 40)
+ for (elem <- ex.getStackTrace take 50)
cyclicErrors.println(elem.toString)
}
ex
diff --git a/tests/new/S5.scala b/tests/new/S5.scala
deleted file mode 100644
index ba87869a1..000000000
--- a/tests/new/S5.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Original comment:
- * Here's a fragment of a Scala encoding for the Keris module system;
-** the compiler claims:
-**
-** S5.scala:28: value n in class N of type N.this._N.n
-** cannot override value n in class M of type M.this._N.n
-** val system = new M() with N() {}
-** ^
-** To me it seems like the code is perfectly fine...
-*/
-abstract class M() {
- val _N: N;
- val n: _N.n;
- val _M: M = this;
- val m: _M.m = new _M.m();
- class m() {
- // module body of M
- }
-}
-trait N {
- val _N: N = this;
- val n: _N.n = new _N.n();
- val _M: M;
- val m: _M.m;
- class n() {
- // module body of N
- }
-}
-object O {
- val system = new M() with N {}
-}
diff --git a/tests/pending/pos/SI-7638.scala b/tests/pos/SI-7638.scala
index ed581efe9..ed581efe9 100644
--- a/tests/pending/pos/SI-7638.scala
+++ b/tests/pos/SI-7638.scala