Files
swift-mirror/test/SILOptimizer/closure_lifetime_fixup_undef.swift
Arnold Schwaighofer 7d09aee9a1 ClosureLifetimeFixup: Handle undef partial_apply arguments gracefully
We have to handle undef partial_apply arguments to handle the following
source gracefully during the diagnosis pipeline.

```
class TestUndefined {
  private var stringList: [String]!

  func dontCrash(strings: [String]) {
    assert(stringList.allSatisfy({ $0 == stringList.first!}))
    let stringList = strings.filter({ $0 == "a" })
  }
}
```

rdar://57893008
2019-12-16 09:28:56 -08:00

14 lines
402 B
Swift

// RUN: not %target-swift-frontend %s -sil-verify-all -c 2>&1 | %FileCheck %s
// Report the error but don't crash.
// CHECK: error: closure captures 'stringList' before it is declared
class TestUndefined {
private var stringList: [String]!
func dontCrash(strings: [String]) {
assert(stringList.allSatisfy({ $0 == stringList.first!}))
let stringList = strings.filter({ $0 == "a" })
}
}