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

#3057. Add reachability tests for operators. Part 5. #3105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

I think some tests are duplicates. I also commented on a number of cases where the description is a bit harder to read than it needs to be.

C c = C();
c >>= (i = 42);
} catch (_) {}
i; // Not definitely unassigned
Copy link
Member

Choose a reason for hiding this comment

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

Right, and we can't strengthen this one to use int i; and 'definitely assigned' because the constructor invocation C() could throw (or we could have out of memory).

So that's fine!

Comment on lines 8 to 9
/// @description Checks that if the static type of the expression of the form
/// `E1 >>= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
Copy link
Member

Choose a reason for hiding this comment

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

I think this is similar to a case we had recently:

Suggested change
/// @description Checks that if the static type of the expression of the form
/// `E1 >>= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
/// @description Checks that for an expression of the form `E1 >>= E2`,
/// if the static type of `E1`is not `Never` then `after(N) = after(E2)`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed here and in the other tests.

Comment on lines 8 to 9
/// @description Checks that if the static type of the expression of the form
/// `E1 >>>= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
Copy link
Member

Choose a reason for hiding this comment

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

Similar to TypeSystem/flow-analysis/reachability_A20_t108.dart.

Comment on lines 8 to 9
/// @description Checks that if the static type of the expression of the form
/// `E1 <<= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
Copy link
Member

Choose a reason for hiding this comment

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

Similar to TypeSystem/flow-analysis/reachability_A20_t108.dart.

Comment on lines 8 to 9
/// @description Checks that if the static type of the expression of the form
/// `E1 <<= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
Copy link
Member

Choose a reason for hiding this comment

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

Similar to TypeSystem/flow-analysis/reachability_A20_t108.dart.

/// @assertion - Binary operator: All binary operators other than `==`, `&&`,
/// `||`, and `??` are handled as calls to the appropriate `operator` method.
///
/// @description Checks that for an expression of the form `E1 >>>= E2`
Copy link
Member

Choose a reason for hiding this comment

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

I think a comma would improve on the readability of this sentence:

Suggested change
/// @description Checks that for an expression of the form `E1 >>>= E2`
/// @description Checks that for an expression of the form `E1 >>>= E2`,

Copy link
Member

Choose a reason for hiding this comment

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

I think this occurs in 7 tests in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in all tests.

/// `||`, and `??` are handled as calls to the appropriate `operator` method.
///
/// @description Checks that if the static type of the expression of the form
/// `E1 >>>= E2` is `Never` `after(N) = unreachable(after(E2))`.
Copy link
Member

Choose a reason for hiding this comment

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

Again, the two code snippets right after each other looks funny, but a comma or 'then' could make it flow better:

Suggested change
/// `E1 >>>= E2` is `Never` `after(N) = unreachable(after(E2))`.
/// `E1 >>>= E2` is `Never` then `after(N) = unreachable(after(E2))`.

I think we have about 5 of these in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in all tests.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

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

Seems to be the same test as t119? Should perhaps be |=?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing!!! Fixed.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

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

Same as previous test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Fixed.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

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

Same as previous test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor Author

@sgrekhov sgrekhov left a comment

Choose a reason for hiding this comment

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

Thank you! Fixed. PTAL.

Comment on lines 8 to 9
/// @description Checks that if the static type of the expression of the form
/// `E1 >>= E2` static type of `E1`is not `Never` then `after(N) = after(E2)`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed here and in the other tests.

/// @assertion - Binary operator: All binary operators other than `==`, `&&`,
/// `||`, and `??` are handled as calls to the appropriate `operator` method.
///
/// @description Checks that for an expression of the form `E1 >>>= E2`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in all tests.

/// `||`, and `??` are handled as calls to the appropriate `operator` method.
///
/// @description Checks that if the static type of the expression of the form
/// `E1 >>>= E2` is `Never` `after(N) = unreachable(after(E2))`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in all tests.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing!!! Fixed.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Fixed.

@@ -0,0 +1,25 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@sgrekhov sgrekhov requested a review from eernstg March 11, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants