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

Fixes #1361. Private fields promotion tests added #1391

Merged
merged 3 commits into from
Aug 23, 2022

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@stereotype441 stereotype441 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!


void testC() {
if (_x != null) {
super._x.isOdd;
Copy link
Member

Choose a reason for hiding this comment

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

Ooh, nice corner case! My current prototype code doesn't handle it properly. I'll make sure to fix it :)

/// @description Checks that if there are other concrete instance getters with
/// the same name in the same library and they are not a final fields then the
/// field is not promotable. Test the case when there is a getter with the same
/// name in some extension in the same library
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I had not thought about this case. I'm ok with leaving the test as is for now, but I've filed dart-lang/language#2404 to check if anyone on the language team feels strongly that this should behave differently.

@sgrekhov
Copy link
Contributor Author

@eernstg please review

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.

Looks good!


main() {
C(42).testC();
}
Copy link
Member

Choose a reason for hiding this comment

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

Cool!

}

class C {
int? get _x => 43;
Copy link
Member

Choose a reason for hiding this comment

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

For all these conflicts, perhaps test that there is no conflict when the "other" declaration that creates the conflict is static?

Copy link
Member

Choose a reason for hiding this comment

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

Resolving: I think this is covered below already.


void testA() {
if (_x is int) {
_x.isOdd;
Copy link
Member

Choose a reason for hiding this comment

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

This is probably just testing that we get a non-promotable getter when A._x isn't final (so it's probably an essentially-duplicate of an earlier test, and class C makes no difference ... but it isn't wrong).


library promotion_A05_t10;

part "promotion_A05_t10.lib.dart";
Copy link
Member

Choose a reason for hiding this comment

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

Good catch, thanks!

@eernstg eernstg merged commit d230f5c into dart-lang:master Aug 23, 2022
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Sep 12, 2022
2022-09-02 sgrekhov22@gmail.com dart-lang/co19#1399. on clause tests added (dart-lang/co19#1416)
2022-09-02 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Type annotations and record expressions tests updated (dart-lang/co19#1415)
2022-09-01 sgrekhov22@gmail.com Fixes dart-lang/co19#1398. Fix tests that use unreachable code after `Never` (dart-lang/co19#1402)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Typos in subtyping tests description fixed (dart-lang/co19#1414)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Subtyping tests for records added (dart-lang/co19#1412)
2022-08-31 asashour@yahoo.com Fix typo (dart-lang/co19#1413)
2022-08-30 sgrekhov22@gmail.com dart-lang/co19#1405. BytesBuilder tests moved from dart:io to dart:typed_data (dart-lang/co19#1410)
2022-08-30 sgrekhov22@gmail.com dart-lang/co19#1399. Tests for record types. Part 1 (dart-lang/co19#1395)
2022-08-24 sgrekhov22@gmail.com dart-lang/co19#1405. Don't use deprecated API in co19 tests. Update generated files (dart-lang/co19#1407)
2022-08-24 sgrekhov22@gmail.com dart-lang/co19#1405. Don't use deprecated API in co19 tests (dart-lang/co19#1406)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1361. Private fields promotion tests added (dart-lang/co19#1391)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1394. Add missing compile-error (dart-lang/co19#1396)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1403. Added test that `super` cannot be used as an expression (dart-lang/co19#1404)
2022-08-15 sgrekhov22@gmail.com dart-lang/co19#1388. FFI tests fixed for 32-bit systems (dart-lang/co19#1392)
2022-08-11 sgrekhov22@gmail.com dart-lang/co19#1388. FFI test failures fixed (dart-lang/co19#1389)

Change-Id: I2eee6c193eed1ce8a511f3ef5667ded947fbfad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257700
Reviewed-by: Alexander Thomas <athom@google.com>
@sgrekhov sgrekhov deleted the co19-1361 branch September 29, 2022 09:48
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.

None yet

3 participants