[SR-8155] Improve the error message when using existentials as inout arguments #50687
Labels
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
improvement
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: 3df8965b95eb9d162d2df0ab15306f99
is duplicated by:
Issue Description:
I was puzzled by the following error:
I then understood, thanks to Slava (https://twitter.com/slava_pestov/status/1012747139951222785) that you can't pass an existential as an inout argument, because they need to be invariant.
Several ideas for improving the diagnostics:
Generate an error at the function declaration ("Cannot use protocols as inout arguments: consider using a generic argument instead")
Generate a better error at the use site ("Cannot pass protocols as inout arguments")
The text was updated successfully, but these errors were encountered: