1
1
package scala .runtime .stdLibPatches
2
2
3
+ import scala .annotation .compileTimeOnly
4
+
3
5
/** Scala 3 additions and replacements to the `scala.language` object.
4
6
*/
5
7
object language :
@@ -29,18 +31,21 @@ object language:
29
31
*
30
32
* @see [[https://dotty.epfl.ch/docs/reference/other-new-features/named-typeargs ]]
31
33
*/
34
+ @ compileTimeOnly(" `namedTypeArguments` can only be used at compile time in import statements" )
32
35
object namedTypeArguments
33
36
34
37
/** Experimental support for generic number literals.
35
38
*
36
39
* @see [[https://dotty.epfl.ch/docs/reference/changed-features/numeric-literals ]]
37
40
*/
41
+ @ compileTimeOnly(" `genericNumberLiterals` can only be used at compile time in import statements" )
38
42
object genericNumberLiterals
39
43
40
44
/** Experimental support for `erased` modifier
41
45
*
42
46
* @see [[https://dotty.epfl.ch/docs/reference/experimental/erased-defs ]]
43
47
*/
48
+ @ compileTimeOnly(" `erasedDefinitions` can only be used at compile time in import statements" )
44
49
object erasedDefinitions
45
50
46
51
end experimental
@@ -49,13 +54,15 @@ object language:
49
54
* Features in this object are slated for removal. New code should not use them and
50
55
* old code should migrate away from them.
51
56
*/
57
+ @ compileTimeOnly(" `deprecated` can only be used at compile time in import statements" )
52
58
object deprecated :
53
59
54
60
/** Symbol literals have been deprecated since 2.13. Since Scala 3.0 they
55
61
* are no longer an official part of Scala. For compatibility with legacy software,
56
62
* symbol literals are still supported with a language import, but new software
57
63
* should not use them.
58
64
*/
65
+ @ compileTimeOnly(" `symbolLiterals` can only be used at compile time in import statements" )
59
66
object symbolLiterals
60
67
end deprecated
61
68
@@ -69,6 +76,7 @@ object language:
69
76
* '''Why allow it?''' Not allowing auto-tupling is difficult to reconcile with
70
77
* operators accepting tuples.
71
78
*/
79
+ @ compileTimeOnly(" `noAutoTupling` can only be used at compile time in import statements" )
72
80
object noAutoTupling
73
81
74
82
/** Where imported, loose equality using eqAny is disabled.
@@ -78,6 +86,7 @@ object language:
78
86
*
79
87
* @see [[https://dotty.epfl.ch/docs/reference/contextual/multiversal-equality ]]
80
88
*/
89
+ @ compileTimeOnly(" `strictEquality` can only be used at compile time in import statements" )
81
90
object strictEquality
82
91
83
92
/** Where imported, ad hoc extensions of non-open classes in other
@@ -96,29 +105,35 @@ object language:
96
105
* such extensions should be limited in scope and clearly documented.
97
106
* That's why the language import is required for them.
98
107
*/
108
+ @ compileTimeOnly(" `adhocExtensions` can only be used at compile time in import statements" )
99
109
object adhocExtensions
100
110
101
111
/** Unsafe Nulls fot Explicit Nulls
102
112
* Inside the "unsafe" scope, `Null` is considered as a subtype of all reference types.
103
113
*
104
114
* @see [[http://dotty.epfl.ch/docs/reference/other-new-features/explicit-nulls.html ]]
105
115
*/
116
+ @ compileTimeOnly(" `unsafeNulls` can only be used at compile time in import statements" )
106
117
object unsafeNulls
107
118
119
+ @ compileTimeOnly(" `future` can only be used at compile time in import statements" )
108
120
object future
109
121
122
+ @ compileTimeOnly(" `future-migration` can only be used at compile time in import statements" )
110
123
object `future-migration`
111
124
112
125
/** Set source version to 3.0-migration.
113
126
*
114
127
* @see [[https://scalacenter.github.io/scala-3-migration-guide/docs/scala-3-migration-mode ]]
115
128
*/
129
+ @ compileTimeOnly(" `3.0-migration` can only be used at compile time in import statements" )
116
130
object `3.0-migration`
117
131
118
132
/** Set source version to 3.0.
119
133
*
120
134
* @see [[https://scalacenter.github.io/scala-3-migration-guide/docs/scala-3-migration-mode ]]
121
135
*/
136
+ @ compileTimeOnly(" `3.0` can only be used at compile time in import statements" )
122
137
object `3.0`
123
138
124
139
/* This can be added when we go to 3.1
0 commit comments