using joinTypes when updating the environment, joinTypes is a function that should replace intersection between sets of types everywhere (forgot this here)