Closed
Description
Currently in the analyzer we do inference in two phases - first we resolve the initializer presuming all not yet inferred types of fields are dynamic
. Then we get dependencies as elements referenced by the initializer, and infer in the topological order.
Type inference in the following code in the analyzer is done incorrectly.
class A {
static final a = A.b.c;
static final b = A();
final c = a;
}
When we resolve the initializer of a
, we see that it references b
, but its type is presumed to be dynamic
, so we don't know that it also references c
. So, we miss the cycle a -> c -> a
.
We should do something like CFE does, and perform recursive inference.