You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matt and I looked into this and have a very simple repro case that illustrates the problem. First, the problem is that untyped setters are overwriting type analyses performed for typed getters. In the dart:html code the getters usually appear first lexically and some of the setters have complex types that (historically and perhaps currently) didn't work too well, so they were omitted. The TypeAnalyzer does allows the last writer to win, so the type of a field that was determined by a getter is irrelevant if the class defines a setter after the getter.
Here's Matt's example that uses only core classes:
void main() {
print("hello");
Zebra z = new Zebra();
z.today. /completion/ day. /completion/ toString();
print("done");
}
class Zebra {
void set today(value) {
}
Date get today() {
return new Date.now();
}
}
In this form completion works at the indicated locations, just as expected.
Reversing the order of the getter and setter causes completion to fail because the setter has no type information for its parameter.
Since completion is only interested in the type of the getter, which is the case for most operations other than assignment, it isn't clear why the parameter type of the setter is even being used by type analysis. The spec says a warning should be issued for mis-matched types of getter and setter value but type analysis isn't even generating a warning (and that should probably be done elsewhere, anyway).
import("dart:html");
void main() {
document.body.nodes. ;
}
Type analysis works for document and body; code completion works for both. nodes is getting typed as <dynamic> when it should be NodeList.
Priority is bumped since people are complaining about the lack of code completion.
The text was updated successfully, but these errors were encountered: