You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Fable.Transforms/Python/PYTHON-UNION.md
+57-10Lines changed: 57 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,8 @@ class MyUnion_CaseB(_MyUnion):
49
49
50
50
@tagged_union(2)
51
51
classMyUnion_CaseC(_MyUnion):
52
-
x: float
53
-
y: float
52
+
x_: float
53
+
y_: float
54
54
55
55
56
56
# Type alias - THE public union type for annotations
@@ -115,6 +115,27 @@ class ModuleB_Result_Error(_ModuleB_Result):
115
115
116
116
The scoped name is derived from `FSharp2Fable.Helpers.getEntityDeclarationName`, which includes the module path to ensure unique names across the entire compilation.
117
117
118
+
### Case Field Naming: `toFieldSnakeCase`
119
+
120
+
Case class field annotations use `Naming.toFieldSnakeCase` (in `Prelude.fs`), the same
121
+
convention as record fields:
122
+
123
+
- PascalCase names (including the compiler-generated `Item`, `Item1`, ...) convert to
5.[src/Fable.Transforms/Python/Fable2Python.Annotation.fs](src/Fable.Transforms/Python/Fable2Python.Annotation.fs) - Type annotation logic for union types
338
384
6.[src/Fable.Transforms/Python/Fable2Python.Reflection.fs](src/Fable.Transforms/Python/Fable2Python.Reflection.fs) - Case constructor generation
339
-
7.[src/Fable.Transforms/Python/Replacements.fs](src/Fable.Transforms/Python/Replacements.fs) - `tryConstructor` adds underscore for unions
385
+
7.[src/Fable.Transforms/Python/Replacements.fs](src/Fable.Transforms/Python/Replacements.fs) - `tryConstructor` redirects unions to the base class
386
+
8.[src/Fable.Transforms/FSharp2Fable.Util.fs](../FSharp2Fable.Util.fs) - `redirectUnionToPythonBaseClass` helper; static member access on `[<AttachMembers>]` unions (Python-gated)
0 commit comments