[SR-9037] Compiler can't implicitly upcast the base of a reference to a constrained protocol extension member #51540
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
Swift version 4.2-dev (LLVM c4a0883115, Clang 0a99881462, Swift 533575ab62)
Target: x86_64-apple-darwin17.7.0
Additional Detail from JIRA
md5: b19e3c890f5c362da2976fa71ac86fa7
Issue Description:
The following doesn't compile (with an amusingly incorrect error message):
Putting the bad diagnostic aside, arguably the compiler should be able to implicitly upcast the base of the member reference here.
Although admittedly the above example is contrived as you would instead write the constraint as
where Self : A
, this issue was ran into when attempting to callcontains
on a subclassedOptionSet
:Due to the fact that
contains
is defined in an extension onOptionSet
with the constraintwhere Self == Element
.The text was updated successfully, but these errors were encountered: