Enable experimental on language imports #19760
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make it easier to use experimental language features out of the box. We already have
-experimental
that enables experimental mode globally by adding the@experimental
annotation to all top-level definitions. The complication was that this flag was necessary to use experimental language features. It was not always easy to set (for example in the REPL) and it is all or nothing. Users can also annotate explicitly all top-level definitions that use language features with@experimental
.Now, the import of an experimental language feature will automatically enable experimental mode. If the import is at the top-level, all definitions in the file are experimental. If the import is local only the top-level definition containing the import will be marked as experimental.
Some experimental features might not need the experimental mode.