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-3561] can't use initializer with default argument to define a lazy var #46149

Closed
swift-ci opened this issue Jan 6, 2017 · 1 comment
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jan 6, 2017

Previous ID SR-3561
Radar None
Original Reporter cezarywojcik (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 95bdd554da53d58e97b34e74bf85bf99

cloned to:

  • SR-3809 errors out on the addOperation() for OperationQueue

duplicates:

  • SR-2616 'lazy' keyword results in "Type of expression is ambiguous without more context"

Issue Description:

Sample Code:

class MyClass {

    init(value: String = "ohno") {
        print(value)
    }

}

class MyOtherClass {

    lazy var test = MyClass()

}

let _ = MyOtherClass()

The error we get:

Playground execution failed: error: MyPlayground.playground:5:21: error: type of expression is ambiguous without more context
    lazy var test = MyClass()
                    ^~~~~~~~~

The code works fine if we remove the lazy.

@belkadan
Copy link
Contributor

Consolidating.

@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

2 participants