Skip to content

Commit 80c4aa6

Browse files
committed
[Diagnostics] NFC: Rename ValueType to ExpectedType in raw representable fix/diagnostics
1 parent b38d11d commit 80c4aa6

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,7 +6349,7 @@ void MissingRawRepresentativeInitFailure::fixIt(
63496349
if (auto *E = getAsExpr(getAnchor())) {
63506350
auto range = E->getSourceRange();
63516351
auto rawReprObjType = RawReprType->getOptionalObjectType();
6352-
auto valueObjType = ValueType->getOptionalObjectType();
6352+
auto valueObjType = ExpectedType->getOptionalObjectType();
63536353

63546354
if (rawReprObjType && valueObjType) {
63556355
std::string mapCodeFix;
@@ -6407,7 +6407,7 @@ bool MissingRawRepresentativeInitFailure::diagnoseAsNote() {
64076407
if (auto *decl = overload->choice.getDeclOrNull()) {
64086408
diagnostic.emplace(emitDiagnosticAt(
64096409
decl, diag::cannot_convert_candidate_result_to_contextual_type,
6410-
decl->getName(), ValueType, RawReprType));
6410+
decl->getName(), ExpectedType, RawReprType));
64116411
}
64126412
} else if (auto argConv =
64136413
locator->getLastElementAs<LocatorPathElt::ApplyArgToParam>()) {
@@ -6444,7 +6444,7 @@ void UseOfRawRepresentableInsteadOfItsRawValueFailure::fixIt(
64446444
if (RawReprType->getOptionalObjectType()) {
64456445
fix += ".map { $0.rawValue } ";
64466446

6447-
if (!ValueType->getOptionalObjectType())
6447+
if (!ExpectedType->getOptionalObjectType())
64486448
fix += "?? <#default value#>";
64496449
} else {
64506450
fix += ".rawValue";

lib/Sema/CSDiagnostics.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,13 +2105,13 @@ class UnableToInferKeyPathRootFailure final : public FailureDiagnostic {
21052105
class AbstractRawRepresentableFailure : public FailureDiagnostic {
21062106
protected:
21072107
Type RawReprType;
2108-
Type ValueType;
2108+
Type ExpectedType;
21092109

21102110
AbstractRawRepresentableFailure(const Solution &solution, Type rawReprType,
2111-
Type valueType, ConstraintLocator *locator)
2111+
Type expectedType, ConstraintLocator *locator)
21122112
: FailureDiagnostic(solution, locator),
21132113
RawReprType(resolveType(rawReprType)),
2114-
ValueType(resolveType(valueType)) {}
2114+
ExpectedType(resolveType(expectedType)) {}
21152115

21162116
public:
21172117
virtual Type getFromType() const = 0;
@@ -2143,12 +2143,12 @@ class MissingRawRepresentativeInitFailure final
21432143
: public AbstractRawRepresentableFailure {
21442144
public:
21452145
MissingRawRepresentativeInitFailure(const Solution &solution,
2146-
Type rawReprType, Type valueType,
2146+
Type rawReprType, Type expectedType,
21472147
ConstraintLocator *locator)
2148-
: AbstractRawRepresentableFailure(solution, rawReprType, valueType,
2148+
: AbstractRawRepresentableFailure(solution, rawReprType, expectedType,
21492149
locator) {}
21502150

2151-
Type getFromType() const override { return ValueType; }
2151+
Type getFromType() const override { return ExpectedType; }
21522152
Type getToType() const override { return RawReprType; }
21532153

21542154
bool diagnoseAsNote() override;
@@ -2174,13 +2174,13 @@ class UseOfRawRepresentableInsteadOfItsRawValueFailure final
21742174
public:
21752175
UseOfRawRepresentableInsteadOfItsRawValueFailure(const Solution &solution,
21762176
Type rawReprType,
2177-
Type valueType,
2177+
Type expectedType,
21782178
ConstraintLocator *locator)
2179-
: AbstractRawRepresentableFailure(solution, rawReprType, valueType,
2179+
: AbstractRawRepresentableFailure(solution, rawReprType, expectedType,
21802180
locator) {}
21812181

21822182
Type getFromType() const override { return RawReprType; }
2183-
Type getToType() const override { return ValueType; }
2183+
Type getToType() const override { return ExpectedType; }
21842184

21852185
private:
21862186
void fixIt(InFlightDiagnostic &diagnostic) const override;

lib/Sema/CSFix.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,32 +1124,32 @@ bool ExpandArrayIntoVarargs::diagnose(const Solution &solution,
11241124

11251125
bool ExplicitlyConstructRawRepresentable::diagnose(const Solution &solution,
11261126
bool asNote) const {
1127-
MissingRawRepresentativeInitFailure failure(solution, RawReprType, ValueType,
1128-
getLocator());
1127+
MissingRawRepresentativeInitFailure failure(solution, RawReprType,
1128+
ExpectedType, getLocator());
11291129
return failure.diagnose(asNote);
11301130
}
11311131

11321132
ExplicitlyConstructRawRepresentable *
11331133
ExplicitlyConstructRawRepresentable::create(ConstraintSystem &cs,
1134-
Type rawReprType, Type valueType,
1134+
Type rawReprType, Type expectedType,
11351135
ConstraintLocator *locator) {
1136-
return new (cs.getAllocator())
1137-
ExplicitlyConstructRawRepresentable(cs, rawReprType, valueType, locator);
1136+
return new (cs.getAllocator()) ExplicitlyConstructRawRepresentable(
1137+
cs, rawReprType, expectedType, locator);
11381138
}
11391139

11401140
bool UseValueTypeOfRawRepresentative::diagnose(const Solution &solution,
11411141
bool asNote) const {
1142-
ArgumentMismatchFailure failure(solution, RawReprType, ValueType,
1142+
ArgumentMismatchFailure failure(solution, RawReprType, ExpectedType,
11431143
getLocator());
11441144
return failure.diagnose(asNote);
11451145
}
11461146

11471147
UseValueTypeOfRawRepresentative *
11481148
UseValueTypeOfRawRepresentative::create(ConstraintSystem &cs, Type rawReprType,
1149-
Type valueType,
1149+
Type expectedType,
11501150
ConstraintLocator *locator) {
11511151
return new (cs.getAllocator())
1152-
UseValueTypeOfRawRepresentative(cs, rawReprType, valueType, locator);
1152+
UseValueTypeOfRawRepresentative(cs, rawReprType, expectedType, locator);
11531153
}
11541154

11551155
unsigned AllowArgumentMismatch::getParamIdx() const {

lib/Sema/CSFix.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,14 +1596,14 @@ class ExpandArrayIntoVarargs final : public AllowArgumentMismatch {
15961596

15971597
class ExplicitlyConstructRawRepresentable final : public ConstraintFix {
15981598
Type RawReprType;
1599-
Type ValueType;
1599+
Type ExpectedType;
16001600

16011601
ExplicitlyConstructRawRepresentable(ConstraintSystem &cs, Type rawReprType,
1602-
Type valueType,
1602+
Type expectedType,
16031603
ConstraintLocator *locator)
16041604
: ConstraintFix(cs, FixKind::ExplicitlyConstructRawRepresentable,
16051605
locator),
1606-
RawReprType(rawReprType), ValueType(valueType) {}
1606+
RawReprType(rawReprType), ExpectedType(expectedType) {}
16071607

16081608
public:
16091609
std::string getName() const override {
@@ -1613,18 +1613,18 @@ class ExplicitlyConstructRawRepresentable final : public ConstraintFix {
16131613
bool diagnose(const Solution &solution, bool asNote = false) const override;
16141614

16151615
static ExplicitlyConstructRawRepresentable *
1616-
create(ConstraintSystem &cs, Type rawTypeRepr, Type valueType,
1616+
create(ConstraintSystem &cs, Type rawTypeRepr, Type expectedType,
16171617
ConstraintLocator *locator);
16181618
};
16191619

16201620
class UseValueTypeOfRawRepresentative final : public ConstraintFix {
16211621
Type RawReprType;
1622-
Type ValueType;
1622+
Type ExpectedType;
16231623

16241624
UseValueTypeOfRawRepresentative(ConstraintSystem &cs, Type rawReprType,
1625-
Type valueType, ConstraintLocator *locator)
1625+
Type expectedType, ConstraintLocator *locator)
16261626
: ConstraintFix(cs, FixKind::UseValueTypeOfRawRepresentative, locator),
1627-
RawReprType(rawReprType), ValueType(valueType) {}
1627+
RawReprType(rawReprType), ExpectedType(expectedType) {}
16281628

16291629
public:
16301630
std::string getName() const override {
@@ -1635,7 +1635,7 @@ class UseValueTypeOfRawRepresentative final : public ConstraintFix {
16351635

16361636
static UseValueTypeOfRawRepresentative *create(ConstraintSystem &cs,
16371637
Type rawReprType,
1638-
Type valueType,
1638+
Type expectedType,
16391639
ConstraintLocator *locator);
16401640
};
16411641

0 commit comments

Comments
 (0)