mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This could result in us incorrectly walking into local functions and picking up type variables that weren't being referenced.
22 lines
423 B
Swift
22 lines
423 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/apple/swift/issues/71273
|
|
|
|
func bar<R>(_ fn: () -> R) {}
|
|
|
|
// Make sure we don't error here.
|
|
func testLocalFn() {
|
|
bar() {
|
|
func foo() -> Int { return 0 }
|
|
return ()
|
|
}
|
|
}
|
|
|
|
func testLocalBinding() {
|
|
bar() {
|
|
let _ = if .random() { return () } else { 0 }
|
|
// expected-error@-1 {{cannot 'return' in 'if' when used as expression}}
|
|
return ()
|
|
}
|
|
}
|