mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Allow computed components in KeyPathInst.
A computed component needs: - A stable identifier for equality checking. This can be either a static function reference for concrete property implementations, or a reference into a vtable or witness table for a dynamically dispatched property. This should correspond to a public ABI interface for public things. - Getter and setter (TODO: and materializeForSet) references. These might be thunks to reach the necessary abstraction level for the keypath implementation, so they can't be used as stable identifiers directly.
This commit is contained in:
@@ -3709,13 +3709,16 @@ public:
|
||||
require(substSetterType->getNumParameters() == 2,
|
||||
"setter should have two parameters");
|
||||
auto baseParam = substSetterType->getSelfParameter();
|
||||
require(baseParam.getConvention() == ParameterConvention::Indirect_In,
|
||||
require(baseParam.getConvention() ==
|
||||
ParameterConvention::Indirect_In,
|
||||
"setter base parameter should be @in");
|
||||
auto newValueParam = substSetterType->getParameters()[0];
|
||||
require(newValueParam.getConvention() == ParameterConvention::Indirect_In,
|
||||
require(newValueParam.getConvention() ==
|
||||
ParameterConvention::Indirect_In,
|
||||
"setter value parameter should be @in");
|
||||
|
||||
require(newValueParam.getType() == loweredBaseTy.getSwiftRValueType(),
|
||||
require(newValueParam.getType() ==
|
||||
loweredComponentTy.getSwiftRValueType(),
|
||||
"setter value should match the maximal abstraction of the "
|
||||
"formal component type");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user