Avatar
Avatar
Kishikawa Katsumi
@swift-5.8.1 func f<T>(_ expr: T) -> T { let val = expr return val } let i = 0 _ = f([0]).firstIndex(of: 0) == i _ = f([0]).firstIndex(of: 0) != i
swift58 BOT 4/8/2023 2:36 PM
exit status: 1 with <stdin>:8:12: error: value of optional type 'Int?' must be unwrapped to a value of type 'Int' _ = f([0]).firstIndex(of: 0) != i ^ <stdin>:8:12: note: coalesce using '??' to provide a default when the optional value contains 'nil' _ = f([0]).firstIndex(of: 0) != i ^ ?? <#default value#> <stdin>:8:12: note: force-unwrap using '!' to abort execution if the optional value contains 'nil' _ = f([0]).firstIndex(of: 0) != i ^ !