Skip to content

[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

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Aug 18, 2020

Description

Run framework tests with --null-assertions enabled. #61042

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Aug 18, 2020
@@ -44,7 +43,6 @@ void main() {
TextSpan(),
],
),
null,
Copy link
Contributor Author

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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supertype is nullable anyway

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@@ -59,7 +57,6 @@ void main() {
' "b"\n'
' TextSpan:\n'
' (empty)\n'
' <null child>\n'
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

' nulls in its child list.\n'
' The full text in question was:\n'
' TextSpan("foo bar")\n'
);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends:

  1. weak-mode, no null assertions - same error message
  2. weak-mode, null assertions - null assertion error when constructing the TextSpan. Depending on the context that might be easy to read or ugly
  3. strong-mode, static error can't be hit.

@fluttergithubbot fluttergithubbot merged commit acdb909 into flutter:master Aug 19, 2020
jmagman added a commit that referenced this pull request Aug 19, 2020
jmagman added a commit that referenced this pull request Aug 19, 2020
smadey pushed a commit to smadey/flutter that referenced this pull request Aug 27, 2020
smadey pushed a commit to smadey/flutter that referenced this pull request Aug 27, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants