Skip to content

Commit 497f0aa

Browse files
committed
Swift: sync test files and update expectation
1 parent ca722dc commit 497f0aa

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -3315,6 +3315,29 @@ cfg.swift:
33153315
# 539| getBody(): [BraceStmt] { ... }
33163316
# 539| getElement(0): [ReturnStmt] return ...
33173317
# 539| getResult(): [IntegerLiteralExpr] 0
3318+
# 542| [NamedFunction] testNilCoalescing2(x:)
3319+
# 542| InterfaceType = (Bool?) -> Int
3320+
# 542| getParam(0): [ParamDecl] x
3321+
# 542| Type = Bool?
3322+
# 542| getBody(): [BraceStmt] { ... }
3323+
# 543| getElement(0): [IfStmt] if ... then { ... } else { ... }
3324+
# 543| getCondition(): [StmtCondition] StmtCondition
3325+
# 543| getElement(0): [ConditionElement] ... ??(_:_:) ...
3326+
# 543| getBoolean(): [BinaryExpr] ... ??(_:_:) ...
3327+
# 543| getFunction(): [DeclRefExpr] ??(_:_:)
3328+
# 543| getArgument(0): [Argument] : x
3329+
# 543| getExpr(): [DeclRefExpr] x
3330+
# 543| getArgument(1): [Argument] : { ... }
3331+
# 543| getExpr(): [AutoClosureExpr] { ... }
3332+
# 543| getBody(): [BraceStmt] { ... }
3333+
# 543| getElement(0): [ReturnStmt] return ...
3334+
# 543| getResult(): [BooleanLiteralExpr] false
3335+
# 543| getThen(): [BraceStmt] { ... }
3336+
# 544| getElement(0): [ReturnStmt] return ...
3337+
# 544| getResult(): [IntegerLiteralExpr] 1
3338+
# 545| getElse(): [BraceStmt] { ... }
3339+
# 546| getElement(0): [ReturnStmt] return ...
3340+
# 546| getResult(): [IntegerLiteralExpr] 0
33183341
declarations.swift:
33193342
# 1| [StructDecl] Foo
33203343
# 2| getMember(0): [PatternBindingDecl] var ... = ...

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

+8
Original file line numberDiff line numberDiff line change
@@ -538,3 +538,11 @@ func testAsyncFor () async {
538538
func testNilCoalescing(x: Int?) -> Int {
539539
return x ?? 0
540540
}
541+
542+
func testNilCoalescing2(x: Bool?) -> Int {
543+
if x ?? false {
544+
return 1
545+
} else {
546+
return 0
547+
}
548+
}

0 commit comments

Comments
 (0)