Commits
Ben Langmuir committed b2aaa61aad6
Fix range of coerce-expr when casting a returned CFString to String
foo().getCFString() as String
This cast creates an implicit call expression where the function for the
call is an implicit declref. Instead of choosing "getCFString" as the
location of the declref, we should choose "foo", since otherwise the
overall source range for the call and the coercion will be missing
foo().
Unfortunately there is no good way to test source ranges right now, but
this fixes e.g. the range in the following diagnostic:
struct S {
func getCFString() -> CFString { fatalError("") }
}
_ = S().getCFString() as String + 1
~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ // before
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ // now
rdar://problem/26301228