Reworked function template parsing.

The previous version did not handle methods properly and lead to duplicate definitions since it did not check for existing templates with the same signature.
Ignore note diagnostics.