5.2 no more: warning: expression implicitly coerced from 'Int?' to 'Any', what change?

Following this discussion: Give Int an initializer that takes a single Character - #18 by cukr

let chars: [Character] = ["4", "④", "万", "a"]
for ch in chars {
    print(ch, "-->", ch.wholeNumberValue)    // 5.1 --> warning: expression implicitly coerced from 'Int?' to 'Any'
}

5.2 no more warning. What changed and why no longer warning this?

I still get a warning with Xcode Version 11.4 beta 3 (11N132i)

Something strange with Xcode Playground once again. I've to close and re-open the Playground project to get the warning. I've seen this same behavior before with this:

// Initialization of 'UnsafeMutablePointer<thread_act_t>' (aka 'UnsafeMutablePointer<UInt32>') results in a dangling pointer
        // 1. Implicit argument conversion from '[thread_act_t]' (aka 'Array<UInt32>') to 'UnsafePointer<thread_act_t>' (aka 'UnsafePointer<UInt32>') produces a pointer valid only for the duration of the call to 'init(mutating:)'
        // 2. Use the 'withUnsafeBufferPointer' method on Array in order to explicitly convert argument to buffer pointer valid for a defined scope
        var thread_list: thread_act_array_t? = UnsafeMutablePointer(mutating: [thread_act_t]())

Wonder why that is?

Playgrounds does not show warnings in general, AIUI.

So should I file a radar about my playground showing warnings?

1 Like

But it does show the warning if I close and re-open it....

So why do not show warning in Playground, very much for learning and experiment? I would think you want maximum warning level to point out questionable code as much as possible?

I get this particular warning all the time in playgrounds.