Skip to content

Commit c9d843d

Browse files
committed
[Typechecker] Move OptionalAdjustmentPosition into a namespace and add the names of diagnostics that uses it
1 parent 74cd0b0 commit c9d843d

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,27 @@ SourceLoc OptionalAdjustment::getOptionalityLoc(TypeRepr *tyR) const {
19291929
return SourceLoc();
19301930
}
19311931

1932+
namespace {
1933+
/// Describes the position for optional adjustment made to a witness.
1934+
///
1935+
/// This is used by the following diagnostics:
1936+
/// 1) 'err_protocol_witness_optionality',
1937+
/// 2) 'warn_protocol_witness_optionality'
1938+
/// 3) 'protocol_witness_optionality_conflict'
1939+
enum class OptionalAdjustmentPosition : unsigned {
1940+
/// The type of a variable.
1941+
VarType = 0,
1942+
/// The result type of something.
1943+
Result = 1,
1944+
/// The parameter type of something.
1945+
Param = 2,
1946+
/// The parameter types of something.
1947+
MultipleParam = 3,
1948+
/// Both return and parameter adjustments.
1949+
ParamAndReturn = 4,
1950+
};
1951+
} // namespace
1952+
19321953
/// Classify the provided optionality issues for use in diagnostics.
19331954
static OptionalAdjustmentPosition classifyOptionalityIssues(
19341955
const SmallVectorImpl<OptionalAdjustment> &adjustments,

lib/Sema/TypeCheckProtocol.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,6 @@ class OptionalAdjustment {
347347
SourceLoc getOptionalityLoc(TypeRepr *tyR) const;
348348
};
349349

350-
/// Describes the position for optional adjustment made to a witness
351-
enum class OptionalAdjustmentPosition : unsigned {
352-
/// The type of a variable.
353-
VarType = 0,
354-
/// The result type of something.
355-
Result = 1,
356-
/// The parameter type of something.
357-
Param = 2,
358-
/// The parameter types of something.
359-
MultipleParam = 3,
360-
/// Both return and parameter adjustments.
361-
ParamAndReturn = 4,
362-
};
363-
364350
/// Describes a match between a requirement and a witness.
365351
struct RequirementMatch {
366352
RequirementMatch(ValueDecl *witness, MatchKind kind,

0 commit comments

Comments
 (0)