-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.ownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semantics
Description
Description
One of the test-cases introduced by #76834 depends on a type-checker hack that applies only to initializers - https://github.com/swiftlang/swift/blob/main/lib/Sema/CSSimplify.cpp#L9843-L9855. Removal of this hack makes the code ambiguous.
Reproduction
struct View : ~Escapable {
init(_ otherBV: borrowing View) {}
init(_ k: consuming View) {}
}
@lifetime(x)
func getConsumingView(_ x: consuming View) -> View {
return View(x)
}
Without perf hack this produces:
error: ambiguous use of 'init(_:)'
Expected behavior
We need to define expected type/flag matching behavior for borrowing
and consuming
parameters that does not depend on the performance hack(s).
Environment
Swift compiler main branch.
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.ownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semantics