-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
OptionSetArea → standard library: The `OptionSet` protocolArea → standard library: The `OptionSet` protocolbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsfix-itsFeature: diagnostic fix-itsFeature: diagnostic fix-itsinteger literalsFeature → literals: Integer literalsFeature → literals: Integer literalsliteralsFeature → expressions: Literals such as an integer or string literalFeature → expressions: Literals such as an integer or string literalswift 6.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
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
OptionSetArea → standard library: The `OptionSet` protocolArea → standard library: The `OptionSet` protocolbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsfix-itsFeature: diagnostic fix-itsFeature: diagnostic fix-itsinteger literalsFeature → literals: Integer literalsFeature → literals: Integer literalsliteralsFeature → expressions: Literals such as an integer or string literalFeature → expressions: Literals such as an integer or string literalswift 6.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis