Compiler crash with optional existential #71019
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
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
type checker
Area → compiler: Semantic analysis
Description
Another related bug to my recent reports (#70988, #71000, #71012). It could be a duplicate, but I'd think the more reports the better—all occurring in different scenarios. All these reports would make good test cases.
In this case, it appears the compiler crashes when trying to infer how to implicitly cast an optional existential.
Reproduction
Stack dump
Expected behavior
The compiler should not crash. It should also work out how to implicitly cast this optional existential.
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
Workaround
Manually use a
let
-binding with the optional.The text was updated successfully, but these errors were encountered: