-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Compiler crash with for...in statement involving parameter packs #67906
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
Labels
assertion failure
Bug → crash: An assertion failure
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
expressions
Feature: expressions
generics
Feature: generic declarations and types
parameter packs
Feature → generics: Parameter packs
swift 6.0
type checker
Area → compiler: Semantic analysis
Comments
These are two separate bugs. We should open a second issue for either of them. Reduced test case for crash 1: struct S<each T> {}
func foo<each T>(_: S<repeat each T>) {}
let _ = foo() Reduced test case for crash 2: protocol P {}
struct S<each T>: P {}
func test<T: P>(_: T) {}
test(S()) |
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Dec 14, 2023
Fixes: - rdar://112785081 - swiftlang#67906 - swiftlang#68160
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jan 3, 2024
Fixes: - rdar://112785081 - swiftlang#67906 - swiftlang#68160
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jan 9, 2024
Fixes: - rdar://112785081 - swiftlang#67906 - swiftlang#68160
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jan 9, 2024
Fixes: - rdar://112785081 - swiftlang#67906 - swiftlang#68160
Catfish-Man
pushed a commit
to Catfish-Man/swift
that referenced
this issue
Jan 19, 2024
Fixes: - rdar://112785081 - swiftlang#67906 - swiftlang#68160
@slavapestov I saw a similar error in #71258. |
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
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
expressions
Feature: expressions
generics
Feature: generic declarations and types
parameter packs
Feature → generics: Parameter packs
swift 6.0
type checker
Area → compiler: Semantic analysis
Description
Given
the following code is causing a compiler crash, with the error message
Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 578
(Full output/stack dump),and the following one shows the error message
Assertion failed: ((!replacement || replacement->hasError() || gp->isParameterPack() == replacement->is<PackType>()) && "replacement for pack parameter must be a pack type"), function operator(), file SubstitutionMap.cpp, line 237
.Steps to reproduce
Build the script with the latest Swift development snapshot.
Expected behavior
The compiler shouldn't crash.
Environment
swift-DEVELOPMENT-SNAPSHOT-2023-08-09-a.xctoolchain
, Apple Swift version 5.9-dev (LLVM79013835e88ccd5
, Swiftcda0fd4c84d72a9
)Additional context
The script compiles if you use an intermediate variable:
The text was updated successfully, but these errors were encountered: