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

Standardize how previously experimental features are handled #21686

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 1, 2024

If a feature was previously experimental and is now standard, we change any tests for that feature to be only dependent on the source version where the feature was standardized. Language imports in old source versions will no longer enable the feature. (And these language imports also come with a deprecation message).

If a feature was previously experimental and is now dropped, the feature becomes unavailable also in old versions.

The motivation to do it this way is to insist that experimental features are ephemeral. We should not be able to rely on an experimental feature forever in an old version.

This commit implements this policy for fewerBraces and clauseInterleaving. Two implemented extensions (relaxedExtensionImports, betterMatchTypeExtractors) already implemented it before.

If a feature was previously experimental and is now standard, we change
any tests for that feature to be only dependent on the source version where
the feature was standardized. Language imports in old source versions
will no longer enable the feature. (And these language imports
also come with a deprecation message).

If a feature was previously experimental and is now dropped, the feature
becomes unavailable also in old versions.

The motivation to do it this way is to insist that experimental features
are ephemeral. We should not be able to rely on an experimental feature
forever in an old version.

This commit implements this policy for fewerBraces and clauseInterleaving.
Two implemented extensions (relaxedExtensionImports, betterMatchTypeExtractors)
already implemented it before.
@odersky odersky requested a review from hamzaremmal October 4, 2024 08:54
@odersky odersky assigned odersky and hamzaremmal and unassigned hamzaremmal and odersky Oct 4, 2024
@odersky odersky marked this pull request as draft October 5, 2024 11:52
@odersky
Copy link
Contributor Author

odersky commented Oct 5, 2024

This can be merged only when we switch to 3.6.0 as the bootstrap compiler. Since pc tests need NamedTuple and they run in test, we need a non-bootstrapped NamedTuple. But that one uses clause interleaving. So we can't drop clause interleaving in 3.5. It would be much simpler if pc tests ran only in scala3-bootstrapped.

@hamzaremmal
Copy link
Member

hamzaremmal commented Oct 5, 2024

I've opened a PR (#21708) suggesting to drop the non-bootsrapped PC

@hamzaremmal
Copy link
Member

@odersky now that #21708 is merged, we can possibly merge this one

@@ -28,7 +28,6 @@ object Feature:
val dependent = experimental("dependent")
val erasedDefinitions = experimental("erasedDefinitions")
val symbolLiterals = deprecated("symbolLiterals")
val fewerBraces = experimental("fewerBraces")
val saferExceptions = experimental("saferExceptions")
val clauseInterleaving = experimental("clauseInterleaving")
Copy link
Member

Choose a reason for hiding this comment

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

Why not drop this one too ?

Suggested change
val clauseInterleaving = experimental("clauseInterleaving")

Copy link
Member

Choose a reason for hiding this comment

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

We should remove namedTuples in line 36 too.

Copy link
Member

Choose a reason for hiding this comment

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

We can actually drop this test, it's purpose was to check that we require the import when the source is < 3.6

Comment on lines +33 to +34
def enablesNewGivens = isAtLeast(`3.6`)
def enablesNamedTuples = isAtLeast(`3.6`)
Copy link
Member

Choose a reason for hiding this comment

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

I don't see where these two functions are used so far

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should rebase this PR to take into account #21680 and #21668

@hamzaremmal hamzaremmal assigned odersky and unassigned hamzaremmal Nov 5, 2024
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