-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dart2js PPW now fails with Dart 2.8.0-dev.8 #40485
Comments
can you share the full repro steps? This sounds likely from a CFE change. |
|
@sigmundch "long standing bug" hurts my head – the code seems to run fine – and has for a long time. I'm guessing there are corner cases that would break that we're not hitting? So really the bug is in |
Correct. This is the code that shows the issue: void _dispatchEventInternal(
T event, EventDispatcher target, EventPhase eventPhase) {
var subscriptions = _subscriptions;
var isCapturing = eventPhase == EventPhase.CAPTURING_PHASE;
var inputEvent = event is InputEvent ? event : null;
for (var i = 0; i < subscriptions.length; i++) {
var subscription = subscriptions[i];
if (subscription.isCanceled ||
subscription.isPaused ||
subscription.isCapturing != isCapturing) continue;
event._target = target;
event._currentTarget = this.target;
event._eventPhase = eventPhase;
InputEvent.current = inputEvent; // <----- ERROR REPORTED HERE
subscription.eventListener(event);
InputEvent.current = null;
if (event.isImmediatePropagationStopped) return;
}
} @johnniwinther - seems like the fix is to not promote on all cases like this. Could we allow it on variables that are not reassigned (as in the example above)? |
With the better flow analysis (in nnbd) we could auto promote on initialization. It would require more work though. Such a change cannot be easily be done in the pre-nnbd type promotion. Without knowledge of how the variable is used (even knowing that the variable is not reassigned) we need to ascribe an intersection type to the variable which we can only do through promotion: method<T>(T a, T b) {
if (a is String) {
var o = a;
o.length; // We need to know `o` is a `String`.
b = o; // We need to know `o` is a `T`.
}
} In the problem code, the we can type the |
Have we decided the plan here? Is this a bug in I'm guessing (given frequent rolls internally) this is a pretty weird/rare case |
We chatted a bit yesterday about this. We are contemplating whether we can reduce the cases where the breaking change needs to happen (e.g. do it only when a variable is initialized and re-initialized). If so, the stagexl code will continue to work. If not, the necessary change would be to declare the type of inputEvent explicitly as |
Prepare to release v1.4.3 See dart-lang/sdk#40485
Any update here? Either the CFE should be changed or analyzer – at the moment they disagree! |
See #40413 |
#40413 is closed, is this still repro? |
I believe it does. Note that the breaking change is a bug fix. It may not qualify as a breaking change request, but it needs to be announced ahead of the next release (and in the CHANGELOG) |
There was a change in behavior. It should (likely) be announced as a breaking change. |
Closing since the breaking issue #40675 has been closed. |
This has worked for ever. The code in stagexl seems fine. 🤷♂
The text was updated successfully, but these errors were encountered: