File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Sources/SymbolKit/SymbolGraph/Symbol/Swift
Tests/SymbolKitTests/SymbolGraph/Symbol/Swift Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 11/*
22 This source file is part of the Swift.org open source project
33
4- Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+ Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55 Licensed under Apache License v2.0 with Runtime Library Exception
66
77 See https://swift.org/LICENSE.txt for license information
@@ -46,6 +46,17 @@ extension SymbolGraph.Symbol.Swift {
4646 ```
4747 */
4848 case sameType
49+
50+ /**
51+ A same-shape constraint, such as:
52+
53+ ```swift
54+ public func function<each Element0, each Element1>(
55+ _: (repeat (each Element0, each Element1))
56+ ) { }
57+ ```
58+ */
59+ case sameShape
4960 }
5061
5162 enum CodingKeys : String , CodingKey {
Original file line number Diff line number Diff line change 11/*
22 This source file is part of the Swift.org open source project
33
4- Copyright (c) 2023 Apple Inc. and the Swift project authors
4+ Copyright (c) 2023-2025 Apple Inc. and the Swift project authors
55 Licensed under Apache License v2.0 with Runtime Library Exception
66
77 See https://swift.org/LICENSE.txt for license information
@@ -66,4 +66,22 @@ class GenericConstraintTests: XCTestCase {
6666 )
6767 XCTAssertEqual ( jsonConstraint, constraint)
6868 }
69+
70+ func testInitializeSameShape( ) throws {
71+ let jsonString = """
72+ {
73+ " kind " : " sameShape " ,
74+ " lhs " : " T1 " ,
75+ " rhs " : " T2 " ,
76+ }
77+ """
78+ let jsonData = Data ( jsonString. utf8)
79+ let jsonConstraint = try JSONDecoder ( ) . decode ( SymbolGraph . Symbol. Swift. GenericConstraint. self, from: jsonData)
80+ let constraint = SymbolGraph . Symbol. Swift. GenericConstraint (
81+ kind: . sameShape,
82+ leftTypeName: " T1 " ,
83+ rightTypeName: " T2 "
84+ )
85+ XCTAssertEqual ( jsonConstraint, constraint)
86+ }
6987}
You can’t perform that action at this time.
0 commit comments