mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL Box types] Handle box types with layouts with non-parameter requirements.
The handling of SIL box types in both deserialization and in the SIL parser assumed that the number of substitutions in the box type would be equivalent to the number of generic parameters. This assumption is incorrect when the generic signature adds requirements to an associated type. Fixes rdar://problem/29740594.
This commit is contained in:
@@ -4007,13 +4007,13 @@ Type ModuleFile::getType(TypeID TID) {
|
||||
|
||||
SmallVector<Substitution, 4> genericArgs;
|
||||
if (auto sig = layout->getGenericSignature()) {
|
||||
if (args.size() != sig->getGenericParams().size()) {
|
||||
if (args.size() != sig->getAllDependentTypes().size()) {
|
||||
error();
|
||||
return nullptr;
|
||||
}
|
||||
TypeSubstitutionMap mappings;
|
||||
|
||||
for (unsigned i : indices(args)) {
|
||||
for (unsigned i : indices(sig->getGenericParams())) {
|
||||
mappings[sig->getGenericParams()[i]] =
|
||||
getType(args[i])->getCanonicalType();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user