Skip to content

Commit f72b213

Browse files
committed
simplify and rebrand diag::invalid_relation now that it can only produce
two messages. Swift SVN r31320
1 parent 2487277 commit f72b213

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,9 @@ ERROR(load_of_explicit_lvalue,sema_tcc,none,
457457
//------------------------------------------------------------------------------
458458
// Expression Type Checking Errors
459459
//------------------------------------------------------------------------------
460-
ERROR(invalid_relation,sema_tcc,none,
461-
"%1 is not %select{identical to|a subtype of|"
462-
"convertible to|constructible with|identical to}0 %2",
463-
(unsigned, Type, Type))
460+
ERROR(types_not_convertible,sema_tcc,none,
461+
"%1 is not %select{convertible to|a subtype of}0 %2",
462+
(bool, Type, Type))
464463
NOTE(in_cast_expr_types,sema_tcc,none,
465464
"in cast from type %0 to %1",
466465
(Type, Type))

lib/Sema/CSDiag.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,14 +2394,8 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
23942394
return true;
23952395
}
23962396

2397-
// FIXME: diag::invalid_relation is total overkill for this. In terms of the
2398-
// number of messages it can produce.
2399-
auto failureKind = Failure::FailureKind::TypesNotConvertible;
2400-
if (constraint->getKind() == ConstraintKind::Subtype)
2401-
failureKind = Failure::FailureKind::TypesNotSubtypes;
2402-
2403-
diagnose(anchor->getLoc(), diag::invalid_relation,
2404-
failureKind - Failure::TypesNotEqual,
2397+
diagnose(anchor->getLoc(), diag::types_not_convertible,
2398+
constraint->getKind() == ConstraintKind::Subtype,
24052399
fromType, toType)
24062400
.highlight(anchor->getSourceRange());
24072401

0 commit comments

Comments
 (0)