@@ -373,7 +373,7 @@ module Util =
373373 makeNativeTypeAnnotation com ctx [ genArg] " Array"
374374
375375 and makeListTypeAnnotation com ctx genArg =
376- makeImportTypeAnnotation com ctx [ genArg] " Types " " List"
376+ makeImportTypeAnnotation com ctx [ genArg] " List " " List"
377377
378378 and makeUnionTypeAnnotation com ctx genArgs =
379379 List.map ( typeAnnotation com ctx) genArgs
@@ -808,12 +808,12 @@ module Util =
808808 | Fable.NewTuple vals -> makeTypedArray com ctx Fable.Any ( Fable.ArrayValues vals)
809809 // Optimization for bundle size: compile list literals as List.ofArray
810810 | Replacements.ListLiteral( exprs, t) ->
811- [| List.rev exprs |> makeArray com ctx|] |> coreLibConstructorCall com ctx " Types " " List "
811+ [| List.rev exprs |> makeArray com ctx|] |> coreLibCall com ctx r " List " " newList "
812812 | Fable.NewList ( headAndTail, _) ->
813813 match headAndTail with
814- | None -> coreLibConstructorCall com ctx " Types " " List " [||]
814+ | None -> coreLibCall com ctx r " List " " newList " [||]
815815 | Some( TransformExpr com ctx head, TransformExpr com ctx tail) ->
816- callFunction r ( get None tail " add " ) [ head]
816+ coreLibCall com ctx r " List " " cons " [| head; tail | ]
817817 | Fable.NewOption ( value, t) ->
818818 match value with
819819 | Some ( TransformExpr com ctx e) ->
@@ -1053,8 +1053,8 @@ module Util =
10531053 let expr = com.TransformAsExpr( ctx, fableExpr)
10541054 match getKind with
10551055 | Fable.ExprGet( TransformExpr com ctx prop) -> getExpr range expr prop
1056- | Fable.ListHead -> get range expr " head"
1057- | Fable.ListTail -> get range expr " tail"
1056+ | Fable.ListHead -> coreLibCall com ctx range " List " " head" [| expr |]
1057+ | Fable.ListTail -> coreLibCall com ctx range " List " " tail" [| expr |]
10581058 | Fable.FieldGet( fieldName,_,_) ->
10591059 let expr =
10601060 match fableExpr with
@@ -1150,7 +1150,7 @@ module Util =
11501150 | Fable.FunctionType _ -> jsTypeof " function" expr
11511151 | Fable.Array _ | Fable.Tuple _ ->
11521152 coreLibCall com ctx None " Util" " isArrayLike" [| com.TransformAsExpr( ctx, expr)|]
1153- | Fable.List _ -> jsInstanceof ( coreValue com ctx " Types " " List" ) expr
1153+ | Fable.List _ -> jsInstanceof ( coreValue com ctx " List " " List" ) expr
11541154 | Replacements.Builtin kind ->
11551155 match kind with
11561156 | Replacements.BclGuid -> jsTypeof " string" expr
@@ -1211,7 +1211,7 @@ module Util =
12111211 let op = if nonEmpty then BinaryUnequal else BinaryEqual
12121212 upcast BinaryExpression( op, com.TransformAsExpr( ctx, expr), NullLiteral(), ?loc= range)
12131213 | Fable.ListTest nonEmpty ->
1214- let expr = get range ( com.TransformAsExpr( ctx, expr)) " isEmpty "
1214+ let expr = coreLibCall com ctx range " List " " isEmpty " [| com.TransformAsExpr( ctx, expr)|]
12151215 if nonEmpty then upcast UnaryExpression( UnaryNot, expr, ?loc= range)
12161216 else expr
12171217 | Fable.UnionCaseTest( uci, ent) ->
0 commit comments