-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
I would expect the code below to compile successfully, but I get an error
Value of optional type 'A?' must be unwrapped to a value of type 'A'
When changing != to == or .shared to A.shared it compiles.
Reproduction
class A: Equatable {
static func == (lhs: A, rhs: A) -> Bool {
lhs === rhs
}
static var shared: A?
}
let a = A()
print(a != .shared)Expected behavior
No compiler error.
Environment
swift-driver version: 1.127.14.1 Apple Swift version 6.2.3 (swiftlang-6.2.3.3.21 clang-1700.6.3.2)
Target: arm64-apple-macosx26.0
Additional information
No response
Kyle-Ye
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels