-
Notifications
You must be signed in to change notification settings - Fork 26
need type promotion #31
Comments
fyi, noticed this is leading to some pretty bad SDK codegen ... lots of dynamic invokes that aren't needed |
Yeah, I think this is because we're getting the type off of the Element instead of the AstNode in the checker. We should have the promoted type on the latter as we're using the analyzer's propagation rules. |
aha, yeah, that's a good guess! I was wondering why this one didn't "just work" from their static type rules |
also related: #239 |
hmmm, I haven't been able to reproduce this yet. But I recall seeing busted generated code with too many dinvokes. Going to keep looking. |
ah, found some example brokenness: static _getBestStackTrace(error, stackTrace) {
if (stackTrace != null)
return stackTrace;
if (dart.is(error, core.Error)) {
return dart.as(dart.dload(error, 'stackTrace'), core.StackTrace);
}
return null;
} however, I think it might be by design :\ ... from the Dart spec, 16.34 Type Test:
and (slightly edited by me, for formatting):
|
@vsmenon @leafpetersen and I looked at these. We believe the original bug was fixed (early on, DDC completely disabled type promotion in analyzer), however, there is clearly room for improvement. Tracking that in #274 |
this is a very handy feature in Dart:
The text was updated successfully, but these errors were encountered: