You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This init has the same signature as ScopedDisposable's non-extension init (i'm not sure how this compiles without error), and when the extension calls self.init it calls the extension init instead of the non-extension init, which causes infinite recursion.
Recommend changing the signature of the extension init to have a named argument, or even remove it? I'm not sure what the need for the extension init is, given that the normal init is fully generic already.
For reference for anyone else having this issue, you can workaround for now with: let scoped = ScopedDisposable(AnyDisposable(disposable))
Thanks
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue! This is definitely a bug.
Recommend changing the signature of the extension init to have a named argument, or even remove it? I'm not sure what the need for the extension init is, given that the normal init is fully generic already.
ScopedDisposable has the generic parameter of ScopedDisposable<InnerDisposable: Disposable>, but we can't pass an instance of Disposable protocol type itself because of the limitation of Swift generics. To initialize a ScopedDisposable we needed the new AnyDisposable and pass an instance of it. With the initializer we could write the code:
letd:Disposable=SimpleDisposable()// `scoped` is `ScopedDisposable<AnyDisposable>`.// We can't use `ScopedDisposable<Disposable>` in current Swift.letscoped=ScopedDisposable(d)
Hi, i'm getting an infinite loop when doing the following:
let disposable = someProducer.startWithNext ...
let scoped = ScopedDisposable(disposable)
It loops on ScopedDisposable's extensions'
init(_ disposable: Disposable)
, which is here: https://github.com/ReactiveCocoa/ReactiveSwift/blob/master/Sources/Disposable.swift#L230This init has the same signature as ScopedDisposable's non-extension init (i'm not sure how this compiles without error), and when the extension calls
self.init
it calls the extension init instead of the non-extension init, which causes infinite recursion.Recommend changing the signature of the extension init to have a named argument, or even remove it? I'm not sure what the need for the extension init is, given that the normal init is fully generic already.
For reference for anyone else having this issue, you can workaround for now with:
let scoped = ScopedDisposable(AnyDisposable(disposable))
Thanks
The text was updated successfully, but these errors were encountered: