Skip to content

Commit c8b03fd

Browse files
committed
[Type checker] Use Decl::diagnose() in more places
Eliminates an unnecessary dependency on the TypeChecker instance and lets us deal with references across modules.
1 parent 9afa479 commit c8b03fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,9 +1185,9 @@ ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
11851185
auto hashableProto = C.getProtocol(KnownProtocolKind::Hashable);
11861186
if (!canDeriveConformance(getConformanceContext(), Nominal,
11871187
hashableProto)) {
1188-
TC.diagnose(ConformanceDecl->getLoc(), diag::type_does_not_conform,
1189-
Nominal->getDeclaredType(),
1190-
hashableProto->getDeclaredType());
1188+
ConformanceDecl->diagnose(diag::type_does_not_conform,
1189+
Nominal->getDeclaredType(),
1190+
hashableProto->getDeclaredType());
11911191
return nullptr;
11921192
}
11931193

@@ -1213,13 +1213,13 @@ ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
12131213
// hashValue has an explicit implementation, but hash(into:) doesn't.
12141214
// Emit a deprecation warning, then derive hash(into:) in terms of
12151215
// hashValue.
1216-
TC.diagnose(hashValueDecl->getLoc(), diag::hashvalue_implementation,
1217-
Nominal->getDeclaredType());
1216+
hashValueDecl->diagnose(diag::hashvalue_implementation,
1217+
Nominal->getDeclaredType());
12181218
return deriveHashable_hashInto(*this,
12191219
&deriveBodyHashable_compat_hashInto);
12201220
}
12211221
}
12221222

1223-
TC.diagnose(requirement->getLoc(), diag::broken_hashable_requirement);
1223+
requirement->diagnose(diag::broken_hashable_requirement);
12241224
return nullptr;
12251225
}

0 commit comments

Comments
 (0)