Skip to content

fix(FlagEvaluation): remove dead getTyped cast - #272

Merged
nicklasl merged 1 commit into
spotify:mainfrom
reginaldalfret:spotify/fix-remove-dead-gettyped-cast
Nov 2, 2026
Merged

nicklasl merged 1 commit into
spotify:mainfrom
reginaldalfret:spotify/fix-remove-dead-gettyped-cast

Conversation

@reginaldalfret

Copy link
Copy Markdown
Contributor

Summary

Resolves #252

As noted by maintainer @fabriziodemaria in #271, the initial check:
\\swift
if let value = self as? T {
return value
}
\
is dead code because \self\ is \FlagResolution.

Attempting to change it to \�alue as? T\ is also incorrect because \�alue\ is a \ConfidenceValue\ wrapper (casting it directly to primitive types evaluates to
il, and casting for \ConfidenceValue\ / \Any\ / \AnyObject\ would bypass the switch and skip the .null -> nil\ path).

Following maintainer guidance, this PR deletes the dead check completely so all evaluations reliably go through \switch value.type().

Checklist

  • Removed unreachable \self as? T\ check in \Sources/Confidence/FlagEvaluation.swift\
  • Follows repository SwiftLint conventions
  • Signed-off-by included on commit

Removes the unreachable 'self as? T' check in getTyped(), ensuring all flag values are evaluated via switch value.type().

Resolves spotify#252

Signed-off-by: reginaldalfret <[email protected]>
@nicklasl
nicklasl merged commit 8381438 into spotify:main Nov 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlagResolution.getTyped casts self instead of value

2 participants