stage1: make get_optional_type more robust

Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.

Introduces `get_optional_type2` which should be used generally inside
ir.cpp.

Fix some std lib compile errors noticed by the provided test case.

Thanks @LemonBoy for the test case. Closes #4377.

Fixes #4374.
fa46bcb368Andrew Kelley committed on 3/6/2020, 11:30:30 PMparent83d27f7
5 files changedLine totals unavailable