Commit 1421959
committed
[CSGen] Check whether parent has a contextual type before diagnosing
Before considering `nil` to be used without a context, let's
check whether parent expression (semantic significance of
which is not important) has a contextual type associated with it,
otherwise it's possible to misdiagnose cases like:
```swift
func test() -> Int? {
return (nil)
}
```
(cherry picked from commit 90e6fd4)nil use1 parent 1b2565a commit 1421959
2 files changed
+38
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
1210 | | - | |
1211 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1212 | 1239 | | |
1213 | 1240 | | |
1214 | 1241 | | |
| |||
1243 | 1270 | | |
1244 | 1271 | | |
1245 | 1272 | | |
1246 | | - | |
| 1273 | + | |
1247 | 1274 | | |
1248 | 1275 | | |
1249 | 1276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
452 | 460 | | |
0 commit comments