fix issue 10783 - ICE and bad diagnostics when using non-existent symbols in switch and with statements