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

#1959. Versioning tests added #2029

Merged
merged 10 commits into from
Apr 28, 2023
Merged

#1959. Versioning tests added #2029

merged 10 commits into from
Apr 28, 2023

Conversation

sgrekhov
Copy link
Contributor

Please note that versioning_A03_t* and versioning_A04_t* are failing on the edge SDK

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.

Some of these tests are obvious. For example, errors expected in LanguageFeatures/Class-modifiers/versioning_A04_t02.dart must be errors, because we can't mix in a non-mixin in new code.

However, several other libraries are quite tricky. For example, LanguageFeatures/Class-modifiers/versioning_A04_t01.dart, where PreFeatureImplementsInterface seems to be a perfectly OK class, in legacy code as well as new code, and hence we shouldn't expect any errors from its subtypes. PreFeatureWithInterface is really tricky, as explained in a comment in this library.

So please take a look, fix the cases that are clear, and complain about the vagueness of the rest as needed. ;-)

LanguageFeatures/Class-modifiers/versioning_A02_t01.dart Outdated Show resolved Hide resolved
LanguageFeatures/Class-modifiers/versioning_A02_t02.dart Outdated Show resolved Hide resolved
LanguageFeatures/Class-modifiers/versioning_A02_t03.dart Outdated Show resolved Hide resolved
LanguageFeatures/Class-modifiers/versioning_A02_t04.dart Outdated Show resolved Hide resolved
LanguageFeatures/Class-modifiers/versioning_A02_t05.dart Outdated Show resolved Hide resolved
LanguageFeatures/Class-modifiers/versioning_A04_t01.dart Outdated Show resolved Hide resolved
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.

Seems that dart-lang/language#3019 answered all the questions, so I updated the tests accordingly. Please review

@sgrekhov sgrekhov requested a review from eernstg April 26, 2023 11:25
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 we need to change three mixin cases in LanguageFeatures/Class-modifiers/versioning_A03_t02.dart to non-errors.

dynamic noSuchMethod(Invocation i) {}
}

base mixin BaseMixinOnPreFeatureExtendsFinal on PreFeatureExtendsFinal {
Copy link
Member

Choose a reason for hiding this comment

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

These three cases are tricky, too.

We do have a rule that the on type of a mixin cannot be a final class of a different library, dart-lang/language#2933, but I can't find that in the feature spec.

We have a similar rule for a sealed class in a different library (here).

But none of those rules are applicable here, so I'd expect this one plus the next two to be non-errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved these cases to a separate test which is not expecting any errors

Copy link
Member

Choose a reason for hiding this comment

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

As far as I can see we still have MixinOnPreFeatureExtendsFinal, MixinOnPreFeatureImplementsFinal, MixinOnPreFeatureWithFinal in LanguageFeatures/Class-modifiers/versioning_A03_t02.dart. Did you move some other declarations?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I'm sorry, it's my mistake!

It is true that PreFeature...Final are all allowed to exist, and the on type of a post-feature mixin is allowed to be any of those PreFeature...Final classes.

But I forgot that the platform class is final and the mixin isn't "base, final, or sealed" (which means base because a mixin can't be the other two). (I also misremembered the situation and thought that there were just 3 declarations, so nothing had been moved. But there were 6 and 3 of them had been moved.)

The transitive check kicks in, and it doesn't care that we're going through a legacy library, we just note that there is a final (indirect) superinterface, and the mixin isn't base. So we should expect the "missing base" error after all.

That doesn't actually fit the @description in LanguageFeatures/Class-modifiers/versioning_A03_t02.dart, but there should be some test about missing base... where they'd fit (or they can just be in a new test if it's hard to find a good one).

Sorry again! 😸

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, I too missed that on relation is like an implements and restrictions for it are transitive. Moved these tests to a separate test with appropriate description.

@sgrekhov sgrekhov requested a review from eernstg April 27, 2023 08:19
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 we still have a wrong expectation that mixin M on NastyLegacy ... should be an error.

@sgrekhov
Copy link
Contributor Author

Only base mixin were moved. My mistake. Now mixin also moved to LanguageFeatures/Class-modifiers/versioning_A03_t03.dart. Thank you. Please rereview

@sgrekhov sgrekhov requested a review from eernstg April 28, 2023 12:57
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.

Great, LGTM!

@eernstg eernstg merged commit 80f4d80 into dart-lang:master Apr 28, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request May 4, 2023
2023-05-04 [email protected] Fixes dart-lang/co19#2034. Fix roll failures, add issues numbers (dart-lang/co19#2035)
2023-05-03 [email protected] dart-lang/co19#1401. Async for-in tests for patterns (dart-lang/co19#2032)
2023-04-28 [email protected] dart-lang/co19#1959. Grammar tests added (dart-lang/co19#2031)
2023-04-28 [email protected] dart-lang/co19#1959. Versioning tests added (dart-lang/co19#2029)

Change-Id: Ic29913ebd7260c4069e6baa27a797219ce12d956
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301440
Reviewed-by: Alexander Thomas <[email protected]>
@sgrekhov sgrekhov deleted the co19-1959-6 branch July 18, 2023 11:31
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