Misleading error message when comparing generics that vary in types #73029
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
expressions
Feature: expressions
generics
Feature: generic declarations and types
operators
Feature: operators
swift 6.0
type checker
Area → compiler: Semantic analysis
Description
When the following code is run, the error I get is
While it is apparent that generics that differ in types cannot be compared, the error message does not indicate that is indeed the problem here. It says it cannot compare "two
'MyStruct<String>'
operands", however, one is aMyStruct<String>
and other is aMyStruct<Int>
.Reproduction
Expected behavior
I would expect an intuitive error message like so, that shows what exactly is the problem (types are different)
Environment
Additional information
Asked this in Swift forums and I was suggested to file a report here.
The text was updated successfully, but these errors were encountered: