-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-15096 |
Radar | None |
Original Reporter | @typesanitizer |
Type | Bug |
Status | In Progress |
Resolution |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | mininny (JIRA) |
Priority | Medium |
md5: f58fc20f557cce2f2ade639d7c1ce432
Issue Description:
The following code snippet:
public class C { }
extension C {
open func f() { }
}
compiles without a diagnostic today. Superficially, it might seem like you can override f
from a subclass of C
. However, that's not the case; you can only overload it. Being able to override methods declared in extensions would require a mechanism like objc_msgSend
, which is why such overloading only works when @objc
is present, there is no Swift equivalent for pure Swift classes.
This means that the open
is misleading to a reader; we should issue a diagnostic with a fix-it to replace this with public
instead in such situations.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself