aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Definitions.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Definitions.scala12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala
index 134b31519..0aeb28d36 100644
--- a/compiler/src/dotty/tools/dotc/core/Definitions.scala
+++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala
@@ -319,7 +319,17 @@ class Definitions {
def staticsMethodRef(name: PreName) = ScalaStaticsModule.requiredMethodRef(name)
def staticsMethod(name: PreName) = ScalaStaticsModule.requiredMethod(name)
- lazy val DottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef")
+ // Dotty deviation: we cannot use a lazy val here because lazy vals in dotty
+ // will return "null" when called recursively, see #1856.
+ def DottyPredefModuleRef = {
+ if (myDottyPredefModuleRef == null) {
+ myDottyPredefModuleRef = ctx.requiredModuleRef("dotty.DottyPredef")
+ assert(myDottyPredefModuleRef != null)
+ }
+ myDottyPredefModuleRef
+ }
+ private[this] var myDottyPredefModuleRef: TermRef = _
+
def DottyPredefModule(implicit ctx: Context) = DottyPredefModuleRef.symbol
def Predef_eqAny(implicit ctx: Context) = DottyPredefModule.requiredMethod(nme.eqAny)