-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when compiling async let body with if expression #75294
Labels
assertion failure
Bug → crash: An assertion failure
async & await
Feature → concurrency: asynchronous function aka the async/await pattern
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
concurrency
Feature: umbrella label for concurrency language features
crash
Bug: A crash, i.e., an abnormal termination of software
expressions
Feature: expressions
if else
Feature → statements: 'if' statements
let & var
Feature: constant and variable declarations
SILGen
Area → compiler: The SIL generation stage
swift 6.0
Comments
jumhyn-browser
added
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
triage needed
This issue needs more specific labels
labels
Jul 17, 2024
Reduction: func test() async {
async let val = if let i = Optional<Int>.none {
i
} else {
0
}
} Symbolicated:
|
AnthonyLatsis
added
concurrency
Feature: umbrella label for concurrency language features
compiler
The Swift compiler itself
SILGen
Area → compiler: The SIL generation stage
async & await
Feature → concurrency: asynchronous function aka the async/await pattern
expressions
Feature: expressions
let & var
Feature: constant and variable declarations
if else
Feature → statements: 'if' statements
swift 6.0
assertion failure
Bug → crash: An assertion failure
and removed
triage needed
This issue needs more specific labels
labels
Jul 18, 2024
Another variant: import Foundation
func sample(arg: Int?) async {
// error: closure captures 'arg' before it is declared
async let exampleOne = if let arg { arg } else { 0 }
async let exampleTwo = switch arg {
// error: closure captures 'value' before it is declared
case .some(let value): value
case .none: 0
}
} Getting errors:
Seems that the issue appears as early as in sema, and may be related to combining autoclosure with single-stmt expr which is only possible with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
assertion failure
Bug → crash: An assertion failure
async & await
Feature → concurrency: asynchronous function aka the async/await pattern
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
concurrency
Feature: umbrella label for concurrency language features
crash
Bug: A crash, i.e., an abnormal termination of software
expressions
Feature: expressions
if else
Feature → statements: 'if' statements
let & var
Feature: constant and variable declarations
SILGen
Area → compiler: The SIL generation stage
swift 6.0
Description
The following produces a crash on godbolt's nightly build, and confusing diagnostics in Xcode 16 beta 3
Reproduction
In Xcode, we get the following diagnostic:
Stack dump
Swift version 6.0-dev (LLVM 0ad8ad0245d47b4, Swift 01bd2b4)
Target: x86_64-unknown-linux-gnu
swift-driver version: 1.111.2 Apple Swift version 6.0 (swiftlang-6.0.0.5.15 clang-1600.0.22.6)
Target: arm64-apple-macosx14.0
The text was updated successfully, but these errors were encountered: