Skip to content

Conversation

nicolasstucki
Copy link
Contributor

We add -YnoExperimental to simulate a releases version of the compile. Then fix the issue by allowing experimental code with -experimental.

Example failures with `-Yno-experimental` (or in stable version)
-- Error: library/src/scala/annotation/MacroAnnotation.scala:47:28 -------------
47 |   *  class memoize extends MacroAnnotation:
   |                            ^
   |       Experimental definition may only be used under experimental mode:
   |         1. in a definition marked as @experimental, or
   |         2. compiling with the -experimental compiler flag, or
   |         3. with a nightly or snapshot version of the compiler.
   |
   |       trait MacroAnnotation is marked @experimental
   |                 
-- Error: library/src/scala/annotation/MacroAnnotation.scala:54:41 -------------
54 |   *              val cacheName = Symbol.freshName(name + "Cache")
   |                                         ^
   |       Experimental definition may only be used under experimental mode:
   |         1. in a definition marked as @experimental, or
   |         2. compiling with the -experimental compiler flag, or
   |         3. with a nightly or snapshot version of the compiler.
   |
   |       method freshName is marked @experimental
   |                 
-- Error: library/src/scala/quoted/Quotes.scala:3772:42 ------------------------
3772 |       *  val moduleName: String = Symbol.freshName("MyModule")
     |                                          ^
     |   Experimental definition may only be used under experimental mode:
     |     1. in a definition marked as @experimental, or
     |     2. compiling with the -experimental compiler flag, or
     |     3. with a nightly or snapshot version of the compiler.
     |
     |   method freshName is marked @experimental
     |             
-- Error: library/src/scala/quoted/Quotes.scala:3777:27 ------------------------
3777 |       *  val mod = Symbol.newModule(Symbol.spliceOwner, moduleName, Flags.EmptyFlags, Flags.EmptyFlags, parents.map(_.tpe), decls, Symbol.noSymbol)
     |                           ^
     |   Experimental definition may only be used under experimental mode:
     |     1. in a definition marked as @experimental, or
     |     2. compiling with the -experimental compiler flag, or
     |     3. with a nightly or snapshot version of the compiler.
     |
     |   method newModule is marked @experimental
     |             
-- Error: library/src/scala/quoted/Quotes.scala:3782:32 ------------------------
3782 |       *  val modDef = ClassDef.module(mod, parents, body = List(runDef))
     |                                ^
     |   Experimental definition may only be used under experimental mode:
     |     1. in a definition marked as @experimental, or
     |     2. compiling with the -experimental compiler flag, or
     |     3. with a nightly or snapshot version of the compiler.
     |
     |   method module is marked @experimental

…eases

We add `-YnoExperimental` to simulate a releases version of the compile.
Then fix the issue by allowing experimental code with `-experimental`.
@nicolasstucki nicolasstucki force-pushed the allow-snippets-to-refer-to-experimental-definitions branch from 6b7f11a to 49942d8 Compare March 6, 2024 10:54
@nicolasstucki nicolasstucki merged commit 46b7bf5 into scala:main Mar 11, 2024
@nicolasstucki nicolasstucki deleted the allow-snippets-to-refer-to-experimental-definitions branch March 11, 2024 08:26
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 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.

3 participants