Skip to content

Commit 0ab6d53

Browse files
committed
Sema: Implement matchTypes() for BuiltinFixedArrayType
1 parent 2f90d50 commit 0ab6d53

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7402,6 +7402,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
74027402

74037403
// Note: Mismatched builtin types fall through to the TypeKind::Error
74047404
// case below.
7405+
#define BUILTIN_GENERIC_TYPE(id, parent)
74057406
#define BUILTIN_TYPE(id, parent) case TypeKind::id:
74067407
#define TYPE(id, parent)
74077408
#include "swift/AST/TypeNodes.def"
@@ -7410,6 +7411,23 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
74107411
case TypeKind::Unresolved:
74117412
return getTypeMatchFailure(locator);
74127413

7414+
case TypeKind::BuiltinFixedArray: {
7415+
auto *fixed1 = cast<BuiltinFixedArrayType>(desugar1);
7416+
auto *fixed2 = cast<BuiltinFixedArrayType>(desugar2);
7417+
7418+
auto result = matchTypes(fixed1->getSize(), fixed2->getSize(),
7419+
ConstraintKind::Bind, subflags,
7420+
locator.withPathElement(
7421+
LocatorPathElt::GenericArgument(0)));
7422+
if (result.isFailure())
7423+
return result;
7424+
7425+
return matchTypes(fixed1->getElementType(), fixed2->getElementType(),
7426+
ConstraintKind::Bind, subflags,
7427+
locator.withPathElement(
7428+
LocatorPathElt::GenericArgument(0)));
7429+
}
7430+
74137431
case TypeKind::Placeholder: {
74147432
// If it's allowed to attempt fixes, let's delegate
74157433
// decision to `repairFailures`, since depending on

0 commit comments

Comments
 (0)