Skip to content

Commit 281cd79

Browse files
committed
Swift: add generics to ast tests
1 parent c0f477e commit 281cd79

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

swift/ql/test/extractor-tests/declarations/all.expected

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,23 @@
235235
| declarations.swift:139:3:141:3 | id() |
236236
| declarations.swift:139:8:139:8 | self |
237237
| declarations.swift:144:1:144:7 | { ... } |
238+
| declarations.swift:146:1:148:1 | GenericClass |
239+
| declarations.swift:146:7:146:7 | deinit() |
240+
| declarations.swift:146:7:146:7 | init() |
241+
| declarations.swift:146:7:146:7 | self |
242+
| declarations.swift:146:7:146:7 | self |
243+
| declarations.swift:146:20:146:20 | A |
244+
| declarations.swift:146:23:146:26 | B |
245+
| declarations.swift:146:31:146:34 | C |
246+
| declarations.swift:147:3:147:41 | genericMethod(_:_:_:) |
247+
| declarations.swift:147:8:147:8 | self |
248+
| declarations.swift:147:22:147:25 | _ |
249+
| declarations.swift:147:28:147:31 | _ |
250+
| declarations.swift:147:34:147:37 | _ |
251+
| declarations.swift:150:1:150:63 | genericFunc(_:_:_:) |
252+
| declarations.swift:150:18:150:18 | A |
253+
| declarations.swift:150:21:150:24 | B |
254+
| declarations.swift:150:29:150:32 | C |
255+
| declarations.swift:150:44:150:47 | _ |
256+
| declarations.swift:150:50:150:53 | _ |
257+
| declarations.swift:150:56:150:59 | _ |

swift/ql/test/extractor-tests/declarations/declarations.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,8 @@ extension Int {
143143

144144
42.id()
145145

146+
class GenericClass<A, B: Baz, C: MyProtocol> {
147+
func genericMethod(_: A, _: B, _: C) {}
148+
}
149+
150+
func genericFunc<A, B: Baz, C: MyProtocol>(_: A, _: B, _: C) {}

swift/ql/test/library-tests/ast/PrintAst.expected

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,31 @@ declarations.swift:
452452
# 144| getElement(0): [CallExpr] call to id()
453453
# 144| getFunction(): [MethodRefExpr] .id()
454454
# 144| getBase(): [IntegerLiteralExpr] 42
455+
# 146| [ClassDecl] GenericClass
456+
# 146| getGenericTypeParam(0): [GenericTypeParamDecl] A
457+
# 146| getGenericTypeParam(1): [GenericTypeParamDecl] B
458+
# 146| getGenericTypeParam(2): [GenericTypeParamDecl] C
459+
# 147| getMember(0): [ConcreteFuncDecl] genericMethod(_:_:_:)
460+
# 147| getSelfParam(): [ParamDecl] self
461+
# 147| getParam(0): [ParamDecl] _
462+
# 147| getParam(1): [ParamDecl] _
463+
# 147| getParam(2): [ParamDecl] _
464+
# 147| getBody(): [BraceStmt] { ... }
465+
# 146| getMember(1): [DestructorDecl] deinit()
466+
# 146| getSelfParam(): [ParamDecl] self
467+
# 146| getBody(): [BraceStmt] { ... }
468+
# 146| getMember(2): [ConstructorDecl] init()
469+
# 146| getSelfParam(): [ParamDecl] self
470+
# 146| getBody(): [BraceStmt] { ... }
471+
# 146| getElement(0): [ReturnStmt] return
472+
# 150| [ConcreteFuncDecl] genericFunc(_:_:_:)
473+
# 150| getGenericTypeParam(0): [GenericTypeParamDecl] A
474+
# 150| getGenericTypeParam(1): [GenericTypeParamDecl] B
475+
# 150| getGenericTypeParam(2): [GenericTypeParamDecl] C
476+
# 150| getParam(0): [ParamDecl] _
477+
# 150| getParam(1): [ParamDecl] _
478+
# 150| getParam(2): [ParamDecl] _
479+
# 150| getBody(): [BraceStmt] { ... }
455480
expressions.swift:
456481
# 1| [TopLevelCodeDecl] { ... }
457482
# 1| getBody(): [BraceStmt] { ... }

swift/ql/test/library-tests/ast/declarations.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,8 @@ extension Int {
143143

144144
42.id()
145145

146+
class GenericClass<A, B: Baz, C: MyProtocol> {
147+
func genericMethod(_: A, _: B, _: C) {}
148+
}
149+
150+
func genericFunc<A, B: Baz, C: MyProtocol>(_: A, _: B, _: C) {}

0 commit comments

Comments
 (0)