-
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-4138 |
| Radar | None |
| Original Reporter | Max Medvedev (JIRA User) |
| Type | Bug |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: c9706e2038e23de6e1ecffd1c78b09da
relates to:
- SR-4559 Method called 'self' can be confused with regular 'self'
Issue Description:
Swift 3 forbids to use static members without qualifier in instance context. But it's still allowed to use static properties in initializers of instance properties (though it's forbidden to use static methods there)
An example:
class A {
static var staticProp = 0
static func staticFunc()->Int { return 0 }
var instanceProp = staticProp /*allowed*/ + staticFunc() /*forbidden*/
var instanceComputedProp: Int { staticProp /*forbidden*/ + staticFunc() /*forbidden*/ }
func instanceFunc() {
var _ = staticProp/*forbidden*/ + staticFunc()/*forbidden*/
}
}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