Revert #3081 change, and add more better error propagation for TypeFunction

`TypeFunction` is also used for the extra payload of function attributes.
Therefore, even if function signature or its body has errors, we would be better to leave that `fd->type->ty == Tfunction`.
fix-up test cases for issue 11822, 11850, and 11857
fix Issue 11922 - ICE on nonexistent identifier in templated auto method