Compiler crash with cast involving any existentials #71000
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
casting
Feature: explicit casting (is, as, as? and as!)
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
existentials
Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values
expressions
Feature: expressions
parameterized protocols
Feature → protocol: protocols with primary associated types
protocol compositions
Feature → types: protocol composition types
swift 6.0
type checker
Area → compiler: Semantic analysis
types
Feature: types
Description
It appears that casting a wrapped
any
existential to another one can cause a compiler crash.Reproduction
Stack dump
Expected behavior
The code should either compile or produce a diagnostic, instead of crashing.
Interestingly, if you use a force-cast
as!
rather thanas
you get the following warning:Environment
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: