Cuckoo: Error: Expected member name or constructor call after type name
Xcode 15
GeneratedMocks.swift
is showing errors for:
return DefaultValueRegistry.defaultValue(for: (Observable<T>).self)
\\ Expected member name or constructor call after type name
\\ Use '.self' to reference the type object <Fix>
If I edit it to:
return DefaultValueRegistry.defaultValue(for: Observable.self)
the error goes away.
If I fix the errors in the generated file and skip the Cuckoo script phase, I am able to compile and run unit tests in both Xcode 15 and Xcode 14.3.1
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 2
- Comments: 28 (1 by maintainers)
@chirag05k If your case is like mine, you don’t need to use a special branch of Cuckoo. Try renaming
Observable
toRxSwift.Observable
in the class you’re mocking out (e.g. rename yourstartSession
method’s return type).Swift 5.9 added a new Observable type that now shadows RxSwift’s Observable.
@TadeasKriz That was it! Tricky, because when I use Xcode to click into the
Observable
it would take me to RxSwift’s type.After updating my protocols to use
RxSwift.Observable
overObservable
, my remaining project errors have been resolved.Is this Xcode 15? I think
Observable
is now a macro for SwiftUI, so maybe tryRxSwift.Observable<IBluetoothPeripheral>
, that might work.