Why this fires¶
A numeric as may narrow a range, change signedness, discard a fractional
part, or round an integer that is too large for the destination float.
let byte = large as u8 // warning[TE837]Fix it¶
Use as? when only an exact value is acceptable:
if let byte = large as? u8 {
send(byte)
}When loss is intentional, use cast with a named rounding/overflow policy.
See also¶
TE836— checked cast has no valid path.