diff --git a/src/Fable.Transforms/Python/Fable2Python.fs b/src/Fable.Transforms/Python/Fable2Python.fs index 159fcb4fd8..0073c5a42b 100644 --- a/src/Fable.Transforms/Python/Fable2Python.fs +++ b/src/Fable.Transforms/Python/Fable2Python.fs @@ -3082,14 +3082,6 @@ module Util = // printfn "transformGet: %A" (fableExpr.Type) match kind with - | Fable.FieldGet { Name = "message" } -> - let func = Expression.name "str" - let left, stmts = com.TransformAsExpr(ctx, fableExpr) - Expression.call (func, [ left ]), stmts - | Fable.FieldGet { Name = "push" } -> - let attr = Identifier("append") - let value, stmts = com.TransformAsExpr(ctx, fableExpr) - Expression.attribute (value = value, attr = attr, ctx = Load), stmts | Fable.ExprGet(TransformExpr com ctx (prop, stmts)) -> let expr, stmts' = com.TransformAsExpr(ctx, fableExpr) let expr, stmts'' = getExpr com ctx range expr prop diff --git a/src/Fable.Transforms/Python/Replacements.fs b/src/Fable.Transforms/Python/Replacements.fs index 31fd08804d..0e3c81cac2 100644 --- a/src/Fable.Transforms/Python/Replacements.fs +++ b/src/Fable.Transforms/Python/Replacements.fs @@ -2829,7 +2829,7 @@ let resizeArrays | "set_Item", Some ar, [ idx; value ] -> setExpr r ar idx value |> Some | "Add", Some ar, [ arg ] -> "void ($0)" - |> emitExpr r t [ Helper.InstanceCall(ar, "push", t, [ arg ]) ] + |> emitExpr r t [ Helper.InstanceCall(ar, "append", t, [ arg ]) ] |> Some | "Remove", Some ar, [ arg ] -> let args = @@ -4625,7 +4625,8 @@ let exceptions | ".ctor", _ -> Helper.ConstructorCall(makeIdentExpr "Exception", t, args, ?loc = r) |> Some - | "get_Message", Some e -> getFieldWith r t e "message" |> Some + | "get_Message", Some e -> + Helper.GlobalCall("str", t, [ thisArg.Value ], ?loc = r) |> Some | "get_StackTrace", Some e -> getFieldWith r t e "stack" |> Some | _ -> None diff --git a/tests/Python/TestApplicative.fs b/tests/Python/TestApplicative.fs index b4bf0544b0..5b36fde227 100644 --- a/tests/Python/TestApplicative.fs +++ b/tests/Python/TestApplicative.fs @@ -1174,7 +1174,7 @@ let ``test Curried function options work`` () = // See https://github.com/fable-compiler/Fable/issues/1199#issuecomment-347101093 [] let ``test Applying function options works`` () = - Pointful.testFunctionOptions + Pointful.testFunctionOptions () [] let ``test Point-free and partial application work`` () = // See #1199 @@ -1215,7 +1215,7 @@ let ``test Uncurried functions in record fields can be partially applied`` () = // See https://github.com/fable-compiler/Fable/issues/1199#issuecomment-347190893 [] let ``test Applicative operators work with three-argument functions``() = - Results.testOperatorsWith3Args + Results.testOperatorsWith3Args () [] let ``test partialApply works with tuples`` () = diff --git a/tests/Python/TestMisc.fs b/tests/Python/TestMisc.fs index b6f3201ea5..e82db6f07f 100644 --- a/tests/Python/TestMisc.fs +++ b/tests/Python/TestMisc.fs @@ -1329,7 +1329,7 @@ let ``test conditional expressions`` () = // See #2782 | U2.Case2 s when s.t1 <> "" -> s.t1 | _ -> "" - equal(test (U2.Case1 "x"), "x") + test (U2.Case1 "x") |> equal "x" type Æøå = | Union1 of string diff --git a/tests/Python/TestPyInterop.fs b/tests/Python/TestPyInterop.fs index 1af9893459..809a33bdc1 100644 --- a/tests/Python/TestPyInterop.fs +++ b/tests/Python/TestPyInterop.fs @@ -52,6 +52,7 @@ type Props = [] type PyArray = + [] abstract push: item: obj -> unit [] abstract length: int diff --git a/tests/Python/TestSeq.fs b/tests/Python/TestSeq.fs index 5b54a8b025..5b7d500cf4 100644 --- a/tests/Python/TestSeq.fs +++ b/tests/Python/TestSeq.fs @@ -54,7 +54,7 @@ let ``test Can test untyped enumerables`` () = sumEnumerable xs |> equal 3 sumEnumerable ys |> equal 7 sumEnumerable zs |> equal -1 - + [] let ``test Seq.length works`` () = let xs = [1.; 2.; 3.; 4.] @@ -216,7 +216,7 @@ let ``test Seq.find works`` () = [] let ``test Seq.findIndex works`` () = let xs = [1.; 2.; 3.; 4.] - xs |> Seq.findIndex ((=) 2.) + xs |> Seq.findIndex ((=) 2.) |> equal 1 [] let ``test Seq.findBack works`` () =