@@ -111,9 +111,9 @@ let makeArrowFunctionExpression
111111 let args =
112112 match args.PosOnlyArgs, args.Args with
113113 | [], [] ->
114- let ta = com.GetImportExpr( ctx, " typing " , " Any " )
114+ let ta = com.GetImportExpr( ctx, getLibPath com " util " , " Unit " )
115115
116- Arguments.arguments ( args = [ Arg.arg ( " __unit" , annotation = ta) ], defaults = [ Expression.none ])
116+ Arguments.arguments ( args = [ Arg.arg ( " __unit" , annotation = ta) ], defaults = [ Expression.tuple [] ])
117117 | _ -> args
118118
119119 let allDefaultsAreNone =
@@ -320,15 +320,15 @@ let transformCast (com: IPythonCompiler) (ctx: Context) t e : Expression * State
320320
321321 | _ -> com.TransformAsExpr( ctx, e)
322322 | Fable.Number( Float32, _), _ ->
323- let cons = libValue com ctx " types " " float32"
323+ let cons = libValue com ctx " core " " float32"
324324 let value , stmts = com.TransformAsExpr( ctx, e)
325325 Expression.call ( cons, [ value ], ?loc = None), stmts
326326 | Fable.Number( Float64, _), _ ->
327- let cons = libValue com ctx " types " " float64"
327+ let cons = libValue com ctx " core " " float64"
328328 let value , stmts = com.TransformAsExpr( ctx, e)
329329 Expression.call ( cons, [ value ], ?loc = None), stmts
330330 | Fable.Number( Int32, _), _ ->
331- let cons = libValue com ctx " types " " int32"
331+ let cons = libValue com ctx " core " " int32"
332332 let value , stmts = com.TransformAsExpr( ctx, e)
333333 Expression.call ( cons, [ value ], ?loc = None), stmts
334334 | _ -> com.TransformAsExpr( ctx, e)
@@ -393,9 +393,9 @@ let transformValue (com: IPythonCompiler) (ctx: Context) r value : Expression *
393393 | Fable.NumberValue.Float64 x when x = - infinity -> libValue com ctx " double" " float64.negative_infinity" , []
394394 | Fable.NumberValue.Float64 x when Double.IsNaN( x) -> libValue com ctx " double" " float64.nan" , []
395395 | Fable.NumberValue.Float32 x when Single.IsNaN( x) ->
396- libCall com ctx r " types " " float32" [ Expression.stringConstant " nan" ], []
396+ libCall com ctx r " core " " float32" [ Expression.stringConstant " nan" ], []
397397 | Fable.NumberValue.Float16 x when Single.IsNaN( x) ->
398- libCall com ctx r " types " " float32" [ Expression.stringConstant " nan" ], []
398+ libCall com ctx r " core " " float32" [ Expression.stringConstant " nan" ], []
399399 | Fable.NumberValue.Float16 x -> makeFloat com ctx r value.Type " float32" ( float x)
400400 | Fable.NumberValue.Float32 x -> makeFloat com ctx r value.Type " float32" ( float x)
401401 | Fable.NumberValue.Float64 x -> makeFloat com ctx r value.Type " float64" ( float x)
@@ -2977,21 +2977,23 @@ let transformFunction
29772977 args', finalDefaults, body
29782978
29792979 let arguments =
2980+ let unitDefault = libValue com ctx " util" " UNIT"
2981+
29802982 match args, isUnitOrGeneric, tcArgs with
29812983 // No args and no tail-call args: add __unit parameter
29822984 | [], _, [] ->
2983- let unitDefault = libValue com ctx " util" " UNIT"
2984- Arguments.arguments ( args = [ Arg.arg ( Identifier( " __unit" )) ], defaults = [ unitDefault ])
2985+ let unitType = com.GetImportExpr( ctx, getLibPath com " util" , " Unit" )
2986+
2987+ Arguments.arguments (
2988+ args = [ Arg.arg ( Identifier( " __unit" ), annotation = unitType) ],
2989+ defaults = [ unitDefault ]
2990+ )
29852991 // No args but has tail-call args: skip __unit, tcArgs are sufficient
29862992 | [], _, _ -> Arguments.arguments ( args = tcArgs, defaults = tcDefaults)
2987- // Single generic/unit arg with no tail-call args: keep it with UNIT default
2988- | [ arg ], true , [] ->
2989- let unitDefault = libValue com ctx " util" " UNIT"
2990- Arguments.arguments ( args = args, defaults = [ unitDefault ])
2993+ // Single generic/unit arg with no tail-call args: keep it with () default
2994+ | [ arg ], true , [] -> Arguments.arguments ( args = args, defaults = [ unitDefault ])
29912995 // Single generic/unit arg with tail-call args: keep arg (body may reference it)
2992- | [ arg ], true , _ ->
2993- let unitDefault = libValue com ctx " util" " UNIT"
2994- Arguments.arguments ( args @ tcArgs, defaults = unitDefault :: tcDefaults)
2996+ | [ arg ], true , _ -> Arguments.arguments ( args @ tcArgs, defaults = unitDefault :: tcDefaults)
29952997 | _ -> Arguments.arguments ( args @ tcArgs, defaults = defaults @ tcDefaults)
29962998
29972999 arguments, body
@@ -3828,7 +3830,7 @@ let transformUnion (com: IPythonCompiler) ctx (ent: Fable.Entity) (entName: stri
38283830 decoratorList = decorators
38293831 )
38303832
3831- let baseExpr = libValue com ctx " types " " Union" |> Some
3833+ let baseExpr = libValue com ctx " union " " Union" |> Some
38323834 let classMembers = List.append [ cases ] classMembers
38333835
38343836 declareType com ctx ent entName args isOptional body baseExpr classMembers None [] []
@@ -3853,9 +3855,9 @@ let transformClassWithCompilerGeneratedConstructor
38533855
38543856 let baseExpr =
38553857 if ent.IsFSharpExceptionDeclaration then
3856- libValue com ctx " types " " FSharpException" |> Some
3858+ libValue com ctx " exceptions " " FSharpException" |> Some
38573859 elif ent.IsFSharpRecord || ent.IsValueType then
3858- libValue com ctx " types " " Record" |> Some
3860+ libValue com ctx " record " " Record" |> Some
38593861 else
38603862 None
38613863
@@ -4055,7 +4057,7 @@ let transformClassWithPrimaryConstructor
40554057 |> extractBaseExprFromBaseCall com ctx classEnt.BaseType
40564058 |> Option.orElseWith ( fun () ->
40574059 if classEnt.IsValueType then
4058- Some( libValue com ctx " Types " " Record" , ([], [], []))
4060+ Some( libValue com ctx " record " " Record" , ([], [], []))
40594061 else
40604062 None
40614063 )
0 commit comments