Closed
Description
the following test program crashes the most recent nightly toolchain:
func foo()
{
{
var collector:[Void] = []
for _:Void in []
{
switch (() as Void?, ())
{
case (let a?, let b):
collector.append(a)
fallthrough
case (nil, let b):
collector.append(b)
}
}
}()
}
Already type-checked
UNREACHABLE executed at /home/build-user/swift/lib/Sema/CSGen.cpp:2956!
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: ~/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-05-18-a/usr/bin/swift-frontend -frontend -c -primary-file crash-5-23-22.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -new-driver-path ~/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-05-18-a/usr/bin/swift-driver -empty-abi-descriptor -resource-dir ~/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-05-18-a/usr/lib/swift -module-name main -o /tmp/TemporaryDirectory.GixgfX/crash-5-23-22-1.o
1. Swift version 5.8-dev (LLVM 515f8ef5b9ec986, Swift 7435c936a6a67d0)
2. Compiling with the current language version
3. While evaluating request TypeCheckSourceFileRequest(source_file "crash-5-23-22.swift")
4. While evaluating request TypeCheckFunctionBodyRequest(main.(file).foo()@crash-5-23-22.swift:1:6)
5. While type-checking statement at [crash-5-23-22.swift:2:1 - line:17:1] RangeText="{
{
var collector:[Void] = []
for _:Void in []
{
switch (() as Void?, ())
{
case (let a?, let b):
collector.append(a)
fallthrough
case (nil, let b):
collector.append(b)
}
}
}()
"
6. While type-checking expression at [crash-5-23-22.swift:3:5 - line:16:7] RangeText="{
var collector:[Void] = []
for _:Void in []
{
switch (() as Void?, ())
{
case (let a?, let b):
collector.append(a)
fallthrough
case (nil, let b):
collector.append(b)
}
}
}("
7. While evaluating request InterfaceTypeRequest(main.(file).foo().explicit closure [email protected]:12:31)
8. While evaluating request NamingPatternRequest(main.(file).foo().explicit closure [email protected]:12:31)
9. While type-checking statement at [crash-5-23-22.swift:7:13 - line:14:13] RangeText="switch (() as Void?, ())
{
case (let a?, let b):
collector.append(a)
fallthrough
case (nil, let b):
collector.append(b)
"
10. While type-checking expression at [crash-5-23-22.swift:7:20 - line:7:36] RangeText="(() as Void?, ()"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
$ swiftenv version
DEVELOPMENT-SNAPSHOT-2022-05-18-a
$ swift --version
Swift version 5.8-dev (LLVM 515f8ef5b9ec986, Swift 7435c936a6a67d0)
Target: x86_64-unknown-linux-gnu