-
Notifications
You must be signed in to change notification settings - Fork 29k
[null-safety] enable null assertions for framework tests #64071
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
[null-safety] enable null assertions for framework tests #64071
Conversation
@@ -44,7 +43,6 @@ void main() { | |||
TextSpan(), | |||
], | |||
), | |||
null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this code isn't correct, since TextSpan is not documented as accepting null children
@@ -56,7 +56,7 @@ class RawKeyEventDataWeb extends RawKeyEventData { | |||
final int metaState; | |||
|
|||
@override | |||
String get keyLabel => key; | |||
String? get keyLabel => key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supertype is nullable anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -59,7 +57,6 @@ void main() { | |||
' "b"\n' | |||
' TextSpan:\n' | |||
' (empty)\n' | |||
' <null child>\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the code that generates this string also removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but it does need an ignore on dead code:
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/painting/text_span.dart#L372
' nulls in its child list.\n' | ||
' The full text in question was:\n' | ||
' TextSpan("foo bar")\n' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the point of this test was to check that our null checking gave a pretty error message. What's the error message now? Is it still pretty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends:
- weak-mode, no null assertions - same error message
- weak-mode, null assertions - null assertion error when constructing the TextSpan. Depending on the context that might be easy to read or ugly
- strong-mode, static error can't be hit.
)" This reverts commit acdb909.
…tter#64071)" (flutter#64118) This reverts commit acdb909.
…tter#64071)" (flutter#64118) This reverts commit acdb909.
Description
Run framework tests with --null-assertions enabled. #61042