Fix an ICE on a cast from an inferred nil to uint

Fixes #10991.