Skip to content

Commit 8624098

Browse files
committed
Swift: sync identical files.
1 parent eda331e commit 8624098

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,6 +3071,107 @@ cfg.swift:
30713071
# 489| getElement(7): [IntegerLiteralExpr] 11
30723072
# 490| getElement(8): [IntegerLiteralExpr] 12
30733073
# 493| getElement(9): [IntegerLiteralExpr] 13
3074+
# 496| [ConcreteFuncDecl] testAvailable()
3075+
# 496| InterfaceType = () -> Int
3076+
# 496| getBody(): [BraceStmt] { ... }
3077+
# 497| getElement(0): [PatternBindingDecl] var ... = ...
3078+
# 497| getInit(0): [IntegerLiteralExpr] 0
3079+
# 497| getPattern(0): [NamedPattern] x
3080+
# 497| getElement(1): [ConcreteVarDecl] x
3081+
# 497| Type = Int
3082+
# 499| getElement(2): [IfStmt] if ... then { ... }
3083+
# 499| getCondition(): [StmtCondition] StmtCondition
3084+
# 499| getElement(0): [ConditionElement] #available
3085+
# 499| getAvailability(): [AvailabilityInfo] #available
3086+
# 499| getSpec(0): [PlatformVersionAvailabilitySpec] macOS 10
3087+
# 499| getSpec(1): [OtherAvailabilitySpec] *
3088+
# 499| getThen(): [BraceStmt] { ... }
3089+
# 500| getElement(0): [BinaryExpr] ... .+=(_:_:) ...
3090+
# 500| getFunction(): [MethodLookupExpr] .+=(_:_:)
3091+
# 500| getBase(): [TypeExpr] Int.Type
3092+
# 500| getTypeRepr(): [TypeRepr] Int
3093+
# 500| getMethodRef(): [DeclRefExpr] +=(_:_:)
3094+
# 500| getArgument(0): [Argument] : &...
3095+
# 500| getExpr(): [InOutExpr] &...
3096+
# 500| getSubExpr(): [DeclRefExpr] x
3097+
# 500| getArgument(1): [Argument] : 1
3098+
# 500| getExpr(): [IntegerLiteralExpr] 1
3099+
# 503| getElement(3): [IfStmt] if ... then { ... }
3100+
# 503| getCondition(): [StmtCondition] StmtCondition
3101+
# 503| getElement(0): [ConditionElement] #available
3102+
# 503| getAvailability(): [AvailabilityInfo] #available
3103+
# 503| getSpec(0): [PlatformVersionAvailabilitySpec] macOS 10.13
3104+
# 503| getSpec(1): [OtherAvailabilitySpec] *
3105+
# 503| getThen(): [BraceStmt] { ... }
3106+
# 504| getElement(0): [BinaryExpr] ... .+=(_:_:) ...
3107+
# 504| getFunction(): [MethodLookupExpr] .+=(_:_:)
3108+
# 504| getBase(): [TypeExpr] Int.Type
3109+
# 504| getTypeRepr(): [TypeRepr] Int
3110+
# 504| getMethodRef(): [DeclRefExpr] +=(_:_:)
3111+
# 504| getArgument(0): [Argument] : &...
3112+
# 504| getExpr(): [InOutExpr] &...
3113+
# 504| getSubExpr(): [DeclRefExpr] x
3114+
# 504| getArgument(1): [Argument] : 1
3115+
# 504| getExpr(): [IntegerLiteralExpr] 1
3116+
# 507| getElement(4): [IfStmt] if ... then { ... }
3117+
# 507| getCondition(): [StmtCondition] StmtCondition
3118+
# 507| getElement(0): [ConditionElement] #unavailable
3119+
# 507| getAvailability(): [AvailabilityInfo] #unavailable
3120+
# 507| getSpec(0): [PlatformVersionAvailabilitySpec] iOS 10
3121+
# 507| getSpec(1): [PlatformVersionAvailabilitySpec] watchOS 10
3122+
# 507| getSpec(2): [PlatformVersionAvailabilitySpec] macOS 10
3123+
# 507| getThen(): [BraceStmt] { ... }
3124+
# 508| getElement(0): [BinaryExpr] ... .+=(_:_:) ...
3125+
# 508| getFunction(): [MethodLookupExpr] .+=(_:_:)
3126+
# 508| getBase(): [TypeExpr] Int.Type
3127+
# 508| getTypeRepr(): [TypeRepr] Int
3128+
# 508| getMethodRef(): [DeclRefExpr] +=(_:_:)
3129+
# 508| getArgument(0): [Argument] : &...
3130+
# 508| getExpr(): [InOutExpr] &...
3131+
# 508| getSubExpr(): [DeclRefExpr] x
3132+
# 508| getArgument(1): [Argument] : 1
3133+
# 508| getExpr(): [IntegerLiteralExpr] 1
3134+
# 511| getElement(5): [GuardStmt] guard ... else { ... }
3135+
# 511| getCondition(): [StmtCondition] StmtCondition
3136+
# 511| getElement(0): [ConditionElement] #available
3137+
# 511| getAvailability(): [AvailabilityInfo] #available
3138+
# 511| getSpec(0): [PlatformVersionAvailabilitySpec] macOS 12
3139+
# 511| getSpec(1): [OtherAvailabilitySpec] *
3140+
# 511| getBody(): [BraceStmt] { ... }
3141+
# 512| getElement(0): [BinaryExpr] ... .+=(_:_:) ...
3142+
# 512| getFunction(): [MethodLookupExpr] .+=(_:_:)
3143+
# 512| getBase(): [TypeExpr] Int.Type
3144+
# 512| getTypeRepr(): [TypeRepr] Int
3145+
# 512| getMethodRef(): [DeclRefExpr] +=(_:_:)
3146+
# 512| getArgument(0): [Argument] : &...
3147+
# 512| getExpr(): [InOutExpr] &...
3148+
# 512| getSubExpr(): [DeclRefExpr] x
3149+
# 512| getArgument(1): [Argument] : 1
3150+
# 512| getExpr(): [IntegerLiteralExpr] 1
3151+
# 515| getElement(6): [IfStmt] if ... then { ... }
3152+
# 515| getCondition(): [StmtCondition] StmtCondition
3153+
# 515| getElement(0): [ConditionElement] #available
3154+
# 515| getAvailability(): [AvailabilityInfo] #available
3155+
# 515| getSpec(0): [PlatformVersionAvailabilitySpec] macOS 12
3156+
# 515| getSpec(1): [OtherAvailabilitySpec] *
3157+
# 515| getElement(1): [ConditionElement] #available
3158+
# 515| getAvailability(): [AvailabilityInfo] #available
3159+
# 515| getSpec(0): [PlatformVersionAvailabilitySpec] iOS 12
3160+
# 515| getSpec(1): [OtherAvailabilitySpec] *
3161+
# 515| getThen(): [BraceStmt] { ... }
3162+
# 516| getElement(0): [BinaryExpr] ... .+=(_:_:) ...
3163+
# 516| getFunction(): [MethodLookupExpr] .+=(_:_:)
3164+
# 516| getBase(): [TypeExpr] Int.Type
3165+
# 516| getTypeRepr(): [TypeRepr] Int
3166+
# 516| getMethodRef(): [DeclRefExpr] +=(_:_:)
3167+
# 516| getArgument(0): [Argument] : &...
3168+
# 516| getExpr(): [InOutExpr] &...
3169+
# 516| getSubExpr(): [DeclRefExpr] x
3170+
# 516| getArgument(1): [Argument] : 1
3171+
# 516| getExpr(): [IntegerLiteralExpr] 1
3172+
# 519| getElement(7): [ReturnStmt] return ...
3173+
# 519| getResult(): [DeclRefExpr] x
3174+
# 519| getResult().getFullyConverted(): [LoadExpr] (Int) ...
30743175
declarations.swift:
30753176
# 1| [StructDecl] Foo
30763177
# 2| getMember(0): [PatternBindingDecl] var ... = ...

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,3 +492,29 @@ func testIfConfig() {
492492

493493
13
494494
}
495+
496+
func testAvailable() -> Int {
497+
var x = 0;
498+
499+
if #available(macOS 10, *) {
500+
x += 1
501+
}
502+
503+
if #available(macOS 10.13, *) {
504+
x += 1
505+
}
506+
507+
if #unavailable(iOS 10, watchOS 10, macOS 10) {
508+
x += 1
509+
}
510+
511+
guard #available(macOS 12, *) else {
512+
x += 1
513+
}
514+
515+
if #available(macOS 12, *), #available(iOS 12, *) {
516+
x += 1
517+
}
518+
519+
return x
520+
}

0 commit comments

Comments
 (0)