Files
swift-mirror/test/SILOptimizer/allocbox_to_stack_not_crash.swift
Michael Ilseman c37751ae96 [noescape by defaul] make noescape the default
This flips the switch to have @noescape be the default semantics for
function types in argument positions, for everything except property
setters. Property setters are naturally escaping, so they keep their
escaping-by-default behavior.

Adds contentual printing, and updates the test cases.

There is some further (non-source-breaking) work to be done for
SE-0103:

- We need the withoutActuallyEscaping function
- Improve diagnostics and QoI to at least @noescape's standards
- Deprecate / drop @noescape, right now we allow it
- Update internal code completion printing to be contextual
- Add more tests to explore tricky corner cases
- Small regressions in fixits in attr/attr_availability.swift
2016-07-29 13:49:08 -07:00

16 lines
601 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -verify
// Verify we don't crash on this.
// rdar://15595118
infix operator ~>
protocol Target {}
func ~> <Target, Arg0, Result>(x: inout Target, f: @escaping (_: inout Target, _: Arg0) -> Result) -> (Arg0) -> Result {
return { f(&x, $0) } // expected-error {{escaping closures can only capture inout parameters explicitly by value}}
}
func ~> (x: inout Int, f: @escaping (_: inout Int, _: Target) -> Target) -> (Target) -> Target {
return { f(&x, $0) } // expected-error {{escaping closures can only capture inout parameters explicitly by value}}
}