Compiler [Typechecker]: Improved type checking of foreach(). Also swaps the expected and got types in some related diagnostics to be more intuitive.