Open mdebbar opened 4 years ago
fyi - @srujzs @rakudrama
Some possibilities:
(1) Change dart:html
to List<dynamic>
to reflect reality.
(2) Change the python code to auto-tag (or cast) getters / methods that return List<T>
where T
is not top.
(3) Handle in the compilers?
(4) Wait for JsAny
- that could be a while.
/cc @natebosch What is stopping us from doing (4)? Everything else is slower, more code, or a worse user experience.
We should do (1) in the short term - it's consistent with other APIs in dart:html
.
(2) Change the python code to auto-tag (or cast) getters / methods that return
List<T>
whereT
is not top.
I think the problem is that this introduced a performance overhead. .cast
is often not the correct choice - List<T>.from
is often better, but we can't make that decision ourselves since it depends on the usage patterns.
What is stopping us from doing (4)?
Time mostly. This is the long term goal but we don't have a concrete semantics proposal and don't know how long it will take to implement consistently between ddc and dart2js.
Talked to @sigmundch about this and related changes for native
s. We'd need to switch to dynamic
wherever we're using native
methods with generics, so I'm going to scope this bug appropriately to addressing wherever those instances are.
We'd need to switch to dynamic wherever we're using native methods with generics,
Just to avoid confusion, we meant a dynamic type variable (basically (1) above) anywhere where we return List<T>
, Map<K, V>
, etc
Repro:
It looks like
PointerEvent.getCoalescedEvents()
is annotated correctly indart:html
, and is supposed to return aList<PointerEvent>
. But in reality, it returns aList<dynamic>
and that throws off the runtime type checker.cc @vsmenon @sigmundch