mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IRGen] Fix placeholder logic for emission of conditionally inverted protocols
rdar://153681688 Instead fo counting the actual conformances, the logic took the size of the bit field, i.e. used the highest set bit, so when a type had a conditional conformance only on ~Escapable, but not on ~Copyable, it would still add 2 placeholders, but only fill one.
This commit is contained in:
@@ -1394,12 +1394,13 @@ namespace {
|
||||
|
||||
// Create placeholders for the counts of the conditional requirements
|
||||
// for each conditional conformance to a supressible protocol.
|
||||
unsigned numProtocols = countBitsUsed(protocols.rawBits());
|
||||
unsigned numProtocols = 0;
|
||||
using PlaceholderPosition =
|
||||
ConstantAggregateBuilderBase::PlaceholderPosition;
|
||||
SmallVector<PlaceholderPosition, 2> countPlaceholders;
|
||||
for (unsigned i : range(0, numProtocols)) {
|
||||
(void)i;
|
||||
for (auto kind : protocols) {
|
||||
(void)kind;
|
||||
numProtocols++;
|
||||
countPlaceholders.push_back(
|
||||
B.addPlaceholderWithSize(IGM.Int16Ty));
|
||||
}
|
||||
|
||||
8
validation-test/IRGen/rdar153681688.swift
Normal file
8
validation-test/IRGen/rdar153681688.swift
Normal file
@@ -0,0 +1,8 @@
|
||||
// RUN: %target-swift-frontend %s -target %target-swift-5.9-abi-triple -emit-ir
|
||||
|
||||
public enum Enum<T : ~Escapable> : ~Escapable {
|
||||
case none
|
||||
case some(T)
|
||||
}
|
||||
|
||||
extension Enum: Escapable where T: Escapable {}
|
||||
Reference in New Issue
Block a user