-
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-6480 |
| Radar | rdar://problem/35730964 |
| Original Reporter | @hamishknight |
| Type | Bug |
Environment
Swift version 4.1-dev (LLVM fe49d8f2ca, Clang 839070845c, Swift 76ea3a2)
Target: x86_64-apple-darwin17.2.0
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | @slavapestov |
| Priority | Medium |
md5: 2df450011114c0bdf1e6f6a7bba3ac45
is duplicated by:
- SR-14899 self is not convertible to Self type
Issue Description:
The following code outputs "C":
class C {
static var foo: String { return "\(self)" }
let bar = foo
}
class D : C {}
print(D().bar) // CDespite the fact that it's a D instance being constructed.
This also prevents overrides of class members from working:
class C {
class var foo: String { return "C" }
let bar = foo
}
class D : C {
override class var foo: String { return "D" }
}
print(D().bar) // CMetadata
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