Add assertion and fix AST identity that had broken by template instantiation
Merge pull request #1760 from 9rnsr/fix_ast_identity

Add assertion and fix AST identity that had broken by template instantiation