Open
Description
Description
We introduced a fix-it to replace 0
with []
in the below example in #13899 and lost it at some point, probably because the only remaining test has been XFAILed for a very long time.
Reproduction
struct MyMask : OptionSet {
init(_ rawValue: UInt) {}
init(rawValue: UInt) {}
init(nilLiteral: ()) {}
var rawValue: UInt { return 0 }
static var allZeros: MyMask { return MyMask(0) }
static var Bingo: MyMask { return MyMask(1) }
}
let _: MyMask = 0
Expected behavior
Fix-it:
-let _: MyMask = 0
+let _: MyMask = []
Environment
Swift version 6.2-dev (LLVM 736ebbfa5fe3371, Swift d033eec)
Additional information
No response
Metadata
Metadata
Assignees
Labels
Area → standard library: The `OptionSet` protocolA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: Diagnostics Quality of ImplementationFeature: expressionsFeature: diagnostic fix-itsFeature → literals: Integer literalsFeature → expressions: Literals such as an integer or string literalArea → compiler: Semantic analysis