File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -833,6 +833,9 @@ Type TypeBase::getArrayElementType() {
833
833
if (!isArray ())
834
834
return Type ();
835
835
836
+ if (!is<BoundGenericStructType>())
837
+ return Type ();
838
+
836
839
// Array<T>
837
840
auto boundStruct = castTo<BoundGenericStructType>();
838
841
return boundStruct->getGenericArgs ()[0 ];
@@ -842,6 +845,9 @@ Type TypeBase::getInlineArrayElementType() {
842
845
if (!isInlineArray ())
843
846
return Type ();
844
847
848
+ if (!is<BoundGenericStructType>())
849
+ return Type ();
850
+
845
851
// InlineArray<n, T>
846
852
auto boundStruct = castTo<BoundGenericStructType>();
847
853
return boundStruct->getGenericArgs ()[1 ];
Original file line number Diff line number Diff line change @@ -2157,7 +2157,8 @@ namespace {
2157
2157
2158
2158
// If a contextual type exists for this expression, apply it directly.
2159
2159
if (contextualType &&
2160
- (contextualType->isArray () || contextualType->isInlineArray ())) {
2160
+ (contextualType->getArrayElementType () ||
2161
+ contextualType->getInlineArrayElementType ())) {
2161
2162
// Now that we know we're actually going to use the type, get the
2162
2163
// version for use in a constraint.
2163
2164
contextualType = CS.getContextualType (expr, /* forConstraint=*/ true );
You can’t perform that action at this time.
0 commit comments