Skip to content

Commit 0243d9f

Browse files
committed
Swift: accept explicit any in existential type name
1 parent d9c4048 commit 0243d9f

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

swift/ql/integration-tests/posix-only/deduplication/Decls.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
| Sources/deduplication/def.swift:26:36:26:39 | _ | ParamDecl | A [GenericTypeParamType] |
4747
| Sources/deduplication/def.swift:26:42:26:45 | _ | ParamDecl | B [GenericTypeParamType] |
4848
| Sources/deduplication/def.swift:26:48:26:51 | _ | ParamDecl | C [GenericTypeParamType] |
49-
| Sources/deduplication/def.swift:28:1:28:21 | Protocol1 | ProtocolDecl | Protocol1.Protocol [MetatypeType] |
50-
| Sources/deduplication/def.swift:29:1:31:1 | Protocol2 | ProtocolDecl | Protocol2.Protocol [MetatypeType] |
49+
| Sources/deduplication/def.swift:28:1:28:21 | Protocol1 | ProtocolDecl | Protocol1.Type [MetatypeType] |
50+
| Sources/deduplication/def.swift:29:1:31:1 | Protocol2 | ProtocolDecl | Protocol2.Type [MetatypeType] |
5151
| Sources/deduplication/def.swift:30:5:30:20 | Associated | AssociatedTypeDecl | Self.Associated.Type [MetatypeType] |
5252
| Sources/deduplication/def.swift:32:1:32:14 | Class | ClassDecl | Class.Type [MetatypeType] |
5353
| Sources/deduplication/def.swift:32:7:32:7 | Class.deinit() | Deinitializer | (Class) -> () -> () [FunctionType] |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
| expressions.swift:15:11:15:11 | Int.Type | TypeExpr |
3232
| expressions.swift:15:14:15:14 | 0 | IntegerLiteralExpr |
3333
| expressions.swift:16:11:16:11 | AnError.Type | TypeExpr |
34-
| expressions.swift:16:11:16:19 | (Error) ... | ErasureExpr |
34+
| expressions.swift:16:11:16:19 | (any Error) ... | ErasureExpr |
3535
| expressions.swift:16:11:16:19 | .failed | MethodLookupExpr |
3636
| expressions.swift:16:19:16:19 | failed | DeclRefExpr |
3737
| expressions.swift:20:1:20:16 | try! ... | ForceTryExpr |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| implicit_conversions.swift:2:3:2:3 | (UnsafePointer<CChar>) ... | StringToPointerExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:2:3:2:3 | Hello |
22
| implicit_conversions.swift:4:16:4:16 | (Int?) ... | InjectIntoOptionalExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:4:16:4:16 | 42 |
3-
| implicit_conversions.swift:5:25:5:25 | (Equatable) ... | ErasureExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:5:25:5:25 | 42 |
3+
| implicit_conversions.swift:5:25:5:25 | (any Equatable) ... | ErasureExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:5:25:5:25 | 42 |
44
| implicit_conversions.swift:12:3:12:5 | (@lvalue (() -> Void)?) ... | AbiSafeConversionExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:12:3:12:5 | .b |
55
| implicit_conversions.swift:12:9:12:10 | ((() -> Void)?) ... | InjectIntoOptionalExpr | hasType: | yes | getSubExpr: | implicit_conversions.swift:12:9:12:10 | { ... } |
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
| implicit_conversions.swift:2:3:2:3 | (UnsafePointer<CChar>) ... | UnsafePointer<CChar> |
22
| implicit_conversions.swift:4:16:4:16 | (Int?) ... | Int? |
3-
| implicit_conversions.swift:5:25:5:25 | (Equatable) ... | Equatable |
3+
| implicit_conversions.swift:5:25:5:25 | (any Equatable) ... | any Equatable |
44
| implicit_conversions.swift:12:3:12:5 | (@lvalue (() -> Void)?) ... | @lvalue (() -> Void)? |
55
| implicit_conversions.swift:12:9:12:10 | ((() -> Void)?) ... | (() -> Void)? |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| ExplicitExistential | getName: | ExplicitExistential | getCanonicalType: | ExplicitExistential | getConstraint: | ExplicitExistential |
2-
| ImplicitExistential | getName: | ImplicitExistential | getCanonicalType: | ImplicitExistential | getConstraint: | ImplicitExistential |
3-
| P1 & P2 | getName: | P1 & P2 | getCanonicalType: | P1 & P2 | getConstraint: | P1 & P2 |
1+
| any ExplicitExistential | getName: | any ExplicitExistential | getCanonicalType: | any ExplicitExistential | getConstraint: | ExplicitExistential |
2+
| any ImplicitExistential | getName: | any ImplicitExistential | getCanonicalType: | any ImplicitExistential | getConstraint: | ImplicitExistential |
3+
| any P1 & P2 | getName: | any P1 & P2 | getCanonicalType: | any P1 & P2 | getConstraint: | P1 & P2 |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| C & P1 & P2 | getName: | C & P1 & P2 | getCanonicalType: | C & P1 & P2 | getInterfaceType: | \u03c4_0_0 | hasSuperclass: | yes | getNumberOfProtocols: | 2 |
1+
| any C & P1 & P2 | getName: | any C & P1 & P2 | getCanonicalType: | any C & P1 & P2 | getInterfaceType: | \u03c4_0_0 | hasSuperclass: | yes | getNumberOfProtocols: | 2 |
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| C & P1 & P2 | 0 | opened_archetypes.swift:3:1:3:14 | P1 |
2-
| C & P1 & P2 | 1 | opened_archetypes.swift:9:1:9:14 | P2 |
1+
| any C & P1 & P2 | 0 | opened_archetypes.swift:3:1:3:14 | P1 |
2+
| any C & P1 & P2 | 1 | opened_archetypes.swift:9:1:9:14 | P2 |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| C & P1 & P2 | C |
1+
| any C & P1 & P2 | C |

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ cfg.swift:
8888
# 19| getBase(): [TypeExpr] MyError.Type
8989
# 19| getTypeRepr(): [TypeRepr] MyError
9090
# 19| getMethodRef(): [DeclRefExpr] error1
91-
# 19| getSubExpr().getFullyConverted(): [ErasureExpr] (Error) ...
91+
# 19| getSubExpr().getFullyConverted(): [ErasureExpr] (any Error) ...
9292
# 21| getElement(1): [GuardStmt] guard ... else { ... }
9393
# 21| getCondition(): [StmtCondition] StmtCondition
9494
# 21| getElement(0): [ConditionElement] ... .<=(_:_:) ...
@@ -118,7 +118,7 @@ cfg.swift:
118118
# 22| getExpr(): [DeclRefExpr] x
119119
# 22| getArgument(1): [Argument] : 1
120120
# 22| getExpr(): [IntegerLiteralExpr] 1
121-
# 22| getSubExpr().getFullyConverted(): [ErasureExpr] (Error) ...
121+
# 22| getSubExpr().getFullyConverted(): [ErasureExpr] (any Error) ...
122122
# 26| [NamedFunction] tryCatch(x:)
123123
# 26| InterfaceType = (Int) -> Int
124124
# 26| getParam(0): [ParamDecl] x
@@ -205,7 +205,7 @@ cfg.swift:
205205
# 39| getPattern(): [NamedPattern] error
206206
# 39| getPattern().getFullyUnresolved(): [BindingPattern] let ...
207207
# 39| getVariable(0): [ConcreteVarDecl] error
208-
# 39| Type = Error
208+
# 39| Type = any Error
209209
# 39| getBody(): [BraceStmt] { ... }
210210
# 40| getElement(0): [CallExpr] call to print(_:separator:terminator:)
211211
# 40| getFunction(): [DeclRefExpr] print(_:separator:terminator:)
@@ -3412,15 +3412,15 @@ cfg.swift:
34123412
# 564| getBody(): [BraceStmt] { ... }
34133413
# 564| getElement(0): [ReturnStmt] return
34143414
# 568| [NamedFunction] getMyProtocol()
3415-
# 568| InterfaceType = () -> MyProtocol
3415+
# 568| InterfaceType = () -> any MyProtocol
34163416
# 568| getBody(): [BraceStmt] { ... }
34173417
# 568| getElement(0): [ReturnStmt] return ...
34183418
# 568| getResult(): [CallExpr] call to MyProcotolImpl.init()
34193419
# 568| getFunction(): [MethodLookupExpr] MyProcotolImpl.init()
34203420
# 568| getBase(): [TypeExpr] MyProcotolImpl.Type
34213421
# 568| getTypeRepr(): [TypeRepr] MyProcotolImpl
34223422
# 568| getMethodRef(): [DeclRefExpr] MyProcotolImpl.init()
3423-
# 568| getResult().getFullyConverted(): [ErasureExpr] (MyProtocol) ...
3423+
# 568| getResult().getFullyConverted(): [ErasureExpr] (any MyProtocol) ...
34243424
# 569| [NamedFunction] getMyProtocolImpl()
34253425
# 569| InterfaceType = () -> MyProcotolImpl
34263426
# 569| getBody(): [BraceStmt] { ... }
@@ -3436,9 +3436,9 @@ cfg.swift:
34363436
# 571| Type = Int
34373437
# 571| getBody(): [BraceStmt] { ... }
34383438
# 573| [NamedFunction] testOpenExistentialExpr(x:y:)
3439-
# 573| InterfaceType = (MyProtocol, MyProcotolImpl) -> ()
3439+
# 573| InterfaceType = (any MyProtocol, MyProcotolImpl) -> ()
34403440
# 573| getParam(0): [ParamDecl] x
3441-
# 573| Type = MyProtocol
3441+
# 573| Type = any MyProtocol
34423442
# 573| getParam(1): [ParamDecl] y
34433443
# 573| Type = MyProcotolImpl
34443444
# 573| getBody(): [BraceStmt] { ... }
@@ -4816,7 +4816,7 @@ expressions.swift:
48164816
# 16| getBase(): [TypeExpr] AnError.Type
48174817
# 16| getTypeRepr(): [TypeRepr] AnError
48184818
# 16| getMethodRef(): [DeclRefExpr] failed
4819-
# 16| getSubExpr().getFullyConverted(): [ErasureExpr] (Error) ...
4819+
# 16| getSubExpr().getFullyConverted(): [ErasureExpr] (any Error) ...
48204820
# 20| [TopLevelCodeDecl] { ... }
48214821
# 20| getBody(): [BraceStmt] { ... }
48224822
# 20| getElement(0): [ForceTryExpr] try! ...
@@ -6976,7 +6976,7 @@ statements.swift:
69766976
# 21| getPattern(): [NamedPattern] error
69776977
# 21| getPattern().getFullyUnresolved(): [BindingPattern] let ...
69786978
# 21| getVariable(0): [ConcreteVarDecl] error
6979-
# 21| Type = Error
6979+
# 21| Type = any Error
69806980
# 21| getBody(): [BraceStmt] { ... }
69816981
# 22| getElement(0): [CallExpr] call to print(_:separator:terminator:)
69826982
# 22| getFunction(): [DeclRefExpr] print(_:separator:terminator:)
@@ -7017,7 +7017,7 @@ statements.swift:
70177017
# 29| getPattern(): [NamedPattern] error
70187018
# 29| getPattern().getFullyUnresolved(): [BindingPattern] let ...
70197019
# 29| getVariable(0): [ConcreteVarDecl] error
7020-
# 29| Type = Error
7020+
# 29| Type = any Error
70217021
# 29| getBody(): [BraceStmt] { ... }
70227022
# 30| getElement(0): [CallExpr] call to print(_:separator:terminator:)
70237023
# 30| getFunction(): [DeclRefExpr] print(_:separator:terminator:)
@@ -7144,7 +7144,7 @@ statements.swift:
71447144
# 40| getBase(): [TypeExpr] AnError.Type
71457145
# 40| getTypeRepr(): [TypeRepr] AnError
71467146
# 40| getMethodRef(): [DeclRefExpr] failed
7147-
# 40| getSubExpr().getFullyConverted(): [ErasureExpr] (Error) ...
7147+
# 40| getSubExpr().getFullyConverted(): [ErasureExpr] (any Error) ...
71487148
# 44| [TopLevelCodeDecl] { ... }
71497149
# 44| getBody(): [BraceStmt] { ... }
71507150
# 44| getElement(0): [DeferStmt] defer { ... }

