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

Implement null safe numbers in the analyzer #42629

Closed
stereotype441 opened this issue Jul 8, 2020 · 5 comments
Closed

Implement null safe numbers in the analyzer #42629

stereotype441 opened this issue Jul 8, 2020 · 5 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release

Comments

@stereotype441
Copy link
Member

This is the analyzer implementation issue for dart-lang/language#1078. See that issue for details.

@stereotype441 stereotype441 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release labels Jul 8, 2020
@stereotype441
Copy link
Member Author

FYI @scheglov. I've begun prototyping analyzer support for this, so I'm assuming I'll finish out the implementation. But I'm happy to split up the work with you if you'd prefer.

@scheglov
Copy link
Contributor

scheglov commented Jul 8, 2020

SG, if you have time, sure, finish it :-)

@leafpetersen
Copy link
Member

Any updates on this?

@stereotype441
Copy link
Member Author

Not at the moment. This week I am trying to focus on external and abstract fields. I hope to return to this next week.

dart-bot pushed a commit that referenced this issue Aug 13, 2020
The new number promotion rules for null safety
(https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/number-operation-typing.md)
are different enough from the old ones that it makes sense to
implement them separately. As a first step toward that, this CL
separates the existing logic into legacy and null-safe variants.

Bug: #42629
Change-Id: I0d52ce7366e34d5e0d176a0e14f4bc55f5541c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158460
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-bot pushed a commit that referenced this issue Aug 14, 2020
Previously, BinaryExpressionResolutionTest contained a bunch of useful
tests that should pass in both legacy and null-safety modes, but they
were only run in legacy mode (and a very small set of tests were run
in null-safety mode).  This CL moves those tests to a mixin so that
they get run in both modes.

This is necessary because in follow-up CLs I will be changing the type
analysis rules for binary expressions in null safety mode (in
accordance with
https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/number-operation-typing.md),
and I want to make sure not to lose test coverage.

Bug: #42629
Change-Id: I3eac5fd563d7505abe2930835b14867bebec3512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158482
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
dart-bot pushed a commit that referenced this issue Aug 17, 2020
Previously, these tests ran only in legacy mode.  This CL moves the
tests to a mixin so that they can be run in both modes.

This is necessary because in follow-up CLs I will be changing the type
analysis rules for binary expressions in null safety mode (in
accordance with
https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/number-operation-typing.md),
and I want to make sure not to lose test coverage.

Bug: #42629
Change-Id: I44a443205e9b36c698b7c736b75f8701aed7f947
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158600
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-bot pushed a commit that referenced this issue Aug 17, 2020
The new rules for null-safe number promotion apply to both operators
and ordinary method calls, so I'll be implementing them in terms of
MethodElement.name rather than an operator TokenType.  To make this
possible, we need to pass the method element to
TypeSystem.refineBinaryExpressionType.

I'm doing this as a separate CL from the main implementation so that I
can verify that it doesn't introduce backward compatibility issues.

Bug: #42629
Change-Id: I6be9086553ee0ea9994994c903880fe9bb4477fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
dart-bot pushed a commit that referenced this issue Aug 19, 2020
Previously, MethodInvocationResolutionTest contained a bunch of useful
tests that should pass in both legacy and null-safety modes (with some
minor changes to expectations), but they were only run in legacy mode
(and a very small set of tests were run in null-safety mode).  This CL
moves those tests to a mixin so that they get run in both modes.

This is necessary because in follow-up CLs I will be changing the type
analysis rules for method invocations in null safety mode (in
accordance with
https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/number-operation-typing.md),
and I want to make sure not to lose test coverage.

Bug: #42629
Change-Id: I263d8422bc2d110dcc7954c7521bd084b7ea839e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
dart-bot pushed a commit that referenced this issue Aug 24, 2020
…operators.

Future CLs will hook up the static typing rules for method calls
(`clamp` and `remainder`) and will implement the rules for contexts.

Bug: #42629
Change-Id: Iccfb1fa1ac9aff6c0832d65e4835b5b9bd51a804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
dart-bot pushed a commit that referenced this issue Aug 25, 2020
Bug: #42629
Change-Id: I0fc4d5b65d3c9494fc280b5af53d0cc065459be8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
dart-bot pushed a commit that referenced this issue Aug 25, 2020
…ators.

A future CL will hook up the inference rules for method calls (`clamp`
and `remainder`).

Bug: #42629
Change-Id: Iefa36a369ce11726fc316ef46ff7d9bcb0e21da1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-bot pushed a commit that referenced this issue Aug 25, 2020
Bug: #42629
Change-Id: Ie5603b3804af6d740dde361ee8ff2537b0f0d35c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
@stereotype441
Copy link
Member Author

Fixed in 2cb426f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

3 participants