Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 98 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dec28
1 swift 0x00000000031df4a6
2 libpthread.so.0 0x00007f76ca7e0330
3 libc.so.6 0x00007f76c8f9ec37 gsignal + 55
4 libc.so.6 0x00007f76c8fa2028 abort + 328
5 swift 0x0000000000d8018f
6 swift 0x0000000000d838af
7 swift 0x0000000000d79e5c
8 swift 0x0000000000d8a740
9 swift 0x0000000000d8aa36
10 swift 0x0000000000d8a71c
11 swift 0x0000000000d8982d
12 swift 0x0000000000d88d72
13 swift 0x0000000000d88c74
14 swift 0x0000000000dde2ee
15 swift 0x0000000000d707bc
16 swift 0x0000000000b1d023
17 swift 0x0000000000b54610
18 swift 0x0000000000958b03
19 swift 0x00000000004a050e
20 swift 0x00000000004674de
21 libc.so.6 0x00007f76c8f89f45 __libc_start_main + 245
22 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 97 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dec28
1 swift 0x00000000031df4a6
2 libpthread.so.0 0x00007f0acf905330
3 swift 0x0000000000dc5ddc
4 swift 0x0000000000c27031
5 swift 0x0000000000c3272c
6 swift 0x0000000000c30dfb
7 swift 0x0000000000c28ee1
8 swift 0x0000000000c28bdd
9 swift 0x0000000000c29cf8
10 swift 0x0000000000c29df4
11 swift 0x0000000000c29bef
12 swift 0x0000000000c28379
13 swift 0x0000000000bd028b
14 swift 0x0000000000bc3656
15 swift 0x0000000000bc3456
16 swift 0x0000000000c22acf
17 swift 0x0000000000c21bf5
18 swift 0x0000000000c221a6
19 swift 0x0000000000c4007c
20 swift 0x0000000000baeb04
21 swift 0x0000000000c22b24
22 swift 0x0000000000c22346
23 swift 0x0000000000c360fa
24 swift 0x0000000000958b26
25 swift 0x00000000004a050e
26 swift 0x00000000004674de
27 libc.so.6 0x00007f0ace0aef45 __libc_start_main + 245
28 swift 0x0000000000464be6
```
In cases where we cannot infer the types they won't be, so we don't want
to just cast to BoundGenericType when we see these.
Fixes rdar://problem/28317710 and at least one dup (and I think a few
more).
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 96 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007f1346013330
3 libc.so.6 0x00007f13447d1c37 gsignal + 55
4 libc.so.6 0x00007f13447d5028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d781fc
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d88bfa
11 swift 0x0000000000d88abc
12 swift 0x0000000000d873fe
13 swift 0x0000000000d87014
14 swift 0x0000000000ddbf1e
15 swift 0x0000000000d6eb5c
16 swift 0x0000000000b1b473
17 swift 0x0000000000b529d0
18 swift 0x0000000000957db3
19 swift 0x00000000004a050e
20 swift 0x00000000004674de
21 libc.so.6 0x00007f13447bcf45 __libc_start_main + 245
22 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 95 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007f6966c61330
3 libc.so.6 0x00007f696541fc37 gsignal + 55
4 libc.so.6 0x00007f6965423028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d781fc
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d8bc9d
11 swift 0x0000000000d89bea
12 swift 0x0000000000d88b5f
13 swift 0x0000000000d873fe
14 swift 0x0000000000d87014
15 swift 0x0000000000ddbf1e
16 swift 0x0000000000d6eb5c
17 swift 0x0000000000b1b473
18 swift 0x0000000000b529d0
19 swift 0x0000000000957db3
20 swift 0x00000000004a050e
21 swift 0x00000000004674de
22 libc.so.6 0x00007f696540af45 __libc_start_main + 245
23 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 94 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007f840c562330
3 libc.so.6 0x00007f840ad20c37 gsignal + 55
4 libc.so.6 0x00007f840ad24028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d781fc
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d89b94
11 swift 0x0000000000d8a19d
12 swift 0x0000000000d8a3b1
13 swift 0x0000000000d88b5f
14 swift 0x0000000000d873fe
15 swift 0x0000000000d87014
16 swift 0x0000000000ddbf1e
17 swift 0x0000000000d6eb5c
18 swift 0x0000000000b1b473
19 swift 0x0000000000b529d0
20 swift 0x0000000000957db3
21 swift 0x00000000004a050e
22 swift 0x00000000004674de
23 libc.so.6 0x00007f840ad0bf45 __libc_start_main + 245
24 swift 0x0000000000464be6
```
Add test case for crash triggered in `statements on a line must be separated by ';'`.
Current number of unresolved compiler crashers: 93 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007fc3c0497330
3 swift 0x0000000000cde5c9
4 swift 0x0000000000d073ae
5 swift 0x0000000000cde571
6 swift 0x0000000000d073ff
7 swift 0x0000000000cde571
8 swift 0x0000000000d073ff
9 swift 0x0000000000cde571
10 swift 0x0000000000d073ff
11 swift 0x0000000000cde571
12 swift 0x0000000000d073ff
13 swift 0x0000000000cde571
14 swift 0x0000000000d073ff
15 swift 0x0000000000cde571
16 swift 0x0000000000d073ff
17 swift 0x0000000000cde571
18 swift 0x0000000000d073ff
19 swift 0x0000000000cde571
20 swift 0x0000000000d073ff
21 swift 0x0000000000cde571
22 swift 0x0000000000d073ff
23 swift 0x0000000000cde571
24 swift 0x0000000000d073ff
25 swift 0x0000000000cde571
26 swift 0x0000000000d073ff
27 swift 0x0000000000cde571
28 swift 0x0000000000d073ff
29 swift 0x0000000000cde571
30 swift 0x0000000000d073ff
31 swift 0x0000000000cde571
32 swift 0x0000000000d073ff
33 swift 0x0000000000cde571
34 swift 0x0000000000d073ff
35 swift 0x0000000000cde571
36 swift 0x0000000000d073ff
37 swift 0x0000000000cde571
38 swift 0x0000000000d073ff
39 swift 0x0000000000cde571
40 swift 0x0000000000d073ff
41 swift 0x0000000000cde571
42 swift 0x0000000000d073ff
43 swift 0x0000000000cde571
44 swift 0x0000000000d073ff
45 swift 0x0000000000cde571
46 swift 0x0000000000d073ff
47 swift 0x0000000000cde571
48 swift 0x0000000000d073ff
49 swift 0x0000000000cde571
50 swift 0x0000000000d073ff
51 swift 0x0000000000cde571
52 swift 0x0000000000d073ff
53 swift 0x0000000000cde571
54 swift 0x0000000000d073ff
55 swift 0x0000000000cde571
56 swift 0x0000000000d073ff
57 swift 0x0000000000cde571
58 swift 0x0000000000d073ff
59 swift 0x0000000000cde571
60 swift 0x0000000000d073ff
61 swift 0x0000000000cde571
62 swift 0x0000000000d073ff
63 swift 0x0000000000cde571
64 swift 0x0000000000d073ff
65 swift 0x0000000000cde571
66 swift 0x0000000000d073ff
67 swift 0x0000000000cde571
68 swift 0x0000000000d073ff
69 swift 0x0000000000cde571
70 swift 0x0000000000d073ff
71 swift 0x0000000000cde571
72 swift 0x0000000000d073ff
73 swift 0x0000000000cde571
74 swift 0x0000000000d073ff
75 swift 0x0000000000cde571
76 swift 0x0000000000d073ff
77 swift 0x0000000000cde571
78 swift 0x0000000000d073ff
79 swift 0x0000000000cde571
80 swift 0x0000000000d073ff
81 swift 0x0000000000cde571
82 swift 0x0000000000d073ff
83 swift 0x0000000000cde571
84 swift 0x0000000000d073ff
85 swift 0x0000000000cde571
86 swift 0x0000000000d073ff
87 swift 0x0000000000cde571
88 swift 0x0000000000d073ff
89 swift 0x0000000000cde571
90 swift 0x0000000000d073ff
91 swift 0x0000000000cde571
92 swift 0x0000000000d073ff
93 swift 0x0000000000cde571
94 swift 0x0000000000d073ff
95 swift 0x0000000000cde571
96 swift 0x0000000000d073ff
97 swift 0x0000000000cde571
98 swift 0x0000000000d073ff
99 swift 0x0000000000cde571
100 swift 0x0000000000d073ff
101 swift 0x0000000000cde571
102 swift 0x0000000000d073ff
103 swift 0x0000000000cde571
104 swift 0x0000000000d073ff
105 swift 0x0000000000cde571
106 swift 0x0000000000d073ff
107 swift 0x0000000000cde571
108 swift 0x0000000000d073ff
109 swift 0x0000000000cde571
110 swift 0x0000000000d073ff
111 swift 0x0000000000cde571
112 swift 0x0000000000d073ff
113 swift 0x0000000000cde571
114 swift 0x0000000000d073ff
115 swift 0x0000000000cde571
116 swift 0x0000000000d073ff
117 swift 0x0000000000cde571
118 swift 0x0000000000d073ff
119 swift 0x0000000000cde571
120 swift 0x0000000000d073ff
121 swift 0x0000000000cde571
122 swift 0x0000000000d073ff
123 swift 0x0000000000cde571
124 swift 0x0000000000d073ff
125 swift 0x0000000000cde571
126 swift 0x0000000000d073ff
127 swift 0x0000000000cde571
128 swift 0x0000000000d073ff
129 swift 0x0000000000cde571
130 swift 0x0000000000d073ff
131 swift 0x0000000000cde571
132 swift 0x0000000000d073ff
133 swift 0x0000000000cde571
134 swift 0x0000000000d073ff
135 swift 0x0000000000cde571
136 swift 0x0000000000d073ff
137 swift 0x0000000000cde571
138 swift 0x0000000000d073ff
139 swift 0x0000000000cde571
140 swift 0x0000000000d073ff
141 swift 0x0000000000cde571
142 swift 0x0000000000d073ff
143 swift 0x0000000000cde571
144 swift 0x0000000000d073ff
145 swift 0x0000000000cde571
146 swift 0x0000000000d073ff
147 swift 0x0000000000cde571
148 swift 0x0000000000d073ff
149 swift 0x0000000000cde571
150 swift 0x0000000000d073ff
151 swift 0x0000000000cde571
152 swift 0x0000000000d073ff
153 swift 0x0000000000cde571
154 swift 0x0000000000d073ff
155 swift 0x0000000000cde571
156 swift 0x0000000000d073ff
157 swift 0x0000000000cde571
158 swift 0x0000000000d073ff
159 swift 0x0000000000cde571
160 swift 0x0000000000d073ff
161 swift 0x0000000000cde571
162 swift 0x0000000000d073ff
163 swift 0x0000000000cde571
164 swift 0x0000000000d073ff
165 swift 0x0000000000cde571
166 swift 0x0000000000d073ff
167 swift 0x0000000000cde571
168 swift 0x0000000000d073ff
169 swift 0x0000000000cde571
170 swift 0x0000000000d073ff
171 swift 0x0000000000cde571
172 swift 0x0000000000d073ff
173 swift 0x0000000000cde571
174 swift 0x0000000000d073ff
175 swift 0x0000000000cde571
176 swift 0x0000000000d073ff
177 swift 0x0000000000cde571
178 swift 0x0000000000d073ff
179 swift 0x0000000000cde571
180 swift 0x0000000000d073ff
181 swift 0x0000000000cde571
182 swift 0x0000000000d073ff
183 swift 0x0000000000cde571
184 swift 0x0000000000d073ff
185 swift 0x0000000000cde571
186 swift 0x0000000000d073ff
187 swift 0x0000000000cde571
188 swift 0x0000000000d073ff
189 swift 0x0000000000cde571
190 swift 0x0000000000d073ff
191 swift 0x0000000000cde571
192 swift 0x0000000000d073ff
193 swift 0x0000000000cde571
194 swift 0x0000000000d073ff
195 swift 0x0000000000cde571
196 swift 0x0000000000d073ff
197 swift 0x0000000000cde571
198 swift 0x0000000000d073ff
199 swift 0x0000000000cde571
200 swift 0x0000000000d073ff
201 swift 0x0000000000cde571
202 swift 0x0000000000d073ff
203 swift 0x0000000000cde571
204 swift 0x0000000000d073ff
205 swift 0x0000000000cde571
206 swift 0x0000000000d073ff
207 swift 0x0000000000cde571
208 swift 0x0000000000d073ff
209 swift 0x0000000000cde571
210 swift 0x0000000000d073ff
211 swift 0x0000000000cde571
212 swift 0x0000000000d073ff
213 swift 0x0000000000cde571
214 swift 0x0000000000d073ff
215 swift 0x0000000000cde571
216 swift 0x0000000000d073ff
217 swift 0x0000000000cde571
218 swift 0x0000000000d073ff
219 swift 0x0000000000cde571
220 swift 0x0000000000d073ff
221 swift 0x0000000000cde571
222 swift 0x0000000000d073ff
223 swift 0x0000000000cde571
224 swift 0x0000000000d073ff
225 swift 0x0000000000cde571
226 swift 0x0000000000d073ff
227 swift 0x0000000000cde571
228 swift 0x0000000000d073ff
229 swift 0x0000000000cde571
230 swift 0x0000000000d073ff
231 swift 0x0000000000cde571
232 swift 0x0000000000d073ff
233 swift 0x0000000000cde571
234 swift 0x0000000000d073ff
235 swift 0x0000000000cde571
236 swift 0x0000000000d073ff
237 swift 0x0000000000cde571
238 swift 0x0000000000d073ff
239 swift 0x0000000000cde571
240 swift 0x0000000000d073ff
241 swift 0x0000000000cde571
242 swift 0x0000000000d073ff
243 swift 0x0000000000cde571
244 swift 0x0000000000d073ff
245 swift 0x0000000000cde571
246 swift 0x0000000000d073ff
247 swift 0x0000000000cde571
248 swift 0x0000000000d073ff
249 swift 0x0000000000cde571
250 swift 0x0000000000d073ff
251 swift 0x0000000000cde571
252 swift 0x0000000000d073ff
253 swift 0x0000000000cde571
254 swift 0x0000000000d073ff
255 swift 0x0000000000cde571
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 92 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007fd8ac048330
3 libc.so.6 0x00007fd8aa806c37 gsignal + 55
4 libc.so.6 0x00007fd8aa80a028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d78180
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d8a3b1
11 swift 0x0000000000d87ec1
12 swift 0x0000000000d87a9c
13 swift 0x0000000000d87112
14 swift 0x0000000000d87014
15 swift 0x0000000000ddbf1e
16 swift 0x0000000000d6eb5c
17 swift 0x0000000000b1b473
18 swift 0x0000000000b529d0
19 swift 0x0000000000957db3
20 swift 0x00000000004a050e
21 swift 0x00000000004674de
22 libc.so.6 0x00007fd8aa7f1f45 __libc_start_main + 245
23 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 91 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007fe190d1d330
3 libc.so.6 0x00007fe18f4dbc37 gsignal + 55
4 libc.so.6 0x00007fe18f4df028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d781fc
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d8734b
11 swift 0x0000000000d88b33
12 swift 0x0000000000d87bcd
13 swift 0x0000000000d87112
14 swift 0x0000000000d87014
15 swift 0x0000000000ddbf1e
16 swift 0x0000000000d6eb5c
17 swift 0x0000000000b1b473
18 swift 0x0000000000b529d0
19 swift 0x0000000000957db3
20 swift 0x00000000004a050e
21 swift 0x00000000004674de
22 libc.so.6 0x00007fe18f4c6f45 __libc_start_main + 245
23 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 90 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007f7402c4e330
3 libc.so.6 0x00007f740140cc37 gsignal + 55
4 libc.so.6 0x00007f7401410028 abort + 328
5 swift 0x0000000000d7e52f
6 swift 0x0000000000d81c4f
7 swift 0x0000000000d781fc
8 swift 0x0000000000d88ae0
9 swift 0x0000000000d8b8d3
10 swift 0x0000000000d88b5f
11 swift 0x0000000000d87bcd
12 swift 0x0000000000d87112
13 swift 0x0000000000d87014
14 swift 0x0000000000ddbf1e
15 swift 0x0000000000d6eb5c
16 swift 0x0000000000b1b473
17 swift 0x0000000000b529d0
18 swift 0x0000000000957db3
19 swift 0x00000000004a050e
20 swift 0x00000000004674de
21 libc.so.6 0x00007f74013f7f45 __libc_start_main + 245
22 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 89 (5180 resolved)
Assertion failure in [`lib/Sema/TypeCheckProtocol.cpp (line 2038)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckProtocol.cpp#L2038):
```
Assertion `!resultReplacement->isTypeParameter() && "Can't be dependent"' failed.
When executing: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type)
```
Assertion context:
```
static Substitution getArchetypeSubstitution(TypeChecker &tc,
DeclContext *dc,
ArchetypeType *archetype,
Type replacement) {
Type resultReplacement = replacement;
assert(!resultReplacement->isTypeParameter() && "Can't be dependent");
SmallVector<ProtocolConformanceRef, 4> conformances;
bool isError =
replacement->hasError() || replacement->getCanonicalType()->hasError();
assert((archetype != nullptr || isError) &&
```
Stack trace:
```
0 swift 0x00000000031dc7e8
1 swift 0x00000000031dd066
2 libpthread.so.0 0x00007f084b84f330
3 libc.so.6 0x00007f084a00dc37 gsignal + 55
4 libc.so.6 0x00007f084a011028 abort + 328
5 libc.so.6 0x00007f084a006bf6
6 libc.so.6 0x00007f084a006ca2
7 swift 0x0000000000c0841e
8 swift 0x0000000000c068f2
9 swift 0x0000000000c003e8
10 swift 0x0000000000bfc53a
11 swift 0x0000000000df2293
12 swift 0x0000000000df21d8
13 swift 0x0000000000c25b52
14 swift 0x0000000000c309bc
15 swift 0x0000000000c2f89e
16 swift 0x0000000000c27171
17 swift 0x0000000000c26e6d
18 swift 0x0000000000c27f88
19 swift 0x0000000000c28a32
20 swift 0x0000000000c27e7f
21 swift 0x0000000000c26615
22 swift 0x0000000000bcf9d6
23 swift 0x0000000000bc19f6
24 swift 0x0000000000bcaa0b
25 swift 0x0000000000bc1976
26 swift 0x0000000000bcab8b
27 swift 0x0000000000bc1986
28 swift 0x0000000000bcbb0b
29 swift 0x0000000000bc19a6
30 swift 0x0000000000bc17e6
31 swift 0x0000000000c342ff
32 swift 0x0000000000957dd6
33 swift 0x00000000004a050e
34 swift 0x00000000004674de
35 libc.so.6 0x00007f0849ff8f45 __libc_start_main + 245
36 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 88 (5180 resolved)
Stack trace:
```
0 swift 0x00000000031da6c8
1 swift 0x00000000031daf46
2 libpthread.so.0 0x00007ff86e2b5330
3 libc.so.6 0x00007ff86ca73c37 gsignal + 55
4 libc.so.6 0x00007ff86ca77028 abort + 328
5 swift 0x000000000318311d
6 swift 0x0000000000c74998
7 swift 0x0000000000c73156
8 swift 0x0000000000c72bfe
9 swift 0x0000000000c6fda2
10 swift 0x0000000000c6e237
11 swift 0x0000000000c69d0f
12 swift 0x0000000000c5a9a6
13 swift 0x0000000000c60e90
14 swift 0x0000000000ba991f
15 swift 0x0000000000bac3be
16 swift 0x0000000000bafe77
17 swift 0x0000000000c2099d
18 swift 0x0000000000c202bc
19 swift 0x0000000000c1f455
20 swift 0x0000000000c1e7a3
21 swift 0x0000000000c1e5f7
22 swift 0x0000000000c1f1fc
23 swift 0x0000000000c32e18
24 swift 0x0000000000c3398b
25 swift 0x0000000000957a26
26 swift 0x00000000004a050e
27 swift 0x00000000004674de
28 libc.so.6 0x00007ff86ca5ef45 __libc_start_main + 245
29 swift 0x0000000000464be6
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 87 (5180 resolved)
Stack trace:
```
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28456-unreachable-executed-at-swift-lib-ast-module-cpp-614.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28456-unreachable-executed-at-swift-lib-ast-module-cpp-614-10867a.o
1. While type-checking 'a' at validation-test/compiler_crashers/28456-unreachable-executed-at-swift-lib-ast-module-cpp-614.swift:9:1
2. While resolving type e at [validation-test/compiler_crashers/28456-unreachable-executed-at-swift-lib-ast-module-cpp-614.swift:11:5 - line:11:5] RangeText="e"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Rather than computing the requirement environment as a tuple of
(generic signature, generic environment, substitution map),
encapsulate the result in a new RequirementEnvironment
class. Moreover, create a RequirementEnvironment once and re-use it
when matching each of the witnesses, because the environment itself
doesn't change---only the substitutions do. This saves us some work
when there are multiple potential witnesses (which is common).
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 84 (5179 resolved)
Assertion failure in [`include/swift/AST/Decl.h (line 4613)`](https://github.com/apple/swift/blob/master/include/swift/AST/Decl.h#L4613):
```
Assertion `!this->GenericEnv && "already have generic context?"' failed.
When executing: void swift::AbstractFunctionDecl::setGenericEnvironment(swift::GenericEnvironment *)
```
Assertion context:
```
/// Retrieve the generic context for this function.
GenericEnvironment *getGenericEnvironment() const { return GenericEnv; }
/// Set the generic context of this function.
void setGenericEnvironment(GenericEnvironment *GenericEnv) {
assert(!this->GenericEnv && "already have generic context?");
this->GenericEnv = GenericEnv;
}
// Expose our import as member status
bool isImportAsMember() const { return IAMStatus.isImportAsMember(); }
```
Stack trace:
```
swift: /path/to/swift/include/swift/AST/Decl.h:4613: void swift::AbstractFunctionDecl::setGenericEnvironment(swift::GenericEnvironment *): Assertion `!this->GenericEnv && "already have generic context?"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28452-this-genericenv-already-have-generic-context-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28452-this-genericenv-already-have-generic-context-failed-1a320e.o
1. While type-checking 'C' at validation-test/compiler_crashers/28452-this-genericenv-already-have-generic-context-failed.swift:10:1
2. While resolving type F at [validation-test/compiler_crashers/28452-this-genericenv-already-have-generic-context-failed.swift:15:18 - line:15:18] RangeText="F"
3. While type-checking 'g' at validation-test/compiler_crashers/28452-this-genericenv-already-have-generic-context-failed.swift:15:20
4. While type-checking 'g' at validation-test/compiler_crashers/28452-this-genericenv-already-have-generic-context-failed.swift:15:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 82 (5179 resolved)
Assertion failure in [`include/swift/AST/Decl.h (line 2375)`](https://github.com/apple/swift/blob/master/include/swift/AST/Decl.h#L2375):
```
Assertion `!UnderlyingTy.getType().isNull() && "getting invalid underlying type"' failed.
When executing: swift::Type swift::TypeAliasDecl::getUnderlyingType() const
```
Assertion context:
```
/// getUnderlyingType - Returns the underlying type, which is
/// assumed to have been set.
Type getUnderlyingType() const {
assert(!UnderlyingTy.getType().isNull() &&
"getting invalid underlying type");
return UnderlyingTy.getType();
}
/// computeType - Compute the type (and declared type) of this type alias;
/// can only be called after the alias type has been resolved.
```
Stack trace:
```
swift: /path/to/swift/include/swift/AST/Decl.h:2375: swift::Type swift::TypeAliasDecl::getUnderlyingType() const: Assertion `!UnderlyingTy.getType().isNull() && "getting invalid underlying type"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed-770015.o
1. While type-checking 'B' at validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift:10:1
2. While type-checking 'f' at validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift:11:1
3. While resolving type d at [validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift:11:13 - line:11:13] RangeText="d"
4. While type-checking 'd' at validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift:11:15
5. While type-checking expression at [validation-test/compiler_crashers/28450-underlyingty-gettype-isnull-getting-invalid-underlying-type-failed.swift:12:7 - line:12:7] RangeText="c"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 80 (5179 resolved)
Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 1693)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L1693):
```
Assertion `dist > 0 && "nested type should have matched associated type"' failed.
When executing: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *)
```
Assertion context:
```
continue;
unsigned dist = name.edit_distance(assocType->getName().str(),
/*allowReplacements=*/true,
maxScore);
assert(dist > 0 && "nested type should have matched associated type");
if (bestEditDistance == 0 || dist == bestEditDistance) {
bestEditDistance = dist;
maxScore = bestEditDistance;
bestMatches.push_back(assocType->getName());
} else if (dist < bestEditDistance) {
```
Stack trace:
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1693: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *): Assertion `dist > 0 && "nested type should have matched associated type"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28448-dist-nested-type-should-have-matched-associated-type-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28448-dist-nested-type-should-have-matched-associated-type-failed-6ab04f.o
1. While type-checking extension of A at validation-test/compiler_crashers/28448-dist-nested-type-should-have-matched-associated-type-failed.swift:10:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 79 (5179 resolved)
Assertion failure in [`lib/AST/Type.cpp (line 1280)`](https://github.com/apple/swift/blob/master/lib/AST/Type.cpp#L1280):
```
Assertion `Result && "Case not implemented!"' failed.
When executing: swift::CanType swift::TypeBase::getCanonicalType()
```
Assertion context:
```
}
}
// Cache the canonical type for future queries.
assert(Result && "Case not implemented!");
CanonicalType = Result;
return CanType(Result);
}
```
Stack trace:
```
swift: /path/to/swift/lib/AST/Type.cpp:1280: swift::CanType swift::TypeBase::getCanonicalType(): Assertion `Result && "Case not implemented!"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28447-result-case-not-implemented-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28447-result-case-not-implemented-failed-778155.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 78 (5179 resolved)
Assertion failure in [`include/swift/AST/DiagnosticEngine.h (line 614)`](https://github.com/apple/swift/blob/master/include/swift/AST/DiagnosticEngine.h#L614):
```
Assertion `!ActiveDiagnostic && "Already have an active diagnostic"' failed.
When executing: swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::SourceLoc, Diag<ArgTypes...>, typename detail::PassArgument<ArgTypes>::type...) [ArgTypes = <swift::Type>]
```
Assertion context:
```
/// the types expected by the diagnostic \p ID.
template<typename ...ArgTypes>
InFlightDiagnostic
diagnose(SourceLoc Loc, Diag<ArgTypes...> ID,
typename detail::PassArgument<ArgTypes>::type... Args) {
assert(!ActiveDiagnostic && "Already have an active diagnostic");
ActiveDiagnostic = Diagnostic(ID, std::move(Args)...);
ActiveDiagnostic->setLoc(Loc);
return InFlightDiagnostic(*this);
}
```
Stack trace:
```
swift: /path/to/swift/include/swift/AST/DiagnosticEngine.h:614: swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::SourceLoc, Diag<ArgTypes...>, typename detail::PassArgument<ArgTypes>::type...) [ArgTypes = <swift::Type>]: Assertion `!ActiveDiagnostic && "Already have an active diagnostic"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28446-activediagnostic-already-have-an-active-diagnostic-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28446-activediagnostic-already-have-an-active-diagnostic-failed-9fd888.o
1. While type-checking 'A' at validation-test/compiler_crashers/28446-activediagnostic-already-have-an-active-diagnostic-failed.swift:10:1
2. While type-checking expression at [validation-test/compiler_crashers/28446-activediagnostic-already-have-an-active-diagnostic-failed.swift:10:15 - line:10:15] RangeText="0"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Add test case for crash triggered in `?`.
Current number of unresolved compiler crashers: 76 (5179 resolved)
Assertion failure in [`lib/AST/ProtocolConformance.cpp (line 271)`](https://github.com/apple/swift/blob/master/lib/AST/ProtocolConformance.cpp#L271):
```
Assertion `resolver && "Unable to resolve type witness"' failed.
When executing: std::pair<const Substitution &, TypeDecl *> swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl *, swift::LazyResolver *) const
```
Assertion context:
```
if (Resolver)
resolveLazyInfo();
auto known = TypeWitnesses.find(assocType);
if (known == TypeWitnesses.end()) {
assert(resolver && "Unable to resolve type witness");
resolver->resolveTypeWitness(this, assocType);
known = TypeWitnesses.find(assocType);
assert(known != TypeWitnesses.end() && "Didn't resolve witness?");
}
```
Stack trace:
```
swift: /path/to/swift/lib/AST/ProtocolConformance.cpp:271: std::pair<const Substitution &, TypeDecl *> swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl *, swift::LazyResolver *) const: Assertion `resolver && "Unable to resolve type witness"' failed.
Stack dump:
0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28444-resolver-unable-to-resolve-type-witness-failed.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28444-resolver-unable-to-resolve-type-witness-failed-1c716b.o
1. While type-checking 'd' at validation-test/compiler_crashers/28444-resolver-unable-to-resolve-type-witness-failed.swift:10:1
2. While type-checking expression at [validation-test/compiler_crashers/28444-resolver-unable-to-resolve-type-witness-failed.swift:10:19 - line:10:19] RangeText="b"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
Changes:
- Native dictionary and set indices no longer hold references to storage
- Cocoa-based dictionary and set indices no longer hold references to storage
- Removed double indirection trick from hashed collections
- Rewrote storage types to reflect simpler model
- Updated unit tests
When a constraint fails, we retire it... but we also need to remove it
from the constraint graph. Otherwise, we break invariants when
diagnostic generation attempts to continue simplification.
Fixes rdar://rdar28145033.
When performing the occurs check, look for the *representative* of the
type variable we're about to bind, rather than the type variable
itself. Fixes rdar://problem/26845038, SR-1512, SR-1902, SR2635,
SR-2852, and SR-2766.
We've been performing the "occurs" check when computing potential
bindings for type variables, but we weren't actually performing the
check for bindings that *must* occur. Perform the occurs check before
binding type variables, which fixes a few crashers and is far more principled.
Note that this obviates the need for tracking the type variables we've
substituted in simplifyType(), so simplify that as well.
Fixes rdar://problem/27879334 / SR-2351.