There was an error while loading. Please reload this page.
1 parent fa97e08 commit 13e31b7Copy full SHA for 13e31b7
1 file changed
tests/Js/Main/CustomOperatorsTests.fs
@@ -20,7 +20,19 @@ type CustomPow =
20
{ Ok: bool }
21
static member Pow(x: CustomPow, n: int) = { Ok = true }
22
23
+[<Fable.Core.Erase>]
24
+type WrappedNum = Num of int with
25
+ static member ( + ) (Num x, Num y) = 2 * (x + y) |> Num
26
+
27
+let addWrapped1 (x: WrappedNum) y = x + y
28
29
+let addWrapped2 (x: WrappedNum) y = x + Num y
30
31
let typeOperators = [
32
+ testCase "Can resolve custom operators on erased types" <| fun () -> // See #2915
33
+ addWrapped1 (Num 4) (Num 5) |> equal (Num 18)
34
+ addWrapped2 (Num 4) 5 |> equal (Num 18)
35
36
testCase "Custom operators with types work" <| fun () ->
37
let p1 = { x=5.; y=10. }
38
let p2 = { x=2.; y=1. }
0 commit comments