@@ -348,6 +348,27 @@ object Symbols {
348
348
def paramVariance (using Context ): Variance = denot.variance
349
349
def paramRef (using Context ): TypeRef = denot.typeRef
350
350
351
+ /** Copy a symbol, overriding selective fields.
352
+ * Note that `coord` and `associatedFile` will be set from the fields in `owner`, not
353
+ * the fields in `sym`. */
354
+ def copy (using Context )(
355
+ owner : Symbol = this .owner,
356
+ name : ThisName = name,
357
+ flags : FlagSet = this .flags,
358
+ info : Type = this .info,
359
+ privateWithin : Symbol = this .privateWithin,
360
+ coord : Coord = NoCoord , // Can be `= owner.coord` once we bootstrap
361
+ associatedFile : AbstractFile | Null = null // Can be `= owner.associatedFile` once we bootstrap
362
+ ): Symbol = {
363
+ val coord1 = if (coord == NoCoord ) owner.coord else coord
364
+ val associatedFile1 = if (associatedFile == null ) owner.associatedFile else associatedFile
365
+
366
+ if isClass then
367
+ newClassSymbol(owner, name.asTypeName, flags, _ => info, privateWithin, coord1, associatedFile1)
368
+ else
369
+ newSymbol(owner, name, flags, info, privateWithin, coord1)
370
+ }
371
+
351
372
// -------- Printing --------------------------------------------------------
352
373
353
374
/** The prefix string to be used when displaying this symbol without denotation */
@@ -469,30 +490,6 @@ object Symbols {
469
490
470
491
NoDenotation // force it in order to set `denot` field of NoSymbol
471
492
472
- extension [N <: Name ](sym : Symbol { type ThisName = N })(using Context ) {
473
- /** Copy a symbol, overriding selective fields.
474
- * Note that `coord` and `associatedFile` will be set from the fields in `owner`, not
475
- * the fields in `sym`.
476
- */
477
- def copy (
478
- owner : Symbol = sym.owner,
479
- name : N = sym.name,
480
- flags : FlagSet = sym.flags,
481
- info : Type = sym.info,
482
- privateWithin : Symbol = sym.privateWithin,
483
- coord : Coord = NoCoord , // Can be `= owner.coord` once we bootstrap
484
- associatedFile : AbstractFile | Null = null // Can be `= owner.associatedFile` once we bootstrap
485
- ): Symbol = {
486
- val coord1 = if (coord == NoCoord ) owner.coord else coord
487
- val associatedFile1 = if (associatedFile == null ) owner.associatedFile else associatedFile
488
-
489
- if (sym.isClass)
490
- newClassSymbol(owner, name.asTypeName, flags, _ => info, privateWithin, coord1, associatedFile1)
491
- else
492
- newSymbol(owner, name, flags, info, privateWithin, coord1)
493
- }
494
- }
495
-
496
493
/** Makes all denotation operations available on symbols */
497
494
implicit def toDenot (sym : Symbol )(using Context ): SymDenotation = sym.denot
498
495
0 commit comments