`read(STDIN, UInt32)` doesn't seem to respond to the type argument correctly

Today I spent an hour or so helping someone track down a type inference issue. The crux of it is that read(STDIN, UInt32) is inferring a return type of ANY. This seems odd as we are directly passing a type as a parameter. I had the thought that perhaps it returns some other type if it fails, but I couldn’t find any such information in the docs. Is this a bug, intentional design, or me simply not understanding enough of the picture?

Probably worth opening an issue with a minimal reproducing example. The compiler should be able to figure out that read(io, UInt32) should have type UInt32 but it may be getting confused somehow.

Seems to work on 0.6, probably because the read call gets inlined there. Nvm.

I think the problem is that stdin is not a constant so the compiler cannot know what read method will be called.

Thanks for your responses. The simpler test cases are not reproducing it as expected so I’ll have to get the original code and try paring it down.