Avatar
Avatar
Iceman
@swift-5.10.1 struct A: Error {} let a = A() print(a as? Never)
swift510 BOT 1/6/2025 2:57 PM
nil<stdin>:3:9: warning: cast from 'A' to unrelated type 'Never' always fails print(a as? Never) ~ ^ ~~~~~ <stdin>:3:7: warning: expression implicitly coerced from 'Never?' to 'Any' print(a as? Never) ^~~~~~~~~~~ <stdin>:3:9: note: provide a default value to avoid this warning print(a as? Never) ~~^~~~~~~~~ ?? <#default value#> <stdin>:3:9: note: force-unwrap the value to avoid this warning print(a as? Never) ~~^~~~~~~~~ ! <stdin>:3:9: note: explicitly cast to 'Any' with 'as Any' to silence this warning print(a as? Never) ~~^~~~~~~~~ as Any