I have at least gotten the topological sort working correctly for the globals_and_class_thru_difficult test. But, it still doesn't do the type inference correctly. For reference, this is the original test case:
var a = new Example{}.value;
var b = a;
var c = 10;
// In order to pass this test, we must be able to have a global depend on a class
// and a class depend on a global.
class Example {
var value = c + d;
}
var d = 15;
fun init() {
print(a, " ", b, " ", c, " ", d); //! 25 25 10 15
}
The test in the misc/ branch now has an : int annotation on var value.
In theory we should be able to inference all the types in this, however. I'm actually not totally sure why the type annotation is needed. Perhaps it's because we don't actually know the type of the global yet?
I have at least gotten the topological sort working correctly for the globals_and_class_thru_difficult test. But, it still doesn't do the type inference correctly. For reference, this is the original test case:
The test in the misc/ branch now has an
: intannotation onvar value.In theory we should be able to inference all the types in this, however. I'm actually not totally sure why the type annotation is needed. Perhaps it's because we don't actually know the type of the global yet?