scala3
scala3 copied to clipboard
Enable experimental on language imports
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.