Skip to content

Standardize how previously experimental features are handled #21686

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

Merged
merged 3 commits into from
Feb 19, 2025

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.

@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
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 force-pushed the change-clause-interleaving branch from 99ff991 to a03a2fc Compare February 18, 2025 15:42
@odersky odersky marked this pull request as ready for review February 18, 2025 15:42
@odersky odersky assigned hamzaremmal and unassigned odersky Feb 18, 2025
@hamzaremmal hamzaremmal merged commit 0dac4c3 into scala:main Feb 19, 2025
29 checks passed
@hamzaremmal hamzaremmal deleted the change-clause-interleaving branch February 19, 2025 09:29
hamzaremmal added a commit that referenced this pull request Mar 10, 2025
We will not align this feature with what was done in #21686 and as
indicated in the deprecation message of
`scala.language.experimental.betternMatchTypeExtractors`
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 2025
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.

3 participants