File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed
swift/ql/test/library-tests Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -3300,6 +3300,21 @@ cfg.swift:
3300
3300
# 526| Type = Int
3301
3301
# 533| [ConcreteVarDecl] i
3302
3302
# 533| Type = Int
3303
+ # 538| [NamedFunction] testNilCoalescing(x:)
3304
+ # 538| InterfaceType = (Int?) -> Int
3305
+ # 538| getParam(0): [ParamDecl] x
3306
+ # 538| Type = Int?
3307
+ # 538| getBody(): [BraceStmt] { ... }
3308
+ # 539| getElement(0): [ReturnStmt] return ...
3309
+ # 539| getResult(): [BinaryExpr] ... ??(_:_:) ...
3310
+ # 539| getFunction(): [DeclRefExpr] ??(_:_:)
3311
+ # 539| getArgument(0): [Argument] : x
3312
+ # 539| getExpr(): [DeclRefExpr] x
3313
+ # 539| getArgument(1): [Argument] : { ... }
3314
+ # 539| getExpr(): [AutoClosureExpr] { ... }
3315
+ # 539| getBody(): [BraceStmt] { ... }
3316
+ # 539| getElement(0): [ReturnStmt] return ...
3317
+ # 539| getResult(): [IntegerLiteralExpr] 0
3303
3318
declarations.swift:
3304
3319
# 1| [StructDecl] Foo
3305
3320
# 2| getMember(0): [PatternBindingDecl] var ... = ...
Original file line number Diff line number Diff line change @@ -534,3 +534,7 @@ func testAsyncFor () async {
534
534
print ( i)
535
535
}
536
536
}
537
+
538
+ func testNilCoalescing( x: Int ? ) -> Int {
539
+ return x ?? 0
540
+ }
Original file line number Diff line number Diff line change @@ -6180,3 +6180,36 @@ cfg.swift:
6180
6180
6181
6181
# 534| i
6182
6182
#-----| -> (Any) ...
6183
+
6184
+ # 538| enter testNilCoalescing(x:)
6185
+ #-----| -> testNilCoalescing(x:)
6186
+
6187
+ # 538| exit testNilCoalescing(x:)
6188
+
6189
+ # 538| exit testNilCoalescing(x:) (abnormal)
6190
+ #-----| -> exit testNilCoalescing(x:)
6191
+
6192
+ # 538| exit testNilCoalescing(x:) (normal)
6193
+ #-----| -> exit testNilCoalescing(x:)
6194
+
6195
+ # 538| testNilCoalescing(x:)
6196
+ #-----| -> x
6197
+
6198
+ # 538| x
6199
+ #-----| -> ??(_:_:)
6200
+
6201
+ # 539| return ...
6202
+ #-----| return -> exit testNilCoalescing(x:) (normal)
6203
+
6204
+ # 539| x
6205
+ #-----| -> { ... }
6206
+
6207
+ # 539| ... ??(_:_:) ...
6208
+ #-----| exception -> exit testNilCoalescing(x:) (abnormal)
6209
+ #-----| -> return ...
6210
+
6211
+ # 539| ??(_:_:)
6212
+ #-----| -> x
6213
+
6214
+ # 539| { ... }
6215
+ #-----| -> ... ??(_:_:) ...
Original file line number Diff line number Diff line change @@ -534,3 +534,7 @@ func testAsyncFor () async {
534
534
print ( i)
535
535
}
536
536
}
537
+
538
+ func testNilCoalescing( x: Int ? ) -> Int {
539
+ return x ?? 0
540
+ }
You can’t perform that action at this time.
0 commit comments