I am developing a verifier for the ActionScript 3 language and I have gone through implementing one before for my personal language.
I had a type inference limitation with the following construct:
package {
public class C1 {
public function f.<T>(callbackFn: () => T): void {}
}
}
const o = new C1;
o.f(() => 10); // Error: `o.f` must be argumented
o.f.<Number>(() => 10); // Successful
I was using sort of a bidirectional type checking, where solving an expression was given a context with an "expected type" or none, such as in:
enum E {
const M1;
}
const e: E = "m1"; // Successful
const e: E = "m2"; // Error: "m2" is not a known member
If a type annotation was missing, an expression would be resolved with no expected type and its resolved type determined the type of a binding:
const x = 10;
Most of my expectations were meet, except for the above o.f.<T>()
case, where I wanted to be able to omit the .<T>
list. Is this possible with my previous model or do I have to do something different?