11package scala .runtime .stdLibPatches
22
3+ import scala .annotation .compileTimeOnly
4+
35/** Scala 3 additions and replacements to the `scala.language` object.
46 */
57object language :
@@ -29,18 +31,21 @@ object language:
2931 *
3032 * @see [[https://dotty.epfl.ch/docs/reference/other-new-features/named-typeargs ]]
3133 */
34+ @ compileTimeOnly(" `namedTypeArguments` can only be used at compile time in import statements" )
3235 object namedTypeArguments
3336
3437 /** Experimental support for generic number literals.
3538 *
3639 * @see [[https://dotty.epfl.ch/docs/reference/changed-features/numeric-literals ]]
3740 */
41+ @ compileTimeOnly(" `genericNumberLiterals` can only be used at compile time in import statements" )
3842 object genericNumberLiterals
3943
4044 /** Experimental support for `erased` modifier
4145 *
4246 * @see [[https://dotty.epfl.ch/docs/reference/experimental/erased-defs ]]
4347 */
48+ @ compileTimeOnly(" `erasedDefinitions` can only be used at compile time in import statements" )
4449 object erasedDefinitions
4550
4651 end experimental
@@ -49,13 +54,15 @@ object language:
4954 * Features in this object are slated for removal. New code should not use them and
5055 * old code should migrate away from them.
5156 */
57+ @ compileTimeOnly(" `deprecated` can only be used at compile time in import statements" )
5258 object deprecated :
5359
5460 /** Symbol literals have been deprecated since 2.13. Since Scala 3.0 they
5561 * are no longer an official part of Scala. For compatibility with legacy software,
5662 * symbol literals are still supported with a language import, but new software
5763 * should not use them.
5864 */
65+ @ compileTimeOnly(" `symbolLiterals` can only be used at compile time in import statements" )
5966 object symbolLiterals
6067 end deprecated
6168
@@ -69,6 +76,7 @@ object language:
6976 * '''Why allow it?''' Not allowing auto-tupling is difficult to reconcile with
7077 * operators accepting tuples.
7178 */
79+ @ compileTimeOnly(" `noAutoTupling` can only be used at compile time in import statements" )
7280 object noAutoTupling
7381
7482 /** Where imported, loose equality using eqAny is disabled.
@@ -78,6 +86,7 @@ object language:
7886 *
7987 * @see [[https://dotty.epfl.ch/docs/reference/contextual/multiversal-equality ]]
8088 */
89+ @ compileTimeOnly(" `strictEquality` can only be used at compile time in import statements" )
8190 object strictEquality
8291
8392 /** Where imported, ad hoc extensions of non-open classes in other
@@ -96,29 +105,35 @@ object language:
96105 * such extensions should be limited in scope and clearly documented.
97106 * That's why the language import is required for them.
98107 */
108+ @ compileTimeOnly(" `adhocExtensions` can only be used at compile time in import statements" )
99109 object adhocExtensions
100110
101111 /** Unsafe Nulls fot Explicit Nulls
102112 * Inside the "unsafe" scope, `Null` is considered as a subtype of all reference types.
103113 *
104114 * @see [[http://dotty.epfl.ch/docs/reference/other-new-features/explicit-nulls.html ]]
105115 */
116+ @ compileTimeOnly(" `unsafeNulls` can only be used at compile time in import statements" )
106117 object unsafeNulls
107118
119+ @ compileTimeOnly(" `future` can only be used at compile time in import statements" )
108120 object future
109121
122+ @ compileTimeOnly(" `future-migration` can only be used at compile time in import statements" )
110123 object `future-migration`
111124
112125 /** Set source version to 3.0-migration.
113126 *
114127 * @see [[https://scalacenter.github.io/scala-3-migration-guide/docs/scala-3-migration-mode ]]
115128 */
129+ @ compileTimeOnly(" `3.0-migration` can only be used at compile time in import statements" )
116130 object `3.0-migration`
117131
118132 /** Set source version to 3.0.
119133 *
120134 * @see [[https://scalacenter.github.io/scala-3-migration-guide/docs/scala-3-migration-mode ]]
121135 */
136+ @ compileTimeOnly(" `3.0` can only be used at compile time in import statements" )
122137 object `3.0`
123138
124139/* This can be added when we go to 3.1
0 commit comments