Added testcase for #545913
Make more use of call chain return type resolve function

Added GetCallChainReturnType() to every bracnh of GetClassName() so any
place where the original variable's return type can be determined will try
to resolve the call chain's last retutn type.
Generalize GetCallChainReturnType to work with properties too

This should make the scenario in the title of #18 work