Update the SemanticCheck of patterns to work in two phases

First, semantic check the symbols, and only after, check the expressions
on the pattern. This allow expressions in patterns to reference other
parts of the same pattern