aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/CheckRealizable.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-02 23:50:40 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-09 09:43:08 +0100
commit1511cb49b990e14bd085a26bbcaa77cd827f151b (patch)
tree9ca6052cb4c8c00a2b4f78ee078a35f6170fd51f /src/dotty/tools/dotc/core/CheckRealizable.scala
parentf6a5802b7185525f7e221b745ec283f8ea206161 (diff)
downloaddotty-1511cb49b990e14bd085a26bbcaa77cd827f151b.tar.gz
dotty-1511cb49b990e14bd085a26bbcaa77cd827f151b.tar.bz2
dotty-1511cb49b990e14bd085a26bbcaa77cd827f151b.zip
Fix commpilation error
Diffstat (limited to 'src/dotty/tools/dotc/core/CheckRealizable.scala')
-rw-r--r--src/dotty/tools/dotc/core/CheckRealizable.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/CheckRealizable.scala b/src/dotty/tools/dotc/core/CheckRealizable.scala
index 9c4915ee7..6e6efa549 100644
--- a/src/dotty/tools/dotc/core/CheckRealizable.scala
+++ b/src/dotty/tools/dotc/core/CheckRealizable.scala
@@ -58,12 +58,16 @@ class CheckRealizable(implicit ctx: Context) {
*/
private val checkedFields: mutable.Set[Symbol] = mutable.LinkedHashSet[Symbol]()
+ /** Is symbol's definitition a lazy val?
+ * (note we exclude modules here, because their realizability is ensured separately)
+ */
+ private def isLateInitialized(sym: Symbol) = sym.is(Lazy, butNot = Module)
+
/** Is this type a path with some part that is initialized on use?
- * (note we exclude modules here, because their realizability is ensured separately).
*/
private def isLateInitialized(tp: Type): Boolean = tp.dealias match {
case tp: TermRef =>
- tp.symbol.is(Lazy, butNot = Module) || isLateInitialized(tp.prefix)
+ isLateInitialized(tp.symbol) || isLateInitialized(tp.prefix)
case _: SingletonType | NoPrefix =>
false
case tp: TypeRef =>
@@ -84,7 +88,7 @@ class CheckRealizable(implicit ctx: Context) {
else {
val r =
if (!sym.isStable) NotStable
- else if (!sym.isLateInitialized) realizability(tp.prefix)
+ else if (!isLateInitialized(sym)) realizability(tp.prefix)
else if (!sym.isEffectivelyFinal) new NotFinal(sym)
else realizability(tp.info).mapError(r => new ProblemInUnderlying(tp.info, r))
if (r == Realizable) sym.setFlag(Stable)