Skip to content
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

Fix cast of nullable argument #112

Merged
merged 1 commit into from
Aug 29, 2020
Merged

Fix cast of nullable argument #112

merged 1 commit into from
Aug 29, 2020

Conversation

natebosch
Copy link
Member

The as num cast existed before the migration, but in the wrong place
so the overall expression was still dynamic. Implicit casts from
dynamic are still allowed, so it wasn't flagged that the cast was in
the wrong place - disabling implicit casts from dynamic makes it more
obvious that there is a problem, but doesn't fix the entire issue.

In addition to the cast being in the wrong place, it also was to the
wrong type. Casting to num instead of num? does not surface any
warnings because it's valid to pass the num to an argument wanting
num?.

This was not surfaced originally due to a bug in the VM which causes the
opt-in state of a package in the experiment allow list to not control
the soundness when executing. Add explicit opt in test runs for now.
dart-lang/sdk#43243

The `as num` cast existed before the migration, but in the wrong place
so the overall expression was still `dynamic`. Implicit casts from
`dynamic` are still allowed, so it wasn't flagged that the cast was in
the wrong place - disabling implicit casts from dynamic makes it more
obvious that there is a problem, but doesn't fix the entire issue.

In addition to the cast being in the wrong place, it also was to the
wrong type. Casting to `num` instead of `num?` does not surface any
warnings because it's valid to pass the `num` to an argument wanting
`num?`.

This was not surfaced originally due to a bug in the VM which causes the
opt-in state of a package in the experiment allow list to _not_ control
the soundness when executing. Add explicit opt in test runs for now.
dart-lang/sdk#43243
@googlebot googlebot added the cla: yes Google CLA signed label Aug 28, 2020
@natebosch natebosch merged commit cb3f940 into master Aug 29, 2020
@natebosch natebosch deleted the null-font-size branch August 29, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants