Skip to content

Commit 40316ca

Browse files
authored
Merge pull request #20789 from DougGregor/remangle-old-ext-generic-args-5.0
[5.0] [Mangle] Include generic arguments of extensions for the Objective-C runtime
2 parents 27b3427 + 8452941 commit 40316ca

File tree

3 files changed

+48
-62
lines changed

3 files changed

+48
-62
lines changed

lib/Demangling/OldRemangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,11 @@ void Remangler::mangleGenericArgs(Node *node, EntityContext &ctx) {
18941894
break;
18951895
}
18961896

1897+
case Node::Kind::Extension: {
1898+
mangleGenericArgs(node->getChild(1), ctx);
1899+
break;
1900+
}
1901+
18971902
default:
18981903
break;
18991904
}

test/Demangle/remangle.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ RUN: diff %t.input %t.output
99
// CHECK: Swift.(Mystruct in _7B40D7ED6632C2BEA2CA3BFFD57E3435)
1010
RUN: swift-demangle -remangle-objc-rt '$ss8Mystruct33_7B40D7ED6632C2BEA2CA3BFFD57E3435LLV' | %FileCheck %s
1111

12+
// CHECK-GENERICEXT: Swift._ContiguousArrayStorage<(extension in Swift):Swift.FlattenSequence<StdlibCollectionUnittest.MinimalBidirectionalCollection<StdlibCollectionUnittest.MinimalBidirectionalCollection<Swift.Int>>>.Index>
13+
RUN: swift-demangle -remangle-objc-rt '$ss23_ContiguousArrayStorageCys15FlattenSequenceVsE5IndexVy24StdlibCollectionUnittest020MinimalBidirectionalH0VyAIySiGG_GGD' | %FileCheck -check-prefix CHECK-GENERICEXT %s
14+

validation-test/stdlib/Lazy.swift.gyb

Lines changed: 40 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,36 +1251,32 @@ do {
12511251
% for Traversal in 'Forward', 'Bidirectional':
12521252
% TraversalCollection = collectionForTraversal(Traversal)
12531253

1254-
// re-enable commented out test case below as well when this is fixed
1255-
// (find FIXME: rdar45956357)
1256-
if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
1257-
tests.test("FlattenCollection/${Traversal}/\(data)") {
1258-
let base = Minimal${TraversalCollection}(
1259-
elements: data.map { Minimal${TraversalCollection}(elements: $0) })
1260-
1261-
let flattened = base.joined()
1262-
check${Traversal}Collection(expected, flattened, resiliencyChecks: .none)
1263-
1264-
// Checking that flatten doesn't introduce laziness
1265-
var calls = 0
1266-
_ = flattened.map { _ in calls += 1 }
1267-
expectLE(
1268-
expected.count, calls,
1269-
"unexpected laziness in \(type(of: flattened))")
1270-
}
1271-
1272-
tests.test("FlattenCollection/${Traversal}/Lazy\(data)") {
1273-
// Checking that flatten doesn't remove laziness
1274-
let base = Minimal${TraversalCollection}(
1275-
elements: data.map { Minimal${TraversalCollection}(elements: $0) }
1276-
).lazy.map { $0 }
1277-
1278-
let flattened = base.joined()
1279-
1280-
var calls = 0
1281-
_ = flattened.map { _ in calls += 1 }
1282-
expectEqual(0, calls, "unexpected eagerness in \(type(of: flattened))")
1283-
}
1254+
tests.test("FlattenCollection/${Traversal}/\(data)") {
1255+
let base = Minimal${TraversalCollection}(
1256+
elements: data.map { Minimal${TraversalCollection}(elements: $0) })
1257+
1258+
let flattened = base.joined()
1259+
check${Traversal}Collection(expected, flattened, resiliencyChecks: .none)
1260+
1261+
// Checking that flatten doesn't introduce laziness
1262+
var calls = 0
1263+
_ = flattened.map { _ in calls += 1 }
1264+
expectLE(
1265+
expected.count, calls,
1266+
"unexpected laziness in \(type(of: flattened))")
1267+
}
1268+
1269+
tests.test("FlattenCollection/${Traversal}/Lazy\(data)") {
1270+
// Checking that flatten doesn't remove laziness
1271+
let base = Minimal${TraversalCollection}(
1272+
elements: data.map { Minimal${TraversalCollection}(elements: $0) }
1273+
).lazy.map { $0 }
1274+
1275+
let flattened = base.joined()
1276+
1277+
var calls = 0
1278+
_ = flattened.map { _ in calls += 1 }
1279+
expectEqual(0, calls, "unexpected eagerness in \(type(of: flattened))")
12841280
}
12851281
% end
12861282
}
@@ -1295,38 +1291,20 @@ struct TryFlattenIndex<C: Collection> where C.Element: Collection {
12951291

12961292
let prefixDropWhileTests: [(data: [Int], value: Int, pivot: Int)]
12971293

1298-
// FIXME: rdar45956357
1299-
if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
1300-
prefixDropWhileTests = [
1301-
([], 0, 0),
1302-
([0], 0, 0),
1303-
([0], 99, 1),
1304-
([0, 10], 0, 0),
1305-
([0, 10], 10, 1),
1306-
([0, 10], 99, 2),
1307-
([0, 10, 20, 30, 40], 0, 0),
1308-
([0, 10, 20, 30, 40], 10, 1),
1309-
([0, 10, 20, 30, 40], 20, 2),
1310-
([0, 10, 20, 30, 40], 30, 3),
1311-
([0, 10, 20, 30, 40], 40, 4),
1312-
([0, 10, 20, 30, 40], 99, 5)
1313-
]
1314-
} else {
1315-
prefixDropWhileTests = [
1316-
([], 0, 0),
1317-
([0], 0, 0),
1318-
// ([0], 99, 1),
1319-
([0, 10], 0, 0),
1320-
// ([0, 10], 10, 1),
1321-
// ([0, 10], 99, 2),
1322-
// ([0, 10, 20, 30, 40], 0, 0),
1323-
// ([0, 10, 20, 30, 40], 10, 1),
1324-
// ([0, 10, 20, 30, 40], 20, 2),
1325-
// ([0, 10, 20, 30, 40], 30, 3),
1326-
// ([0, 10, 20, 30, 40], 40, 4),
1327-
// ([0, 10, 20, 30, 40], 99, 5)
1328-
]
1329-
}
1294+
prefixDropWhileTests = [
1295+
([], 0, 0),
1296+
([0], 0, 0),
1297+
([0], 99, 1),
1298+
([0, 10], 0, 0),
1299+
([0, 10], 10, 1),
1300+
([0, 10], 99, 2),
1301+
([0, 10, 20, 30, 40], 0, 0),
1302+
([0, 10, 20, 30, 40], 10, 1),
1303+
([0, 10, 20, 30, 40], 20, 2),
1304+
([0, 10, 20, 30, 40], 30, 3),
1305+
([0, 10, 20, 30, 40], 40, 4),
1306+
([0, 10, 20, 30, 40], 99, 5)
1307+
]
13301308

13311309
% for Kind in 'Sequence', 'Forward', 'Bidirectional':
13321310
% Self = 'Sequence' if Kind == 'Sequence' else collectionForTraversal(Kind)

0 commit comments

Comments
 (0)