[IS-19] Unable to compile Signal and EventSignal with Mockatoo on Haxe 3.2.0 and newer
Closed this issue · 1 comments
tomaskukol commented
I tried to compile unit tests that used mockatoo
. I got those errors:
HaxeWrapper.hx:73: Signal.hx:202: lines 202-205 : Field createSlot overloads parent class with different or incomplete type
HaxeWrapper.hx:73: Signal.hx:202: lines 202-205 : listener : (Void -> Void) -> ?once : Null<Bool> -> ?priority : Null<Int> -> msignal.Slot0 should be listener : (Void -> Void) -> ?once : Bool -> ?priority : Int -> msignal.Slot0
HaxeWrapper.hx:73: Signal.hx:202: lines 202-205 : Null<Bool> should be Bool
HaxeWrapper.hx:73: Signal.hx:132: lines 132-146 : Field registerListener overloads parent class with different or incomplete type
HaxeWrapper.hx:73: Signal.hx:181: lines 181-206 : Defined in this class
HaxeWrapper.hx:73: Signal.hx:132: lines 132-146 : listener : (Void -> Void) -> ?once : Null<Bool> -> ?priority : Null<Int> -> msignal.Slot0 should be listener : (Void -> Void) -> ?once : Bool -> ?priority : Int -> msignal.Slot0
HaxeWrapper.hx:73: Signal.hx:132: lines 132-146 : Null<Bool> should be Bool
HaxeWrapper.hx:73: Signal.hx:181: lines 181-206 : Defined in this class
Error: Error compiling hxml for js
I think it has something to do with the different behaviour of Haxe 3.2+ when dealing with parameters with default value and optional parameters (see discussion of issue HaxeFoundation/haxe#4793).
It might be the problem of mockatoo
on Haxe 3.2+.
What helps is a change of problematic method(s) from
override function createSlot(listener:Void -> Void, once:Bool=false, priority:Int=0)
to (once
and priority
parameters are marked with ?
)
override function createSlot(listener:Void -> Void, ?once:Bool=false, ?priority:Int=0)
When this change is introduced, it works with mockatoo
well.
dpeek commented
Fixed by your PR, thank you!