You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better position and associated file for copied symbols
When a copy of a symbol is created with a new owner, the position and
associated file used to be kept as-is, but this can lead to confusing
error messages referencing the original definition which might be
unrelated to the current error, instead we now copy these fields from
the new owner.
Copy file name to clipboardExpand all lines: compiler/src/dotty/tools/dotc/core/Symbols.scala
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -797,19 +797,27 @@ object Symbols {
797
797
NoDenotation// force it in order to set `denot` field of NoSymbol
798
798
799
799
implicitclassCopier[N<:Name](sym: Symbol { typeThisName=N })(implicitctx: Context) {
800
-
/** Copy a symbol, overriding selective fields */
800
+
/** Copy a symbol, overriding selective fields.
801
+
* Note that `coord` and `associatedFile` will be set from the fields in `owner`, not
802
+
* the fields in `sym`.
803
+
*/
801
804
defcopy(
802
805
owner: Symbol= sym.owner,
803
806
name: N= (sym.name:N), // Dotty deviation: type ascription to avoid leaking private sym (only happens in unpickling), won't be needed once #1723 is fixed
0 commit comments