mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We were not able to use an existential as the base of an access that strictly borrows the existential, because SILGen's RValue emission would establish a fresh evaluation scope just for the existential's opening, and then copy the opened value out. This is problematic for noncopyable existentials. So this patch moves & adds FormalEvaluationScope's around so they're broad enough to enable a borrow of an existential. The idea behind this refactoring is to establish top-level FormalEvaluationScopes when initially creating RValue's for Expr's in SILGen. Any more-tightly scoped operations will already establish their own nested scope, so this is mostly adding safe-guards. I've limited the existentials fix to noncopyables for now. part of rdar://159079818
63 KiB
63 KiB