Skip to content

Commit 8e39ce3

Browse files
authored
feat: Upgrade Fable to 5.16 (#394)
* feat: Upgrade Fable to 5.15 * feat: Upgrade Fable to 5.16
1 parent 2727c34 commit 8e39ce3

5 files changed

Lines changed: 73 additions & 68 deletions

File tree

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"rollForward": false
1111
},
1212
"fable": {
13-
"version": "5.13.0",
13+
"version": "5.16.0",
1414
"commands": [
1515
"fable"
1616
],

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">= 3.12, < 4"
77
readme = "README.md"
88
license = "MIT"
99
dependencies = [
10-
"fable-library==5.13.0",
10+
"fable-library==5.16.0",
1111
"pyright>=1.1.411",
1212
]
1313

src/fable/Types.fs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Utilities for detecting and working with Fable types at runtime in Python.
22
/// These helpers are useful when you need to distinguish between native Python types
3-
/// and Fable-compiled F# types (e.g., Int32, Float64, FSharpArray).
3+
/// and Fable-compiled F# types (e.g., int, float, Int64, FSharpArray).
44
module Fable.Python.Fable.Types
55

66
open Fable.Core
@@ -9,9 +9,11 @@ open Fable.Core
99
[<Emit("type($0).__name__")>]
1010
let typeName (o: obj) : string = nativeOnly
1111

12-
/// Check if an object is a Fable integral type (Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64)
12+
/// Check if an object is an F# integral type.
13+
/// The default F# int compiles to Python's native int; other widths use Fable runtime types.
1314
let isIntegralType (o: obj) : bool =
1415
match typeName o with
16+
| "int"
1517
| "Int8"
1618
| "Int16"
1719
| "Int32"
@@ -22,9 +24,12 @@ let isIntegralType (o: obj) : bool =
2224
| "UInt64" -> true
2325
| _ -> false
2426

25-
/// Check if an object is a Fable numeric type (integral types + Float32, Float64)
27+
/// Check if an object is an F# numeric type.
28+
/// The default F# int and float compile to Python's native int and float.
2629
let isNumericType (o: obj) : bool =
2730
match typeName o with
31+
| "int"
32+
| "float"
2833
| "Int8"
2934
| "Int16"
3035
| "Int32"

test/TestTypes.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ open Fable.Python.Fable.Types
66
// Test typeName function
77

88
[<Fact>]
9-
let ``test typeName returns Int32 for int`` () =
9+
let ``test typeName returns int for int`` () =
1010
let value = 42
11-
typeName value |> equal "Int32"
11+
typeName value |> equal "int"
1212

1313
[<Fact>]
1414
let ``test typeName returns Int64 for int64`` () =
1515
let value = 42L
1616
typeName value |> equal "Int64"
1717

1818
[<Fact>]
19-
let ``test typeName returns Float64 for float`` () =
19+
let ``test typeName returns float for float`` () =
2020
let value = 3.14
21-
typeName value |> equal "Float64"
21+
typeName value |> equal "float"
2222

2323
[<Fact>]
2424
let ``test typeName returns str for string`` () =

0 commit comments

Comments
 (0)