[ParameterPacks] Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 578. #71258
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
closures
Feature: closures
compiler
The Swift compiler itself
expressions
Feature: expressions
generics
Feature: generic declarations and types
parameter packs
Feature → generics: Parameter packs
swift 6.0
type checker
Area → compiler: Semantic analysis
unexpected error
Bug: Unexpected error
Description
No response
Reproduction
https://gist.github.com/vanvoorden/ff2ab196296646956178c70dc7d9a1fd
Hi! I'm seeing some crashes and compiler failures from passing a tuple of only one value to an argument expecting a parameter pack tuple. Passing multiple values in the tuple fixes the compiler failures. I've tested this code on the three latest Swift versions:
Apple Swift version 5.9.2-dev (LLVM 2b42c5ce063a374, Swift 9067148bc9c9a72)
Apple Swift version 5.10-dev (LLVM 551823b7474ea05, Swift 3e816f55ab4b4d4)
Apple Swift version 5.11-dev (LLVM 79aab1b6aed58d0, Swift fd9726839309a33)
My first example fails to compile on all three versions:
That first example fails with the same error on
5.9.2
and5.10
:That first example fails on
5.11
with a different failure:My second example fails only for
5.11
:That second example fails on
5.11
with the same failure from the first example:My third example compiles on all three versions:
Any ideas why passing multiple values in my tuple is compiling… but only passing one fails? And why passing only one value compiles when the parameter pack is not saved as an instance variable?
Stack dump
Expected behavior
no compiler crashes or errors
Environment
Apple Swift version 5.9.2-dev (LLVM 2b42c5ce063a374, Swift 9067148bc9c9a72)
Apple Swift version 5.10-dev (LLVM 551823b7474ea05, Swift 3e816f55ab4b4d4)
Apple Swift version 5.11-dev (LLVM 79aab1b6aed58d0, Swift fd9726839309a33)
Additional information
No response
The text was updated successfully, but these errors were encountered: