@@ -5,12 +5,14 @@ package core
5
5
import scala .annotation .{threadUnsafe => tu }
6
6
import Types ._ , Contexts ._ , Symbols ._ , SymDenotations ._ , StdNames ._ , Names ._ , Phases ._
7
7
import Flags ._ , Scopes ._ , Decorators ._ , NameOps ._ , Periods ._ , NullOpsDecorator ._
8
+ import ast .tpd .Literal , Constants .Constant
8
9
import unpickleScala2 .Scala2Unpickler .ensureConstructor
9
10
import scala .collection .mutable
10
11
import collection .mutable
11
12
import Denotations .SingleDenotation
12
13
import util .{SimpleIdentityMap , SourceFile , NoSource }
13
14
import typer .ImportInfo .RootRef
15
+ import Annotations .Annotation
14
16
15
17
import scala .annotation .tailrec
16
18
@@ -1108,6 +1110,9 @@ class Definitions {
1108
1110
* is read from a classfile.
1109
1111
*/
1110
1112
def patchStdLibClass (denot : ClassDenotation )(using Context ): Unit =
1113
+ val annot = Annotation .deferredSymAndTree(defn.CompileTimeOnlyAnnot ) {
1114
+ Literal (Constant (" The symbol can only be used at compile time in import statements" ))
1115
+ }
1111
1116
1112
1117
def patch2 (denot : ClassDenotation , patchCls : Symbol ): Unit =
1113
1118
val scope = denot.info.decls.openForMutations
@@ -1121,9 +1126,11 @@ class Definitions {
1121
1126
for patch <- patches do
1122
1127
patch.ensureCompleted()
1123
1128
if ! recurse(patch) then
1124
- patch.denot = patch.denot.copySymDenotation(owner = denot.symbol)
1125
- scope.enter(patch)
1126
- else if patch.isClass then
1129
+ val copy = patch.copy(owner = denot.symbol)
1130
+ copy.denot = patch.denot.copySymDenotation(owner = denot.symbol)
1131
+ copy.addAnnotation(annot)
1132
+ scope.enter(copy)
1133
+ if patch.isClass then
1127
1134
patch2(scope.lookup(patch.name).asClass, patch)
1128
1135
1129
1136
def patchWith (patchCls : Symbol ) =
0 commit comments