[swift-users] Lazy expression is ambiguous?

Rick Mann rmann at latencyzero.com
Mon Sep 12 02:43:54 CDT 2016


Done. https://bugs.swift.org/browse/SR-2616

> On Sep 11, 2016, at 22:40 , Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
> 
> This problem seems to occur when using an initializer with some default argument values. The following code also exhibits the issue:
> 
> struct Bar {
>   init(x: Int, y: Int? = 42) { }
> }
> 
> class Foo {
>   lazy var myQ = Bar(x: 3)
> }
> 
> 
> I'd recommend filing a bug at bugs.swift.org.
> 
> On Sun, Sep 11, 2016 at 10:19 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
> I get this error in the following code: "Type of expression is ambiguous without more context", on the DispatchQueue. But only if I mark it as "lazy", and not if I don't. I'm not sure why.
> 
> class
> myClass
> {
>   lazy var myQ = DispatchQueue(label: "Op", attributes: .concurrent)    // <-- ERROR
>                  ^Type of expression is ambiguous without more context
> }
> 
> Would someone please explain? Thank you.
> 
> --
> Rick Mann
> rmann at latencyzero.com
> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
> 


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list