-
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
decide and release null-safety related breaking changes #40444
Comments
Static fields are already lazy, and they will only change behavior in cases where they currently throw a cyclic initialization error. It might not be a problematic change. |
Oops, I just reworded it to be more explicit about error semantics which is what I wanted to highlight.
I was more worried about the default value when an error is thrown (that when an initializer throws for any reason, the value becomes null and the initialization is not run again, but now that's not the case). I don't believe this happens much in practice either, but given how local the change is, I'm more ambivalent about making the breaking change upfront. |
Can we track all potentially visible breaking-in-legacy-mode changes in the top comment here? Shipping these before unfork sgtm. E.g., @lrhn @sortie - are you planning to rework / reland? (It appears to have also broken the flutter roll.) https://dart-review.googlesource.com/c/sdk/+/134361 If so, can you update here? Also, how shall we handle this with respect to the breaking change process? ( @franklinyow @mit-mit ) |
While migrating dart:io, I encountered two cases where making slight changes to edge cases in the API considerably improved usability or where it was impractical to preserve the current semantics under NNBD. After talking to the language team, we believed these changes to be low risk, and that it would be prudent to land them prior to the unfork to avoid problems at that time. These are:
I had already relanded the socket option semantics since it didn't cause any breakage and changes undocumented inconsistent behavior. The detached process change is in review for relanding, we need to decide how to proceed with it. It can be relanded once |
I have made breaking change request #40483 about meaningless getters on detached processes. |
Promoted types are nolonger inferred for local variables: #40413 |
|
Implicit casts are not allowed in NNBD, but replacing implicit casts with explicit casts changes the exception which is thrown from |
fyi @davidmorgan - we'd like to backport changes here as much as possible and test/roll internally to sanity check. Any thoughts on process? |
I'm bumping this to P0 as we need to get this rolling quickly. Is the table in the initial comment complete? Can we backport / test all breaking changes in flutter and internally ASAP? |
If you see something missing, please update the table in the initial comment. |
This is flagged by failing tests |
|
I started a new meta-issue for the public communication of the breaking changes related to null safety: #40686 |
I'm closing this since we've decided which one to port and has the record in #40686 |
This is a meta issue to track and decide about several possible breaking changes for the null safety feature.
Background
Our goal is to make opt-out code continue to work as close as possible to how it was. However we have changes in the type system that could be breaking and some breaking changes in the core libraries. We are using this bug to review them all and decide which ones should be included and which ones we should either avoid or hide until users opt-in (if possible).
For those breaking changes that can't be hidden, we want to ship them before we unfork.
Open question: should we have a stable channel push with the breaking changes before we unfork?
Known breaking changes
Language changes
Implementation bugs
API changes
RuneIterator.rawIndex/current
return -1 instead of null when reaching the end of the iterationrunZoned
fromdart:async
may now throw synchronously if the return type is non-nullable andthe code throws.
String.fromEnvironment
/int.fromEnvironment
can no longer returnnull
.DoubleLinkedQueue.firstEntry()
andDoubleLinkedQueue.lastEntry()
used to return null if queue is empty. With NNBD core libraries they throw an error.HashSet.from
) See: #34097 (comment)StreamSubscription.cancel
changed fromFuture
toFuture<void>
this introduced compile-time errors in package async/test/subscription_stream_test. The test was abusing thatonCancel
callbacks inStreamController
have a dynamic return type.dart:io Socket.getRawOption
on some error scenarios throws instead of returning null (similar to behavior on other existing properties)dart:io
properties on detached processes: request [Breaking Change Request] Throw StateError in meaningless getters on detached processes #40483Summary
runZoned
can throw synchronouslyStreamSubscription.cancel()
no longer returns values*.fromEnvironment
may throwQueue.first/lastEntry()
now throwTypeError
may now beCastError
Socket.getRawOption
may thrownull
errors are not replaced withNullThrownError
inCompleter.completeError
,Future.error
andStreamController.addError
The text was updated successfully, but these errors were encountered: