-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
availabilityThe @available attribute and availability checking in generalThe @available attribute and availability checking in generalbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software
Description
Description
The new validation for TypeRefinementContext is asserting on some code that introduces new contexts within a string interpolation. See example here, the larger context is swiftlang/swift-java#76.
Reproduction
func f() {
let enumFields: [String] = []
let s = """
\(enumFields.map {
let caseName = $0
return """
case .\(caseName):
if let \(caseName) = classObj.\(caseName) {
self = \(caseName)
} else {
return nil
}
"""
}.joined(separator: "\n"))
"""
}
### Stack dump
```text
error: compile command failed due to signal 6 (use -v to see invocation)
child source range not contained
child:
(decl_implicit version=15.0 decl=caseName src_range=[/Users/dgregor/Projects/swift/swift/t.swift:5:7 - line:5:22])parent:
(decl_implicit version=15.0 decl=caseName src_range=[/Users/dgregor/Projects/swift/swift/t.swift:5:7 - line:5:22])Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/dgregor/Projects/swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/bin/swift-frontend -frontend -c -primary-file /Users/dgregor/Projects/swift/swift/t.swift -target arm64-apple-macosx15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -color-diagnostics -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/dgregor/Projects/swift/swift -resource-dir /Users/dgregor/Projects/swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift -module-name t -in-process-plugin-server-path /Users/dgregor/Projects/swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/dgregor/Projects/swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/host/plugins -plugin-path /Users/dgregor/Projects/swift/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/local/lib/swift/host/plugins -o /var/folders/ry/cqdwmq3s2k70y0y3b7m9s0_r0000gn/T/TemporaryDirectory.M6hHQM/t-1.o
1. Swift version 6.1-dev (LLVM 95f3fb07f8f5294, Swift e4d625cbec94d28)
2. Compiling with effective version 5.10
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000109c0cd64 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000109c0b5b0 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000109c0d394 SignalHandler(int) + 292
3 libsystem_platform.dylib 0x000000018fa38184 _sigtramp + 56
4 libsystem_pthread.dylib 0x000000018fa02f70 pthread_kill + 288
5 libsystem_c.dylib 0x000000018f90f908 abort + 128
6 swift-frontend 0x0000000106647918 verificationError(swift::ASTContext&, llvm::StringRef, std::initializer_list<std::__1::pair<char const*, swift::TypeRefinementContext const*>>) + 196
7 swift-frontend 0x000000010664782c swift::TypeRefinementContext::verify(swift::TypeRefinementContext const*, swift::ASTContext&) const + 556
8 swift-frontend 0x0000000106647644 swift::TypeRefinementContext::verify(swift::TypeRefinementContext const*, swift::ASTContext&) const + 68
9 swift-frontend 0x0000000106647644 swift::TypeRefinementContext::verify(swift::TypeRefinementContext const*, swift::ASTContext&) const + 68
10 swift-frontend 0x00000001063a1b50 swift::verify(swift::SourceFile&) + 116Expected behavior
This code should be well-formed
Environment
Swift version 6.1-dev (LLVM 95f3fb07f8f5294, Swift e4d625c)
Additional information
No response
Metadata
Metadata
Assignees
Labels
availabilityThe @available attribute and availability checking in generalThe @available attribute and availability checking in generalbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software