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() {
833833 if (!isArray ())
834834 return Type ();
835835
836+ if (!is<BoundGenericStructType>())
837+ return Type ();
838+
836839 // Array<T>
837840 auto boundStruct = castTo<BoundGenericStructType>();
838841 return boundStruct->getGenericArgs ()[0 ];
@@ -842,6 +845,9 @@ Type TypeBase::getInlineArrayElementType() {
842845 if (!isInlineArray ())
843846 return Type ();
844847
848+ if (!is<BoundGenericStructType>())
849+ return Type ();
850+
845851 // InlineArray<n, T>
846852 auto boundStruct = castTo<BoundGenericStructType>();
847853 return boundStruct->getGenericArgs ()[1 ];
Original file line number Diff line number Diff line change @@ -2157,7 +2157,8 @@ namespace {
21572157
21582158 // If a contextual type exists for this expression, apply it directly.
21592159 if (contextualType &&
2160- (contextualType->isArray () || contextualType->isInlineArray ())) {
2160+ (contextualType->getArrayElementType () ||
2161+ contextualType->getInlineArrayElementType ())) {
21612162 // Now that we know we're actually going to use the type, get the
21622163 // version for use in a constraint.
21632164 contextualType = CS.getContextualType (expr, /* forConstraint=*/ true );
You can’t perform that action at this time.
0 commit comments