Skip to content

Commit 89f98e9

Browse files
committed
Partially Revert "Fix wrong calculation of generic params per level when building decl"
(Keeps the test, but reverts the code changes; the test will be updated later.) This reverts most of commit 893d83b from PR #62854
1 parent d738834 commit 89f98e9

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

include/swift/Remote/MetadataReader.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,19 +2959,13 @@ class MetadataReader {
29592959
// Only consider generic contexts of type class, enum or struct.
29602960
// There are other context types that can be generic, but they should
29612961
// not affect the generic shape.
2962-
if (current->getKind() == ContextDescriptorKind::Class ||
2963-
current->getKind() == ContextDescriptorKind::Enum ||
2964-
current->getKind() == ContextDescriptorKind::Struct) {
2965-
if (genericContext) {
2966-
auto contextHeader = genericContext->getGenericContextHeader();
2967-
paramsPerLevel.emplace_back(contextHeader.NumParams -
2968-
runningCount);
2969-
runningCount += paramsPerLevel.back();
2970-
} else {
2971-
// If there is no generic context, this is a non-generic type
2972-
// which has 0 generic parameters.
2973-
paramsPerLevel.emplace_back(0);
2974-
}
2962+
if (genericContext &&
2963+
(current->getKind() == ContextDescriptorKind::Class ||
2964+
current->getKind() == ContextDescriptorKind::Enum ||
2965+
current->getKind() == ContextDescriptorKind::Struct)) {
2966+
auto contextHeader = genericContext->getGenericContextHeader();
2967+
paramsPerLevel.emplace_back(contextHeader.NumParams - runningCount);
2968+
runningCount += paramsPerLevel.back();
29752969
}
29762970
};
29772971
countLevels(descriptor, runningCount);

include/swift/RemoteInspection/TypeRefBuilder.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -615,13 +615,9 @@ class TypeRefBuilder {
615615
break;
616616
}
617617
}
618-
if (parentNode) {
619-
if (shapeIndex > 0)
620-
parent = createBoundGenericTypeReconstructingParent(
621-
parentNode, decl, --shapeIndex, args, argsIndex + numGenericArgs);
622-
else
623-
return nullptr;
624-
}
618+
if (parentNode)
619+
parent = createBoundGenericTypeReconstructingParent(
620+
parentNode, decl, --shapeIndex, args, argsIndex + numGenericArgs);
625621
}
626622

627623
return BoundGenericTypeRef::create(*this, mangling.result(), genericParams,

0 commit comments

Comments
 (0)