Huh weird, if I specify the type like: `let foo: I...
# announcements
m
Huh weird, if I specify the type like:
let foo: Int = a?.b.value
then it shows an error which makes sense, but if I let it infer the type then it works and if I set
a
to
nil
then
foo
is null which would suggest that it’s actually an
Int?
but IDE shows me
Int
. I guess it’s an IDE bug.
Copy code
let a: A? = A()

let foo = a?.b.value

foo is Int // prints true for Int and for Int?
but
Copy code
let a: A? = nil

let foo = a?.b.value

foo is Int? // prints true only for Int?