File tree 1 file changed +15
-4
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -66,22 +66,33 @@ class CheckRealizable(implicit ctx: Context) {
66
66
*/
67
67
private def isLateInitialized (sym : Symbol ) = sym.is(LateInitialized , butNot = Module )
68
68
69
+ def underlyingRealizability (tp : Type ): Realizability =
70
+ realizability(tp).mapError(r => new ProblemInUnderlying (tp, r))
71
+
69
72
/** The realizability status of given type `tp`*/
70
73
def realizability (tp : Type ): Realizability = tp.dealias match {
71
74
case tp : TermRef =>
72
75
val sym = tp.symbol
73
76
if (sym.is(Stable )) realizability(tp.prefix)
74
77
else {
75
78
val r =
76
- if (! sym.isStable) NotStable
77
- else if (! isLateInitialized(sym)) Realizable
78
- else if (! sym.isEffectivelyFinal) new NotFinal (sym)
79
- else realizability(tp.info).mapError(r => new ProblemInUnderlying (tp.info, r))
79
+ if (sym.isStable && ! isLateInitialized(sym))
80
+ // it's realizable because we know that the symbol has been created
81
+ Realizable
82
+ else if (! sym.isEffectivelyFinal)
83
+ // it's potentially not realizable since it might be overridden with a member of nonrealizable type
84
+ new NotFinal (sym)
85
+ else
86
+ // otherwise we need to look at the info to determine realizability
87
+ // roughly: it's realizable if the info does not have bad bounds
88
+ underlyingRealizability(tp.info)
80
89
r andAlso {
81
90
sym.setFlag(Stable )
82
91
realizability(tp.prefix)
83
92
}
84
93
}
94
+ case tp : SkolemType =>
95
+ underlyingRealizability(tp.info)
85
96
case _ : SingletonType | NoPrefix =>
86
97
Realizable
87
98
case tp =>
You can’t perform that action at this time.
0 commit comments