mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We now compute captures of functions and default arguments lazily, instead of as a side effect of primary file checking. Captures of closures are computed as part of the enclosing context, not lazily, because the type checking of a single closure body is not lazy. This fixes a specific issue with the `-experimental-skip-*` flags, where functions declared after a top-level `guard` statement are considered to have local captures, but nothing was forcing these captures to be computed. Fixes rdar://problem/125981663.
11 lines
229 B
Swift
11 lines
229 B
Swift
// RUN: %target-swift-frontend -experimental-skip-non-inlinable-function-bodies-without-types -emit-module %s
|
|
|
|
let s: Int? = nil
|
|
guard let m = s else { fatalError() }
|
|
|
|
let x = m
|
|
|
|
public func f(_: Int = m, _: String = "") {}
|
|
|
|
f()
|