In Sources/Confidence/FlagEvaluation.swift, the first check in getTyped casts the FlagResolution struct itself rather than the ConfidenceValue parameter:
https://github.com/spotify/confidence-sdk-swift/blob/main/Sources/Confidence/FlagEvaluation.swift#L228
private func getTyped<T>(value: ConfidenceValue, defaultValue: T) throws -> T? {
if let value = self as? T { // `self` is the FlagResolution, not the value
return value
}
...
Since self is a FlagResolution, this cast can never succeed for any supported flag type, so the check silently falls through to the switch below. It looks like the intent was if let value = value as? T (return early when the resolved value is already of the requested type).
Harmless today as far as I can tell, but it's dead code that hides the intended fast path — worth a one-line fix (or removal) plus a test.
Found while auditing the evaluation path during a crash investigation (no relation to the crash itself).
🤖 Generated with Claude Code
In
Sources/Confidence/FlagEvaluation.swift, the first check ingetTypedcasts theFlagResolutionstruct itself rather than theConfidenceValueparameter:https://github.com/spotify/confidence-sdk-swift/blob/main/Sources/Confidence/FlagEvaluation.swift#L228
Since
selfis aFlagResolution, this cast can never succeed for any supported flag type, so the check silently falls through to theswitchbelow. It looks like the intent wasif let value = value as? T(return early when the resolved value is already of the requested type).Harmless today as far as I can tell, but it's dead code that hides the intended fast path — worth a one-line fix (or removal) plus a test.
Found while auditing the evaluation path during a crash investigation (no relation to the crash itself).
🤖 Generated with Claude Code