[SR-12862] Misleading error when trying to implement Optional requirement with IUO #55308
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
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: a5e4f9ce134e3079fdd7dc9350acca61
Issue Description:
This code will give you an error like this:
I'm talking specifically about the "non-matching type 'Int?'" note. It's silly to say that `Int?` doesn't match itself. Swift should decide if `Int?` and `Int!` are the same type, or different types.
If they are the same type, the code should compile.
If they are not the same type, then the error message should say the correct type (i.e. `Int!`)
The problem happens also with unannotated obj-c classes, which makes the problem harder to notice, because it's not immediately obvious that `@property NSNumber *foo;` isn't an optional when compiler tells you it is.
The text was updated successfully, but these errors were encountered: