You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I trying to use consume operator, but it lead to compilation error with error:
'consume' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug
Basically I do very similar to what is described in example at SE-0366
Reproduction
func doStuffUniquely(with value:consuming[Int]){// If we received the last remaining reference to `value`, we'd like// to be able to efficiently update it without incurring more copies.varnewValue= consume value
newValue.append(42)}func test(){varx:[Int]=[1,2,3]// x is appended to. After this point, we know that x is unique. We want to// preserve that property.
x.append(5)// Pass the current value of x off to another function, thatdoStuffUniquely(with: consume x)// DOESN'T COMPILE WITH ERROR: 'consume' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug // Reset x to a new value. Since we don't use the old value anymore,
x =[]doMoreStuff(with:&x)}func doMoreStuff(with value:inout[Int]){}
Expected behavior
Compiles normally and works
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered:
mr-swifter
added
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
labels
Mar 27, 2024
Description
I trying to use
consume
operator, but it lead to compilation error with error:Basically I do very similar to what is described in example at SE-0366
Reproduction
Expected behavior
Compiles normally and works
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: