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
Fix QuotesCache caching quoted symbol definitions with incorrect owners
Previously we would always cache and reuse unpickled trees, which was a
problem for quoted code which included symbol definitions. In those
cases, even if those quotes were being created within another context
(which should dictate owners of symbol definitions), it would be
ignored, and previous potentially incorrect symbol definitions would be
reused.
Now we include the quote symbol owner while caching, which is only taken
into account if the quoted code contains a symbol definition.
// When a quote is unpickled with a Quotes context that that has a class `spliceOwner`
241
+
// we need to use a dummy owner to unpickle it. Otherwise any definitions defined
242
+
// in the quoted block would be accidentally entered in the class.
243
+
// When splicing this expression, this owner is replaced with the correct owner (see `quotedExprToTree` and `quotedTypeToTree` above).
244
+
// On the other hand, if the expression is used as a reflect term, the user must call `changeOwner` (same as with other expressions used within a nested owner).
245
+
// `-Xcheck-macros` will check for inconsistent owners and provide the users hints on how to improve them.
246
+
//
247
+
// Quotes context that that has a class `spliceOwner` can come from a macro annotation
248
+
// or a user setting it explicitly using `Symbol.asQuotes`.
// When a quote is unpickled with a Quotes context that that has a class `spliceOwner`
256
-
// we need to use a dummy owner to unpickle it. Otherwise any definitions defined
257
-
// in the quoted block would be accidentally entered in the class.
258
-
// When splicing this expression, this owner is replaced with the correct owner (see `quotedExprToTree` and `quotedTypeToTree` above).
259
-
// On the other hand, if the expression is used as a reflect term, the user must call `changeOwner` (same as with other expressions used within a nested owner).
260
-
// `-Xcheck-macros` will check for inconsistent owners and provide the users hints on how to improve them.
261
-
//
262
-
// Quotes context that that has a class `spliceOwner` can come from a macro annotation
263
-
// or a user setting it explicitly using `Symbol.asQuotes`.
0 commit comments