Files
swift-mirror/validation-test/SILOptimizer/rdar141279635.swift
Nate Chandler 4786bede68 [MoveOnly] Fix consumption of opened existentials.
Enable walking into `TypeOffsetSizePair`s from an existential into an
archetype.  And set the access kind on `open_existential_addr`
instructions which are the sources of rewritten `copy_addr`s to mutable.

rdar://141279635
2025-04-22 17:59:37 -07:00

22 lines
330 B
Swift

// RUN: %target-build-swift %s
protocol P: ~Copyable {
var property: Bool { get }
consuming func function()
}
struct S: P, ~Copyable {
var property: Bool { false }
consuming func function() {}
}
func g(s: consuming any P & ~Copyable) {
let s = s
s.function()
}
func f() {
let s = S()
g(s: s)
}