fix Issue 9504 - typeof does not look up properties correctly on template argument

The identifiers followed by typeof(exp) or typeod(return) may be resolved to symbol or expression. Type[Typeof|Return]::resolve should consider it.
Fix up error message
Merge pull request #1659 from 9rnsr/fix_typeof

Issue 9504 - typeof does not look up properties correctly on template argument