swift/ql/test/library-tests/elements/type/nominaltype/nominaltype.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
| nominaltype.swift:90:6:90:6 | b2 | B2 | getABaseType:A, getCanonicalType:B2, getFullName:B2, getName:B2, getUnderlyingType:B2 |
88
| nominaltype.swift:91:6:91:6 | b1_alias | B1_alias | getAliasedType:B1, getCanonicalType:B1, getFullName:B1_alias, getName:B1_alias, getUnderlyingType:B1 |
99
| nominaltype.swift:92:6:92:6 | b2_alias | B2_alias | getAliasedType:B2, getCanonicalType:B2, getFullName:B2_alias, getName:B2_alias, getUnderlyingType:B2 |
10-
| nominaltype.swift:93:6:93:6 | p | P | getCanonicalType:P, getFullName:P, getName:P, getUnderlyingType:P |
11-
| nominaltype.swift:94:6:94:6 | p_alias | P_alias | getCanonicalType:P, getFullName:P_alias, getName:P_alias, getUnderlyingType:P_alias |
10+
| nominaltype.swift:93:6:93:6 | p | any P | getCanonicalType:any P, getFullName:any P, getName:any P, getUnderlyingType:any P |
11+
| nominaltype.swift:94:6:94:6 | p_alias | any P_alias | getCanonicalType:any P, getFullName:any P_alias, getName:any P_alias, getUnderlyingType:any P_alias |
1212
| nominaltype.swift:95:6:95:6 | c1 | C1 | getABaseType:P, getCanonicalType:C1, getFullName:C1, getName:C1, getUnderlyingType:C1 |
1313
| nominaltype.swift:96:6:96:6 | c2 | C2 | getABaseType:P, getCanonicalType:C2, getFullName:C2, getName:C2, getUnderlyingType:C2 |
1414
| nominaltype.swift:97:6:97:6 | o | Outer | getCanonicalType:Outer, getFullName:Outer, getName:Outer, getUnderlyingType:Outer |
1515
| nominaltype.swift:98:6:98:6 | oi | Outer.Inner | getCanonicalType:Outer.Inner, getFullName:Outer.Inner, getName:Inner, getUnderlyingType:Outer.Inner |
1616
| nominaltype.swift:99:6:99:6 | oia | Outer.Inner.InnerAlias | getAliasedType:A, getCanonicalType:A, getFullName:Outer.Inner.InnerAlias, getName:InnerAlias, getUnderlyingType:A |
17-
| nominaltype.swift:100:6:100:6 | p1p2 | P1P2 | getCanonicalType:P1 & P2, getFullName:P1P2, getName:P1P2, getUnderlyingType:P1P2 |
17+
| nominaltype.swift:100:6:100:6 | p1p2 | any P1P2 | getCanonicalType:any P1 & P2, getFullName:any P1P2, getName:any P1P2, getUnderlyingType:any P1P2 |
1818
| nominaltype.swift:101:6:101:6 | boxInt | Box<A> | getCanonicalType:Box<A>, getFullName:Box<A>, getName:Box<A>, getUnderlyingType:Box<A> |
1919
| nominaltype.swift:102:6:102:6 | d1 | D1 | getABaseType:P3, getCanonicalType:D1, getFullName:D1, getName:D1, getUnderlyingType:D1 |
2020
| nominaltype.swift:103:6:103:6 | d2 | D2 | getABaseType:P4, getCanonicalType:D2, getFullName:D2, getName:D2, getUnderlyingType:D2 |

0 commit comments

Comments
 (0)