From 9c38a61d4b3319999a43265ea17f85a1b3ca6886 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 5 Feb 2016 16:53:12 +0100 Subject: Make LazyRef#ref a def instead of a lazy val It's slightly more efficient. There was no need to have a separate cache for the lazy val. --- src/dotty/tools/dotc/core/Types.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index e266bab6f..d76f57ba6 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1972,7 +1972,7 @@ object Types { case class LazyRef(refFn: () => Type) extends UncachedProxyType with ValueType { private var myRef: Type = null private var computed = false - lazy val ref = { + def ref = { if (computed) assert(myRef != null) else { computed = true @@ -1980,6 +1980,7 @@ object Types { } myRef } + def evaluating = computed && myRef == null override def underlying(implicit ctx: Context) = ref override def toString = s"LazyRef($ref)" override def equals(other: Any) = other match { -- cgit v1.2.3