Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2203] Implicit self doesn't work in initializer of lazy var #44810

Closed
harlanhaskins opened this issue Jul 28, 2016 · 4 comments
Closed

[SR-2203] Implicit self doesn't work in initializer of lazy var #44810

harlanhaskins opened this issue Jul 28, 2016 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@harlanhaskins
Copy link
Collaborator

Previous ID SR-2203
Radar None
Original Reporter @harlanhaskins
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 43f8e5edd99fb3c2f4f93df15da91423

is duplicated by:

  • SR-2329 self unavailable in closures to initialize lazy properties unless type specified
  • SR-4356 Type Interface could not resolve lazy var without type annotation.

relates to:

  • SR-4663 Bad diagnostic when missing explicit type in lazy property declaration
  • SR-48 Create warning for missing self in lazy var initialization

Issue Description:

struct Foo {
  let bar: Int
  lazy var baz: Int = {
    return /* self. */bar
  }()
}

Does not work unless I add a `self`before 'bar'

@belkadan
Copy link
Contributor

The whole model here is broken, and the current behavior is whatever happens to be implemented. We need to make sure we do the correct thing for both lazy and non-lazy vars.

@jpsim
Copy link
Contributor

jpsim commented Sep 15, 2016

Fixed in #4676

@swift-ci
Copy link
Collaborator

Comment by Sebastian Hagedorn (JIRA)

Does this relate to/have an impact on https://bugs.swift.org/browse/SR-48 ?

@slavapestov
Copy link
Member

#9920

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

5 participants