i have a line: `if (header?.startsWith("Basic ") !...
# announcements
t
i have a line:
if (header?.startsWith("Basic ") != true) throw Exception
. intellij is suggesting i replace this with
require(header?.startsWith("Basic ") == true)
, but if i do that,
header
is no longer smart cast
w
🤔 For me in the first case
header
is not smart cast to
String
either. Is that what you meant by smart cast?
image.png
Hm, nevermind. It is smartcast, but the hint is wrong. When I write e.g.
header[0]
it works. Anyway, it seems like it should be possible to infer nullability in this case. The quick fix shouldn’t change the semantics, though
k
Either it's a compiler bug or a quickfix bug, report an youtrack and let them sort it out simple smile