Skip to content

Commit f07495d

Browse files
committed
AST: Add TypePosition::Shape
1 parent 747b060 commit f07495d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

include/swift/AST/Type.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ enum class ForeignRepresentableKind : uint8_t {
214214
/// therefore, the result type is in covariant position relative to the function
215215
/// type.
216216
struct TypePosition final {
217-
enum : uint8_t { Covariant, Contravariant, Invariant };
217+
enum : uint8_t { Covariant, Contravariant, Invariant, Shape };
218218

219219
private:
220220
decltype(Covariant) kind;
@@ -224,6 +224,7 @@ struct TypePosition final {
224224

225225
TypePosition flipped() const {
226226
switch (kind) {
227+
case Shape:
227228
case Invariant:
228229
return *this;
229230
case Covariant:

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4677,7 +4677,7 @@ case TypeKind::Id:
46774677
return Type();
46784678

46794679
Type transformedCount =
4680-
expand->getCountType().transformWithPosition(pos, fn);
4680+
expand->getCountType().transformWithPosition(TypePosition::Shape, fn);
46814681
if (!transformedCount)
46824682
return Type();
46834683

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
21992199

22002200
case TypePosition::Contravariant:
22012201
case TypePosition::Invariant:
2202+
case TypePosition::Shape:
22022203
return Type(t);
22032204
}
22042205

0 commit comments

Comments
 (0)