mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Added more tests
Testing SILGen & IRGen tuple keypath generation Added tuple element type check in SILVerifier
This commit is contained in:
committed by
Andrea Tomarelli
parent
a0ed29d326
commit
d7324b977e
@@ -389,10 +389,18 @@ void verifyKeyPathComponent(SILModule &M,
|
||||
"invalid baseTy, should have been a TupleType");
|
||||
|
||||
auto tupleTy = loweredBaseTy.getAs<TupleType>();
|
||||
|
||||
require(component.getTupleIndex() < tupleTy->getNumElements(),
|
||||
auto eltIdx = component.getTupleIndex();
|
||||
|
||||
require(eltIdx < tupleTy->getNumElements(),
|
||||
"invalid element index, greater than # of tuple elements");
|
||||
|
||||
auto eltTy = tupleTy->getElementType(eltIdx)
|
||||
->getReferenceStorageReferent()
|
||||
->getCanonicalType();
|
||||
|
||||
require(eltTy == componentTy,
|
||||
"tuple element type should match the type of the component");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user