Skip to content

Commit 16e6e88

Browse files
committed
Swift: tests for pattern types
1 parent ade4809 commit 16e6e88

File tree

2 files changed

+210
-0
lines changed

2 files changed

+210
-0
lines changed
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
| patterns.swift:2:9:2:9 | an_int | Int |
2+
| patterns.swift:3:9:3:9 | a_string | String |
3+
| patterns.swift:3:9:3:19 | ... as ... | String |
4+
| patterns.swift:4:9:4:17 | (...) | (Int, Int, Int) |
5+
| patterns.swift:4:10:4:10 | x | Int |
6+
| patterns.swift:4:13:4:13 | y | Int |
7+
| patterns.swift:4:16:4:16 | z | Int |
8+
| patterns.swift:5:9:5:9 | _ | String |
9+
| patterns.swift:6:9:6:11 | (...) | String |
10+
| patterns.swift:6:10:6:10 | _ | String |
11+
| patterns.swift:10:9:10:9 | point | (Int, Int) |
12+
| patterns.swift:12:10:12:21 | let ... | (Int, Int) |
13+
| patterns.swift:12:14:12:21 | (...) | (Int, Int) |
14+
| patterns.swift:12:15:12:15 | xx | Int |
15+
| patterns.swift:12:19:12:19 | yy | Int |
16+
| patterns.swift:16:10:16:14 | =~ ... | Int |
17+
| patterns.swift:17:10:17:10 | _ | Int |
18+
| patterns.swift:24:9:24:9 | v | Foo |
19+
| patterns.swift:24:9:24:12 | ... as ... | Foo |
20+
| patterns.swift:27:10:27:11 | .bar | Foo |
21+
| patterns.swift:28:10:28:23 | let ... | Foo |
22+
| patterns.swift:28:14:28:23 | .baz(...) | Foo |
23+
| patterns.swift:28:18:28:23 | (...) | (Int, String) |
24+
| patterns.swift:28:19:28:19 | i | Int |
25+
| patterns.swift:28:22:28:22 | s | String |
26+
| patterns.swift:31:9:31:9 | w | Int? |
27+
| patterns.swift:31:9:31:15 | ... as ... | Int? |
28+
| patterns.swift:34:10:34:15 | let ... | Int? |
29+
| patterns.swift:34:14:34:14 | n | Int |
30+
| patterns.swift:34:14:34:15 | let ...? | Int? |
31+
| patterns.swift:35:10:35:10 | _ | Int? |
32+
| patterns.swift:38:9:38:9 | a | Any |
33+
| patterns.swift:38:9:38:12 | ... as ... | Any |
34+
| patterns.swift:41:10:41:13 | ... is ... | Any |
35+
| patterns.swift:42:10:42:19 | let ... | Any |
36+
| patterns.swift:42:14:42:14 | x | String |
37+
| patterns.swift:42:14:42:19 | ... is ... | Any |
38+
| patterns.swift:43:10:43:10 | _ | Any |
39+
| patterns.swift:46:9:46:9 | b | Bool |
40+
| patterns.swift:49:10:49:10 | true | Bool |
41+
| patterns.swift:50:10:50:10 | false | Bool |
42+
| patterns.swift:55:9:55:9 | a | Int |
43+
| patterns.swift:55:16:55:16 | b | Int |
44+
| patterns.swift:55:23:55:23 | c | Int |
45+
| patterns.swift:55:23:55:26 | ... as ... | Int |
46+
| patterns.swift:57:8:57:20 | let ... | (Int, Int, Int) |
47+
| patterns.swift:57:8:57:20 | let ...? | (Int, Int, Int)? |
48+
| patterns.swift:57:12:57:20 | (...) | (Int, Int, Int) |
49+
| patterns.swift:57:13:57:13 | a | Int |
50+
| patterns.swift:57:16:57:16 | b | Int |
51+
| patterns.swift:57:19:57:19 | c | Int |
52+
| patterns.swift:58:13:58:29 | (...) | (Int, Int, Int) |
53+
| patterns.swift:58:14:58:14 | =~ ... | Int |
54+
| patterns.swift:58:17:58:21 | let ... | Int |
55+
| patterns.swift:58:21:58:21 | b | Int |
56+
| patterns.swift:58:24:58:28 | let ... | Int |
57+
| patterns.swift:58:28:58:28 | c | Int |
58+
| patterns.swift:61:14:61:14 | =~ ... | Int |
59+
| patterns.swift:62:14:62:18 | let ... | Int |
60+
| patterns.swift:62:18:62:18 | c | Int |
61+
| patterns.swift:63:9:63:9 | _ | Int |
62+
| patterns.swift:78:9:78:9 | a | MyEnum |
63+
| patterns.swift:78:9:78:13 | ... as ... | MyEnum |
64+
| patterns.swift:81:10:81:11 | .myNone | MyEnum |
65+
| patterns.swift:83:10:83:25 | .mySingle(...) | MyEnum |
66+
| patterns.swift:83:19:83:25 | (...) | (Int) |
67+
| patterns.swift:83:20:83:24 | let ... | (Int) |
68+
| patterns.swift:83:24:83:24 | a | (Int) |
69+
| patterns.swift:85:10:85:30 | .myPair(...) | MyEnum |
70+
| patterns.swift:85:17:85:30 | (...) | (Int, Int) |
71+
| patterns.swift:85:18:85:22 | let ... | Int |
72+
| patterns.swift:85:22:85:22 | a | Int |
73+
| patterns.swift:85:25:85:29 | let ... | Int |
74+
| patterns.swift:85:29:85:29 | b | Int |
75+
| patterns.swift:88:10:88:26 | let ... | MyEnum |
76+
| patterns.swift:88:14:88:26 | .myCons(...) | MyEnum |
77+
| patterns.swift:88:21:88:26 | (...) | (Int, MyEnum) |
78+
| patterns.swift:88:22:88:22 | a | Int |
79+
| patterns.swift:88:25:88:25 | _ | MyEnum |
80+
| patterns.swift:92:13:92:28 | .mySingle(...) | MyEnum |
81+
| patterns.swift:92:22:92:28 | (...) | (Int) |
82+
| patterns.swift:92:23:92:27 | let ... | (Int) |
83+
| patterns.swift:92:27:92:27 | x | (Int) |
84+
| patterns.swift:95:13:95:33 | .myPair(...) | MyEnum |
85+
| patterns.swift:95:20:95:33 | (...) | (Int, Int) |
86+
| patterns.swift:95:21:95:25 | let ... | Int |
87+
| patterns.swift:95:25:95:25 | x | Int |
88+
| patterns.swift:95:28:95:32 | let ... | Int |
89+
| patterns.swift:95:32:95:32 | y | Int |
90+
| patterns.swift:103:10:103:11 | .myNone | MyEnum |
91+
| patterns.swift:105:10:105:25 | .mySingle(...) | MyEnum |
92+
| patterns.swift:105:19:105:25 | (...) | (Int) |
93+
| patterns.swift:105:20:105:24 | let ... | (Int) |
94+
| patterns.swift:105:24:105:24 | a | (Int) |
95+
| patterns.swift:107:10:107:30 | .myPair(...) | MyEnum |
96+
| patterns.swift:107:17:107:30 | (...) | (Int, Int) |
97+
| patterns.swift:107:18:107:22 | let ... | Int |
98+
| patterns.swift:107:22:107:22 | a | Int |
99+
| patterns.swift:107:25:107:29 | let ... | Int |
100+
| patterns.swift:107:29:107:29 | b | Int |
101+
| patterns.swift:110:10:110:26 | let ... | MyEnum |
102+
| patterns.swift:110:14:110:26 | .myCons(...) | MyEnum |
103+
| patterns.swift:110:21:110:26 | (...) | (Int, MyEnum) |
104+
| patterns.swift:110:22:110:22 | a | Int |
105+
| patterns.swift:110:25:110:25 | _ | MyEnum |
106+
| patterns.swift:114:13:114:28 | .mySingle(...) | MyEnum |
107+
| patterns.swift:114:22:114:28 | (...) | (Int) |
108+
| patterns.swift:114:23:114:27 | let ... | (Int) |
109+
| patterns.swift:114:27:114:27 | x | (Int) |
110+
| patterns.swift:117:13:117:33 | .myPair(...) | MyEnum |
111+
| patterns.swift:117:20:117:33 | (...) | (Int, Int) |
112+
| patterns.swift:117:21:117:25 | let ... | Int |
113+
| patterns.swift:117:25:117:25 | x | Int |
114+
| patterns.swift:117:28:117:32 | let ... | Int |
115+
| patterns.swift:117:32:117:32 | y | Int |
116+
| patterns.swift:125:10:125:11 | .myNone | MyEnum |
117+
| patterns.swift:127:10:127:25 | .mySingle(...) | MyEnum |
118+
| patterns.swift:127:19:127:25 | (...) | (Int) |
119+
| patterns.swift:127:20:127:24 | let ... | (Int) |
120+
| patterns.swift:127:24:127:24 | a | (Int) |
121+
| patterns.swift:129:10:129:30 | .myPair(...) | MyEnum |
122+
| patterns.swift:129:17:129:30 | (...) | (Int, Int) |
123+
| patterns.swift:129:18:129:22 | let ... | Int |
124+
| patterns.swift:129:22:129:22 | a | Int |
125+
| patterns.swift:129:25:129:29 | let ... | Int |
126+
| patterns.swift:129:29:129:29 | b | Int |
127+
| patterns.swift:132:10:132:26 | let ... | MyEnum |
128+
| patterns.swift:132:14:132:26 | .myCons(...) | MyEnum |
129+
| patterns.swift:132:21:132:26 | (...) | (Int, MyEnum) |
130+
| patterns.swift:132:22:132:22 | a | Int |
131+
| patterns.swift:132:25:132:25 | _ | MyEnum |
132+
| patterns.swift:136:13:136:28 | .mySingle(...) | MyEnum |
133+
| patterns.swift:136:22:136:28 | (...) | (Int) |
134+
| patterns.swift:136:23:136:27 | let ... | (Int) |
135+
| patterns.swift:136:27:136:27 | x | (Int) |
136+
| patterns.swift:139:13:139:33 | .myPair(...) | MyEnum |
137+
| patterns.swift:139:20:139:33 | (...) | (Int, Int) |
138+
| patterns.swift:139:21:139:25 | let ... | Int |
139+
| patterns.swift:139:25:139:25 | x | Int |
140+
| patterns.swift:139:28:139:32 | let ... | Int |
141+
| patterns.swift:139:32:139:32 | y | Int |
142+
| patterns.swift:144:9:144:9 | b | MyEnum |
143+
| patterns.swift:144:9:144:12 | ... as ... | MyEnum |
144+
| patterns.swift:147:10:147:11 | .myNone | MyEnum |
145+
| patterns.swift:149:10:149:25 | .mySingle(...) | MyEnum |
146+
| patterns.swift:149:19:149:25 | (...) | (Int) |
147+
| patterns.swift:149:20:149:24 | let ... | (Int) |
148+
| patterns.swift:149:24:149:24 | a | (Int) |
149+
| patterns.swift:151:10:151:30 | .myPair(...) | MyEnum |
150+
| patterns.swift:151:17:151:30 | (...) | (Int, Int) |
151+
| patterns.swift:151:18:151:22 | let ... | Int |
152+
| patterns.swift:151:22:151:22 | a | Int |
153+
| patterns.swift:151:25:151:29 | let ... | Int |
154+
| patterns.swift:151:29:151:29 | b | Int |
155+
| patterns.swift:154:10:154:38 | let ... | MyEnum |
156+
| patterns.swift:154:14:154:38 | .myCons(...) | MyEnum |
157+
| patterns.swift:154:21:154:38 | (...) | (Int, MyEnum) |
158+
| patterns.swift:154:22:154:22 | a | Int |
159+
| patterns.swift:154:25:154:37 | .myPair(...) | MyEnum |
160+
| patterns.swift:154:32:154:37 | (...) | (Int, Int) |
161+
| patterns.swift:154:33:154:33 | b | Int |
162+
| patterns.swift:154:36:154:36 | c | Int |
163+
| patterns.swift:158:10:158:26 | let ... | MyEnum |
164+
| patterns.swift:158:14:158:26 | .myCons(...) | MyEnum |
165+
| patterns.swift:158:21:158:26 | (...) | (Int, MyEnum) |
166+
| patterns.swift:158:22:158:22 | a | Int |
167+
| patterns.swift:158:25:158:25 | _ | MyEnum |
168+
| patterns.swift:162:13:162:28 | .mySingle(...) | MyEnum |
169+
| patterns.swift:162:22:162:28 | (...) | (Int) |
170+
| patterns.swift:162:23:162:27 | let ... | (Int) |
171+
| patterns.swift:162:27:162:27 | x | (Int) |
172+
| patterns.swift:165:13:165:39 | .myPair(...) | MyEnum |
173+
| patterns.swift:165:26:165:39 | (...) | (Int, Int) |
174+
| patterns.swift:165:27:165:31 | let ... | Int |
175+
| patterns.swift:165:31:165:31 | x | Int |
176+
| patterns.swift:165:34:165:38 | let ... | Int |
177+
| patterns.swift:165:38:165:38 | y | Int |
178+
| patterns.swift:169:13:169:41 | let ... | MyEnum |
179+
| patterns.swift:169:17:169:41 | .myCons(...) | MyEnum |
180+
| patterns.swift:169:24:169:41 | (...) | (Int, MyEnum) |
181+
| patterns.swift:169:25:169:25 | _ | Int |
182+
| patterns.swift:169:28:169:40 | .myPair(...) | MyEnum |
183+
| patterns.swift:169:35:169:40 | (...) | (Int, Int) |
184+
| patterns.swift:169:36:169:36 | _ | Int |
185+
| patterns.swift:169:39:169:39 | c | Int |
186+
| patterns.swift:174:10:174:55 | let ... | (MyEnum, MyEnum) |
187+
| patterns.swift:174:14:174:55 | (...) | (MyEnum, MyEnum) |
188+
| patterns.swift:174:15:174:27 | .myPair(...) | MyEnum |
189+
| patterns.swift:174:22:174:27 | (...) | (Int, Int) |
190+
| patterns.swift:174:23:174:23 | a | Int |
191+
| patterns.swift:174:26:174:26 | b | Int |
192+
| patterns.swift:174:30:174:54 | .myCons(...) | MyEnum |
193+
| patterns.swift:174:37:174:54 | (...) | (Int, MyEnum) |
194+
| patterns.swift:174:38:174:38 | c | Int |
195+
| patterns.swift:174:41:174:53 | .myPair(...) | MyEnum |
196+
| patterns.swift:174:48:174:53 | (...) | (Int, Int) |
197+
| patterns.swift:174:49:174:49 | d | Int |
198+
| patterns.swift:174:52:174:52 | e | Int |
199+
| patterns.swift:180:5:180:5 | _ | (MyEnum, MyEnum) |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import codeql.swift.elements
2+
3+
from Pattern p, string s
4+
where
5+
p.getFile().getBaseName() = "patterns.swift" and
6+
if exists(p.getType())
7+
then
8+
s = p.getType().toString()
9+
else
10+
s = "(none)"
11+
select p, s

0 commit comments

Comments
 (0)