Skip to content

Clarify boolean conditional evaluation #917

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 2 commits into from
Apr 7, 2020
Merged

Conversation

leafpetersen
Copy link
Member

Clarify the behavior of boolean conditional expressions in strong and weak mode.

cc @nshahan @sigmundch @rakudrama @alexmarkov @lrhn @eernstg @munificent

Copy link

@alexmarkov alexmarkov left a comment

Choose a reason for hiding this comment

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

LGTM w/nit.

and hence must be implicitly downcast to `bool`, after which no further check is
required.

In mixed mode (weak mode evaluation) Dart, values of type `Never` and `bool` may

Choose a reason for hiding this comment

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

In mixed mode (weak mode evaluation) Dart

It doesn't matter if it is mixed or not. Maybe simply 'In weak checking mode...'

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link

@nshahan nshahan left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification.

@leafpetersen
Copy link
Member Author

Landing this. I'm working on tests to accompany, I will file issues for any failures.

@leafpetersen leafpetersen merged commit 8299f41 into master Apr 7, 2020
@leafpetersen leafpetersen deleted the boolean_conversion branch April 7, 2020 21:41
@leafpetersen
Copy link
Member Author

Tests out for review here: https://dart-review.googlesource.com/c/sdk/+/142782

dart-bot pushed a commit to dart-lang/sdk that referenced this pull request Apr 10, 2020
Tests for the null safety spec clarification landed in
dart-lang/language#917 .

Change-Id: Ieafe5315c31919c01ff816a26d29fa0d1cbc8c9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142782
Reviewed-by: Erik Ernst <[email protected]>
dart-bot pushed a commit to dart-lang/sdk that referenced this pull request Apr 15, 2020
Partially reverts
https://dart-review.googlesource.com/c/sdk/+/139402
but continues to throw a TypeError when running in strong mode. The
breaking change to boolean conversions was not back-ported so we
are still going to throw an AssertionError in weak mode.

Updated Spec: dart-lang/language#917

Fixes: #41278

Change-Id: Ib50e9ab367f4a0c0f9f10c3e0fa4ec890ff9c2ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143007
Reviewed-by: Sigmund Cherem <[email protected]>
Reviewed-by: Mark Zhou <[email protected]>
Commit-Queue: Nicholas Shahan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants