Skip to content

Commit 87fd129

Browse files
Kamiruscursoragent
andauthored
spec: align IDL-Motoko.md with Float32 support (#6094)
## Summary - Adds `e(Float32) = float32` and `i(float32) = Float32` to the type mapping tables. - Removes the note that said importing `float32` was unsupported/failing. ## Why `Float32` support was shipped in #5906, which updated both `idl_to_mo.ml` and `mo_to_idl.ml` to handle the `float32 ↔ Float32` mapping. The spec doc (`design/IDL-Motoko.md`) was not updated at the time, leaving it contradicting the implementation. This is a companion to a fix in [dfinity/candid](https://github.com/dfinity/candid/pull/new/fix/motoko-binding-float32) where `didc bind --target mo` panics on any `.did` file containing `float32`, because it (correctly) follows the now-outdated spec. Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c9b3b23 commit 87fd129

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

design/IDL-Motoko.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ e(Nat) = nat
8585
e(Int) = int
8686
e(Nat<n>) = nat<n> for n = 8, 16, 32, 64
8787
e(Int<n>) = int<n> for n = 8, 16, 32, 64
88+
e(Float32) = float32
8889
e(Float) = float64
8990
e(Char) = nat32
9091
e(Text) = text
@@ -135,7 +136,7 @@ i(nat) = Nat
135136
i(int) = Int
136137
i(nat<n>) = Nat<n> for n = 8, 16, 32, 64
137138
i(int<n>) = Int<n> for n = 8, 16, 32, 64
138-
// i(float32) not defined
139+
i(float32) = Float32
139140
i(float64) = Float
140141
i(text) = Text
141142
i(reserved) = Any
@@ -256,9 +257,6 @@ escape_method <name> = (* failure, unsupported *)
256257
```
257258
In other words: Motoko subtyping must be contained in IDL subtyping.
258259

259-
* There is no way to produce `float32`.
260-
Importing interfaces that contain `float32` types fails.
261-
262260
* The functions `escape`/`unescape` ensure round-tripping of IDL field names
263261
through Motoko types. See `IDL-Motoko.proofs.md` for details.
264262

0 commit comments

Comments
 (0)