-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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 itselfgood first issueGood for newcomersGood for newcomers
Description
Previous ID | SR-9795 |
Radar | None |
Original Reporter | @marcomasser |
Type | Bug |
Environment
Tested with Swift 4.2.1 (Xcode 10.1) and Swift 5 from Xcode 10.2 beta (swiftlang-1001.0.45.7 clang-1001.0.37.7).
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, StarterBug |
Assignee | @theblixguy |
Priority | Medium |
md5: 75741cacf781b9db21044152b379d272
Issue Description:
I’m not sure this is a bug or if this works as expected:
class Foo {
var name = "Default Name"
}
class Bar: Foo {
lazy var fullName: String = {
return super.name // error: 'super' cannot be used outside of class members
}()
}
Is there a good reason why super
isn’t permitted here? Replacing super
with self
works fine, as I’d expect because the instance must be fully initialized when lazy
properties are accessed.
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 itselfgood first issueGood for newcomersGood for newcomers