File tree 1 file changed +9
-14
lines changed
compiler/src/dotty/tools/dotc/quoted 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,13 @@ object PickledQuotes {
184
184
QuotesCache .getTree(pickled) match
185
185
case Some (tree) =>
186
186
quotePickling.println(s " **** Using cached quote for TASTY \n $tree" )
187
- tree
187
+ treeOwner(tree) match
188
+ case Some (owner) =>
189
+ // Copy the cached tree to make sure the all definitions are unique.
190
+ TreeTypeMap (oldOwners = List (owner), newOwners = List (owner)).apply(tree)
191
+ case _ =>
192
+ tree
193
+
188
194
case _ =>
189
195
val bytes = pickled match
190
196
case pickled : String => TastyString .unpickle(pickled)
@@ -197,25 +203,14 @@ object PickledQuotes {
197
203
unpickler.enter(Set .empty)
198
204
199
205
val tree = unpickler.tree
200
-
201
- var cacheable = true // TODO: can we remove this?
206
+ QuotesCache (pickled) = tree
202
207
203
208
// Make sure trees and positions are fully loaded
204
209
new TreeTraverser {
205
- def traverse (tree : Tree )(using Context ): Unit =
206
- tree match
207
- case _ : DefTree =>
208
- if ! tree.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot )
209
- && ! tree.symbol.hasAnnotation(defn.QuotedRuntimePatterns_patternTypeAnnot )
210
- then
211
- cacheable = false
212
- case _ =>
213
- traverseChildren(tree)
210
+ def traverse (tree : Tree )(using Context ): Unit = traverseChildren(tree)
214
211
}.traverse(tree)
215
212
216
213
quotePickling.println(i " **** unpickled quote \n $tree" )
217
- if cacheable then
218
- QuotesCache (pickled) = tree
219
214
220
215
tree
221
216
}
You can’t perform that action at this time.
0 commit comments