Uploaded image for project: 'Swift'
  1. Swift
  2. SR-2203

Implicit `self` doesn't work in initializer of lazy var

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
      None

      Description

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

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                slavapestov Slava Pestov
                Reporter:
                harlan Harlan Haskins
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: