Calling a function for each element of an array of mixed elements conforming to a same protocol #67198
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
constrained existentials
Feature → existentials: constrained existentials such as 'any Collection<Int>'
duplicate
Resolution: Duplicates another issue
existential member accesses
Feature → existentials: existential member accesses
existentials
Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values
implicit existential opening
Feature → existentials: implicit opening of existentials when passed to parameters of generic type
parameterized protocols
Feature → protocol: protocols with primary associated types
swift 5.9
type checker
Area → compiler: Semantic analysis
Description
I am trying to call a function for each element of an array of mixed elements conforming to a same protocol.
Please consider the following code, the export and exportA compile fine but as soon as I add a requirement that Database inherits from a class then exportB won't compile.
Steps to reproduce
Try to compile the code above.
Expected behavior
It should compile.
Environment
Target: arm64-apple-macosx13.0
Build version 14E300c
The text was updated successfully, but these errors were encountered: