@@ -1368,7 +1368,7 @@ class PathHierarchyTests: XCTestCase {
1368
1368
return PathHierarchy . functionSignatureTypeNames ( for: SymbolGraph . Symbol (
1369
1369
identifier: SymbolGraph . Symbol. Identifier ( precise: " some-symbol-id " , interfaceLanguage: SourceLanguage . swift. id) ,
1370
1370
names: . init( title: " SymbolName " , navigator: nil , subHeading: nil , prose: nil ) ,
1371
- pathComponents: [ " SymbolName " ] , docComment: nil , accessLevel: . public, kind: . init( parsedIdentifier: . class, displayName: " Kind Display NAme " ) , mixins: [
1371
+ pathComponents: [ " SymbolName " ] , docComment: nil , accessLevel: . public, kind: . init( parsedIdentifier: . class, displayName: " Kind Display Name " ) , mixins: [
1372
1372
SymbolGraph . Symbol. FunctionSignature. mixinKey: SymbolGraph . Symbol. FunctionSignature (
1373
1373
parameters: [
1374
1374
. init( name: " someName " , externalName: " with " , declarationFragments: [
@@ -1418,6 +1418,30 @@ class PathHierarchyTests: XCTestCase {
1418
1418
. init( kind: . text, spelling: " > " , preciseIdentifier: nil ) ,
1419
1419
] ) )
1420
1420
1421
+ // any Sequence<Int>
1422
+ // The Swift symbol graph extractor emits `any` differently than `some` (rdar://142814138).
1423
+ XCTAssertEqual ( " Sequence<Int> " , functionSignatureParameterTypeName ( [
1424
+ . init( kind: . text, spelling: " any " , preciseIdentifier: nil ) ,
1425
+ . init( kind: . typeIdentifier, spelling: " Sequence " , preciseIdentifier: " s:ST " ) ,
1426
+ . init( kind: . text, spelling: " < " , preciseIdentifier: nil ) ,
1427
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1428
+ . init( kind: . text, spelling: " > " , preciseIdentifier: nil ) ,
1429
+ ] ) )
1430
+
1431
+ // (Int, String)
1432
+ // Swift _does_ support overloading by tuple labels but we don't include tuple labels in the type disambiguation because it would be
1433
+ // longer and harder to read/write in the common case when the other overloads aren't tuples with the same types but different labels.
1434
+ // In the rare case of actual overloads only distinguishable by tuple labels they would all require hash disambiguation instead.
1435
+ XCTAssertEqual ( " (Int,String) " , functionSignatureParameterTypeName ( [
1436
+ . init( kind: . text, spelling: " (number " , preciseIdentifier: nil ) ,
1437
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1438
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1439
+ . init( kind: . text, spelling: " , text " , preciseIdentifier: nil ) ,
1440
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1441
+ . init( kind: . typeIdentifier, spelling: " String " , preciseIdentifier: " s:SS " ) ,
1442
+ . init( kind: . text, spelling: " ) " , preciseIdentifier: nil ) ,
1443
+ ] ) )
1444
+
1421
1445
// Array<(Int,Double)>
1422
1446
XCTAssertEqual ( " [(Int,Double)] " , functionSignatureParameterTypeName ( [
1423
1447
. init( kind: . typeIdentifier, spelling: " Array " , preciseIdentifier: " s:Sa " ) ,
@@ -1472,6 +1496,52 @@ class PathHierarchyTests: XCTestCase {
1472
1496
. init( kind: . text, spelling: " > " , preciseIdentifier: nil ) ,
1473
1497
] ) )
1474
1498
1499
+ // [[Double: Int]]
1500
+ XCTAssertEqual ( " [[Double:Int]] " , functionSignatureParameterTypeName ( [
1501
+ . init( kind: . text, spelling: " [[ " , preciseIdentifier: nil ) ,
1502
+ . init( kind: . typeIdentifier, spelling: " Double " , preciseIdentifier: " s:Sd " ) ,
1503
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1504
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1505
+ . init( kind: . text, spelling: " ]] " , preciseIdentifier: nil ) ,
1506
+ ] ) )
1507
+
1508
+ // [ ([Int]?) : Int]
1509
+ XCTAssertEqual ( " [([Int]?):Int] " , functionSignatureParameterTypeName ( [
1510
+ . init( kind: . text, spelling: " [ ([ " , preciseIdentifier: nil ) ,
1511
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1512
+ . init( kind: . text, spelling: " ]?) : " , preciseIdentifier: nil ) ,
1513
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1514
+ . init( kind: . text, spelling: " ] " , preciseIdentifier: nil ) ,
1515
+ ] ) )
1516
+
1517
+ // [Array<(_: Int)>: (number: Int, text: String)]
1518
+ XCTAssertEqual ( " [[(Int)]:(Int,String)] " , functionSignatureParameterTypeName ( [
1519
+ . init( kind: . text, spelling: " [ " , preciseIdentifier: nil ) ,
1520
+ . init( kind: . typeIdentifier, spelling: " Array " , preciseIdentifier: " s:Sa " ) ,
1521
+ . init( kind: . text, spelling: " <(_: " , preciseIdentifier: nil ) ,
1522
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1523
+ . init( kind: . text, spelling: " )>: (number " , preciseIdentifier: nil ) ,
1524
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1525
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1526
+ . init( kind: . text, spelling: " , text " , preciseIdentifier: nil ) ,
1527
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1528
+ . init( kind: . typeIdentifier, spelling: " String " , preciseIdentifier: " s:SS " ) ,
1529
+ . init( kind: . text, spelling: " )] " , preciseIdentifier: nil ) ,
1530
+ ] ) )
1531
+
1532
+ // [[Int: Int] : [Int: Int]]
1533
+ XCTAssertEqual ( " [[Int:Int]:[Int:Int]] " , functionSignatureParameterTypeName ( [
1534
+ . init( kind: . text, spelling: " [[ " , preciseIdentifier: nil ) ,
1535
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1536
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1537
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1538
+ . init( kind: . text, spelling: " ] : [ " , preciseIdentifier: nil ) ,
1539
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1540
+ . init( kind: . text, spelling: " : " , preciseIdentifier: nil ) ,
1541
+ . init( kind: . typeIdentifier, spelling: " Int " , preciseIdentifier: " s:Si " ) ,
1542
+ . init( kind: . text, spelling: " ]] " , preciseIdentifier: nil ) ,
1543
+ ] ) )
1544
+
1475
1545
// (Dictionary<Double,Int>)->Array<String>
1476
1546
XCTAssertEqual ( " ([Double:Int])->[String] " , functionSignatureParameterTypeName ( [
1477
1547
. init( kind: . text, spelling: " ( " , preciseIdentifier: nil ) ,
0 commit comments