Fixes Issue 9291 - ICE on throwing undefined identifier.
Fixes Issue 4540 - Better diagnostic for wrong switch type.
finish up alignment refactoring and fixing
Merge pull request #1417 from AndrejMitrovic/Fix4540

Issue 4540 - Better diagnostic for wrong switch type.
Merge pull request #1461 from AndrejMitrovic/Fix9291

Issue 9291 - ICE on throwing undefined identifier
Merge pull request #1463 from WalterBright/b3

finish up alignment refactoring and fixing