Skip to content

Fix #11774: only enable experimental features for snapshot and nightly #11852

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 12 commits into from
Mar 25, 2021

Conversation

liufengyun
Copy link
Contributor

Fix #11774: only enable experimental features for snapshot and nightly

@nicolasstucki
Copy link
Contributor

@liufengyun rebasing on #11845 should fix the issues of erasedValue.

@liufengyun liufengyun force-pushed the fix-11774 branch 2 times, most recently from d95ae78 to c16fd52 Compare March 23, 2021 12:33

/** Is `feature` enabled by by a command-line setting? The enabling setting is
val experimentalWarningMessage = "Experimental features may only be used with nightly or snapshot version of compiler."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should refine the message by saying that Scala 3 macros are not experimental.

@sjrd
Copy link
Member

sjrd commented Mar 23, 2021

Using a negative flag rather than a positive means that we'll have a lot more work to do to make sure everything works as expected:

  • Add -Yno-experimental in the bootstrap build of the compiler, library, and any other non-test project. Otherwise, we may (and will) miss usage of experimental features that will only pop up at the time of the release, or worse, when trying to re-bootstrap.
  • Adding -Yno-experimental should be the default for almost all tests. Only the tests that use experimental features should not have the flag. Otherwise, again, you may discover that the test suite fails for release builds even though it worked fine before.
  • The (relatively rare) tests that do use experimental features need to be somehow excluded from the CI for release builds.

@liufengyun
Copy link
Contributor Author

@sjrd That makes sense. However, for end-users, asking for both language import and -Yenable-experimental seems to be too much.

@liufengyun liufengyun force-pushed the fix-11774 branch 3 times, most recently from 4b3ed24 to fa3b360 Compare March 23, 2021 15:38
@liufengyun
Copy link
Contributor Author

liufengyun commented Mar 23, 2021

  • It's weird that the compiler version for community build is version (unknown):

https://github.com/lampepfl/dotty/runs/2176107889#step:7:798

Edit: Fixed in 182861b.

@liufengyun liufengyun force-pushed the fix-11774 branch 4 times, most recently from 095bb22 to 8977be4 Compare March 23, 2021 21:03
@smarter
Copy link
Member

smarter commented Mar 23, 2021

/cc @mpilquist: This PR prevents experimental language features from being used with non-nightly compiler builds (following the rust model and to avoid repeating the situation where scala.experimental.macros became de-facto non-experimental), but currently scodec relies on -language:experimental.genericNumberLiterals so it will require a nightly compiler once this PR is merged.

@mpilquist
Copy link
Contributor

Thanks for the heads up. I guess this means scodec should remove the FromDigits.WithRadix instances until that feature is considered non-experimental?

@smarter
Copy link
Member

smarter commented Mar 23, 2021

Right, and I guess these instances could also be provided in a separate project for testing purposes if needed.

@mpilquist
Copy link
Contributor

@smarter I can keep the FromDigits.WithRadix instances in scodec-bits after all, since scala.util.FromDigits will still be in the standard library and the instances themselves don't require this flag. They just don't serve much purpose in that folks can't use them as intended. Right?

It seems a bit strange that the FromDigits type will be in 3.0.0 final but unusable due to being experimental.

@smarter
Copy link
Member

smarter commented Mar 24, 2021

That should work yes, and I agree but we don't have a mechanism to mark APIs themselves as experimental currently (Java has @jdk.internal.javac.PreviewFeature https://openjdk.java.net/jeps/12)

@mpilquist
Copy link
Contributor

OK, I commented out for now. These commits or after should work for community build:

@liufengyun liufengyun added this to the 3.0.0-RC2 milestone Mar 24, 2021
@liufengyun
Copy link
Contributor Author

@mpilquist It seems the upstream and the community build have diverged:

The latest commits in the community build:

We can find a way to sync the upstream and the community build (in another PR).

liufengyun and others added 2 commits March 25, 2021 14:13
Co-authored-by: Nicolas Stucki <nicolas.stucki@gmail.com>
@@ -28,7 +28,19 @@ object Feature:
val symbolLiterals = deprecated("symbolLiterals")
val fewerBraces = experimental("fewerBraces")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@odersky FYI, putting fewerBraces under experimental means that it will only available for nightly build of compilers after this PR. Normal releases cannot use the feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's understood.

@liufengyun liufengyun merged commit ab2664f into scala:master Mar 25, 2021
@liufengyun liufengyun deleted the fix-11774 branch March 25, 2021 19:14
@smarter smarter added the release-notes Should be mentioned in the release notes label Mar 26, 2021
liufengyun added a commit to dotty-staging/dotty that referenced this pull request Mar 27, 2021
liufengyun added a commit to dotty-staging/dotty that referenced this pull request Mar 27, 2021
odersky added a commit that referenced this pull request Mar 27, 2021
Revert #11852: only enable experimental features for snapshot and nightly
@Kordyjan Kordyjan modified the milestones: 3.0.0-RC2, 3.0.0 Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle experimental features in releases
7 participants