any
does not support combined protocols with primary associated type without a typealias
#63877
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
existentials
Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values
parameterized protocols
Feature → protocol: protocols with primary associated types
protocol compositions
Feature → types: protocol composition types
swift 5.9
type checker
Area → compiler: Semantic analysis
TypeResolver
unexpected error
Bug: Unexpected error
Description
If a protocol with a primary associated type (such as RangeExpression) is combined using & with another protocol (such as Sendable), it cannot directly be wrapped with
any
. It can, however, be wrapped with an intermediate typealias.Steps to reproduce
Expected behavior
Both of these should be identical and compile. However, only the second is allowed. The following similar cases are also all allowed:
Environment
swift-driver version: 1.75.1 Apple Swift version 5.8 (swiftlang-5.8.0.117.11 clang-1403.0.22.8.60)
Target: arm64-apple-macosx13.0
Xcode 14.3
Build version 14E5197f
Target: macOS 13.2.1
The text was updated successfully, but these errors were encountered: