Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

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
Contributor

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
@natebosch natebosch requested a review from jakemac53 August 28, 2020 22:59
@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
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Google CLA signed
Development

Successfully merging this pull request may close these issues.

3 participants