@@ -1258,7 +1258,7 @@ bool TupleExtractInst::isTrivialEltOfOneRCIDTuple() const {
12581258 // parent tuple has only one non-trivial field.
12591259 bool FoundNonTrivialField = false ;
12601260 SILType OpTy = getOperand ()->getType ();
1261- unsigned FieldNo = getFieldNo ();
1261+ unsigned FieldNo = getFieldIndex ();
12621262
12631263 // For each element index of the tuple...
12641264 for (unsigned i = 0 , e = getNumTupleElts (); i != e; ++i) {
@@ -1300,7 +1300,7 @@ bool TupleExtractInst::isEltOnlyNonTrivialElt() const {
13001300 // Ok, we know that the elt we are extracting is non-trivial. Make sure that
13011301 // we have no other non-trivial elts.
13021302 SILType OpTy = getOperand ()->getType ();
1303- unsigned FieldNo = getFieldNo ();
1303+ unsigned FieldNo = getFieldIndex ();
13041304
13051305 // For each element index of the tuple...
13061306 for (unsigned i = 0 , e = getNumTupleElts (); i != e; ++i) {
@@ -1348,7 +1348,7 @@ VarDecl *swift::getIndexedField(NominalTypeDecl *decl, unsigned index) {
13481348 if (auto *classDecl = dyn_cast<ClassDecl>(decl)) {
13491349 for (auto *superDecl = classDecl->getSuperclassDecl (); superDecl != nullptr ;
13501350 superDecl = superDecl->getSuperclassDecl ()) {
1351- assert (index > superDecl->getStoredProperties ().size ()
1351+ assert (index >= superDecl->getStoredProperties ().size ()
13521352 && " field index cannot refer to a superclass field" );
13531353 index -= superDecl->getStoredProperties ().size ();
13541354 }
@@ -1357,7 +1357,7 @@ VarDecl *swift::getIndexedField(NominalTypeDecl *decl, unsigned index) {
13571357}
13581358
13591359unsigned FieldIndexCacheBase::cacheFieldIndex () {
1360- unsigned index = getFieldIndex (getParentDecl (), getField ());
1360+ unsigned index = :: getFieldIndex (getParentDecl (), getField ());
13611361 SILInstruction::Bits.FieldIndexCacheBase .FieldIndex = index;
13621362 return index;
13631363}
0 commit comments