File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
compiler/src/dotty/tools/dotc/quoted Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,13 @@ object PickledQuotes {
184184 QuotesCache .getTree(pickled) match
185185 case Some (tree) =>
186186 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+
188194 case _ =>
189195 val bytes = pickled match
190196 case pickled : String => TastyString .unpickle(pickled)
@@ -197,25 +203,14 @@ object PickledQuotes {
197203 unpickler.enter(Set .empty)
198204
199205 val tree = unpickler.tree
200-
201- var cacheable = true // TODO: can we remove this?
206+ QuotesCache (pickled) = tree
202207
203208 // Make sure trees and positions are fully loaded
204209 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)
214211 }.traverse(tree)
215212
216213 quotePickling.println(i " **** unpickled quote \n $tree" )
217- if cacheable then
218- QuotesCache (pickled) = tree
219214
220215 tree
221216 }
You can’t perform that action at this time.
0 commit comments