Skip to content

Commit

Permalink
Clean up error message for "module 'foo' has no member named 'bar'".
Browse files Browse the repository at this point in the history
r7012-14 had removed the special case for module member lookup, but we
should still special-case the error message.

Swift SVN r7047
  • Loading branch information
jrose-apple committed Aug 8, 2013
1 parent 841e3f4 commit ac80171
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/Sema/TypeCheckConstraintsDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,17 @@ static bool diagnoseFailure(ConstraintSystem &cs, Failure &failure) {
break;

case Failure::DoesNotHaveMember:
tc.diagnose(loc, diag::does_not_have_member,
failure.getFirstType(),
failure.getName())
.highlight(range1).highlight(range2);
if (auto moduleTy = failure.getFirstType()->getAs<ModuleType>()) {
tc.diagnose(loc, diag::no_member_of_module,
moduleTy->getModule()->Name,
failure.getName())
.highlight(range1).highlight(range2);
} else {
tc.diagnose(loc, diag::does_not_have_member,
failure.getFirstType(),
failure.getName())
.highlight(range1).highlight(range2);
}
break;

case Failure::DoesNotConformToProtocol:
Expand Down

0 comments on commit ac80171

Please sign in to comment.