Repository: bytecodealliance/wasm-tools
Pull request #1467 (2024-03-21 23:02:04)

Make the variant tag size match the Canonical ABI.
The `discriminant_type` function in the [Canonical ABI] returns `u8` for a variant with 256 cases. Fix wit-parser's `tag()` function to match it.

[Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md


Patch:
diff --git a/crates/wasm-encoder/src/component/types.rs b/crates/wasm-encoder/src/component/types.rs
index 537e8c5a..72e0034b 100644
--- a/crates/wasm-encoder/src/component/types.rs
+++ b/crates/wasm-encoder/src/component/types.rs
@@ -497,10 +497,10 @@ pub enum PrimitiveValType {
     S64,
     /// The type is an unsigned 64-bit integer.
     U64,
-    /// The type is a 32-bit floating point number.
-    Float32,
-    /// The type is a 64-bit floating point number.
-    Float64,
+    /// The type is a 32-bit floating point number with only one NaN.
+    F32,
+    /// The type is a 64-bit floating point number with only one NaN.
+    F64,
     /// The type is a Unicode character.
     Char,
     /// The type is a string.
@@ -519,8 +519,8 @@ impl Encode for PrimitiveValType {
             Self::U32 => 0x79,
             Self::S64 => 0x78,
             Self::U64 => 0x77,
-            Self::Float32 => 0x76,
-            Self::Float64 => 0x75,
+            Self::F32 => 0x76,
+            Self::F64 => 0x75,
             Self::Char => 0x74,
             Self::String => 0x73,
         });
@@ -540,8 +540,8 @@ impl From<wasmparser::PrimitiveValType> for PrimitiveValType {
             wasmparser::PrimitiveValType::U32 => PrimitiveValType::U32,
             wasmparser::PrimitiveValType::S64 => PrimitiveValType::S64,
             wasmparser::PrimitiveValType::U64 => PrimitiveValType::U64,
-            wasmparser::PrimitiveValType::Float32 => PrimitiveValType::Float32,
-            wasmparser::PrimitiveValType::Float64 => PrimitiveValType::Float64,
+            wasmparser::PrimitiveValType::F32 => PrimitiveValType::F32,
+            wasmparser::PrimitiveValType::F64 => PrimitiveValType::F64,
             wasmparser::PrimitiveValType::Char => PrimitiveValType::Char,
             wasmparser::PrimitiveValType::String => PrimitiveValType::String,
         }
diff --git a/crates/wasm-smith/src/component.rs b/crates/wasm-smith/src/component.rs
index 7a85b2bf..a021df3d 100644
--- a/crates/wasm-smith/src/component.rs
+++ b/crates/wasm-smith/src/component.rs
@@ -1308,8 +1308,8 @@ impl ComponentBuilder {
             6 => Ok(PrimitiveValType::U32),
             7 => Ok(PrimitiveValType::S64),
             8 => Ok(PrimitiveValType::U64),
-            9 => Ok(PrimitiveValType::Float32),
-            10 => Ok(PrimitiveValType::Float64),
+            9 => Ok(PrimitiveValType::F32),
+            10 => Ok(PrimitiveValType::F64),
             11 => Ok(PrimitiveValType::Char),
             12 => Ok(PrimitiveValType::String),
             _ => unreachable!(),
@@ -1773,8 +1773,8 @@ fn canonical_abi_for(func_ty: &FuncType) -> Rc<crate::core::FuncType> {
             | PrimitiveValType::S32
             | PrimitiveValType::U32 => ValType::I32,
             PrimitiveValType::S64 | PrimitiveValType::U64 => ValType::I64,
-            PrimitiveValType::Float32 => ValType::F32,
-            PrimitiveValType::Float64 => ValType::F64,
+            PrimitiveValType::F32 => ValType::F32,
+            PrimitiveValType::F64 => ValType::F64,
             PrimitiveValType::String => {
                 unimplemented!("non-scalar types are not supported yet")
             }
@@ -1819,8 +1819,8 @@ fn inverse_scalar_canonical_abi_for(
                 ComponentValType::Primitive(PrimitiveValType::U64),
             ])
             .cloned(),
-        ValType::F32 => Ok(ComponentValType::Primitive(PrimitiveValType::Float32)),
-        ValType::F64 => Ok(ComponentValType::Primitive(PrimitiveValType::Float64)),
+        ValType::F32 => Ok(ComponentValType::Primitive(PrimitiveValType::F32)),
+        ValType::F64 => Ok(ComponentValType::Primitive(PrimitiveValType::F64)),
         ValType::V128 | ValType::Ref(_) => {
             unreachable!("not used in canonical ABI")
         }
@@ -2055,8 +2055,8 @@ fn is_scalar(ty: &ComponentValType) -> bool {
             | PrimitiveValType::U32
             | PrimitiveValType::S64
             | PrimitiveValType::U64
-            | PrimitiveValType::Float32
-            | PrimitiveValType::Float64
+            | PrimitiveValType::F32
+            | PrimitiveValType::F64
             | PrimitiveValType::Char => true,
             PrimitiveValType::String => false,
         },
diff --git a/crates/wasmparser/src/readers/component/types.rs b/crates/wasmparser/src/readers/component/types.rs
index b2a79632..6e589f5a 100644
--- a/crates/wasmparser/src/readers/component/types.rs
+++ b/crates/wasmparser/src/readers/component/types.rs
@@ -163,10 +163,10 @@ pub enum PrimitiveValType {
     S64,
     /// The type is an unsigned 64-bit integer.
     U64,
-    /// The type is a 32-bit floating point number.
-    Float32,
-    /// The type is a 64-bit floating point number.
-    Float64,
+    /// The type is a 32-bit floating point number with only one NaN.
+    F32,
+    /// The type is a 64-bit floating point number with only one NaN.
+    F64,
     /// The type is a Unicode character.
     Char,
     /// The type is a string.
@@ -185,8 +185,8 @@ impl PrimitiveValType {
             0x79 => PrimitiveValType::U32,
             0x78 => PrimitiveValType::S64,
             0x77 => PrimitiveValType::U64,
-            0x76 => PrimitiveValType::Float32,
-            0x75 => PrimitiveValType::Float64,
+            0x76 => PrimitiveValType::F32,
+            0x75 => PrimitiveValType::F64,
             0x74 => PrimitiveValType::Char,
             0x73 => PrimitiveValType::String,
             _ => return None,
@@ -222,8 +222,8 @@ impl fmt::Display for PrimitiveValType {
             U32 => "u32",
             S64 => "s64",
             U64 => "u64",
-            Float32 => "float32",
-            Float64 => "float64",
+            F32 => "f32",
+            F64 => "f64",
             Char => "char",
             String => "string",
         };
diff --git a/crates/wasmparser/src/validator/types.rs b/crates/wasmparser/src/validator/types.rs
index 36fe48d9..5f8791e0 100644
--- a/crates/wasmparser/src/validator/types.rs
+++ b/crates/wasmparser/src/validator/types.rs
@@ -132,8 +132,8 @@ fn push_primitive_wasm_types(ty: &PrimitiveValType, lowered_types: &mut LoweredT
         | PrimitiveValType::U32
         | PrimitiveValType::Char => lowered_types.push(ValType::I32),
         PrimitiveValType::S64 | PrimitiveValType::U64 => lowered_types.push(ValType::I64),
-        PrimitiveValType::Float32 => lowered_types.push(ValType::F32),
-        PrimitiveValType::Float64 => lowered_types.push(ValType::F64),
+        PrimitiveValType::F32 => lowered_types.push(ValType::F32),
+        PrimitiveValType::F64 => lowered_types.push(ValType::F64),
         PrimitiveValType::String => {
             lowered_types.push(ValType::I32) && lowered_types.push(ValType::I32)
         }
diff --git a/crates/wasmprinter/src/lib.rs b/crates/wasmprinter/src/lib.rs
index 48908c66..7cce235e 100644
--- a/crates/wasmprinter/src/lib.rs
+++ b/crates/wasmprinter/src/lib.rs
@@ -1631,8 +1631,8 @@ impl Printer {
             PrimitiveValType::U32 => self.result.push_str("u32"),
             PrimitiveValType::S64 => self.result.push_str("s64"),
             PrimitiveValType::U64 => self.result.push_str("u64"),
-            PrimitiveValType::Float32 => self.result.push_str("float32"),
-            PrimitiveValType::Float64 => self.result.push_str("float64"),
+            PrimitiveValType::F32 => self.result.push_str("f32"),
+            PrimitiveValType::F64 => self.result.push_str("f64"),
             PrimitiveValType::Char => self.result.push_str("char"),
             PrimitiveValType::String => self.result.push_str("string"),
         }
diff --git a/crates/wast/src/component/binary.rs b/crates/wast/src/component/binary.rs
index a57cc0f9..90129430 100644
--- a/crates/wast/src/component/binary.rs
+++ b/crates/wast/src/component/binary.rs
@@ -780,8 +780,8 @@ impl From<PrimitiveValType> for wasm_encoder::PrimitiveValType {
             PrimitiveValType::U32 => Self::U32,
             PrimitiveValType::S64 => Self::S64,
             PrimitiveValType::U64 => Self::U64,
-            PrimitiveValType::Float32 => Self::Float32,
-            PrimitiveValType::Float64 => Self::Float64,
+            PrimitiveValType::F32 => Self::F32,
+            PrimitiveValType::F64 => Self::F64,
             PrimitiveValType::Char => Self::Char,
             PrimitiveValType::String => Self::String,
         }
diff --git a/crates/wast/src/component/types.rs b/crates/wast/src/component/types.rs
index 72eced02..dc8a91fd 100644
--- a/crates/wast/src/component/types.rs
+++ b/crates/wast/src/component/types.rs
@@ -230,8 +230,8 @@ pub enum PrimitiveValType {
     U32,
     S64,
     U64,
-    Float32,
-    Float64,
+    F32,
+    F64,
     Char,
     String,
 }
@@ -266,12 +266,18 @@ impl<'a> Parse<'a> for PrimitiveValType {
         } else if l.peek::<kw::u64>()? {
             parser.parse::<kw::u64>()?;
             Ok(Self::U64)
+        } else if l.peek::<kw::f32>()? {
+            parser.parse::<kw::f32>()?;
+            Ok(Self::F32)
+        } else if l.peek::<kw::f64>()? {
+            parser.parse::<kw::f64>()?;
+            Ok(Self::F64)
         } else if l.peek::<kw::float32>()? {
             parser.parse::<kw::float32>()?;
-            Ok(Self::Float32)
+            Ok(Self::F32)
         } else if l.peek::<kw::float64>()? {
             parser.parse::<kw::float64>()?;
-            Ok(Self::Float64)
+            Ok(Self::F64)
         } else if l.peek::<kw::char>()? {
             parser.parse::<kw::char>()?;
             Ok(Self::Char)
@@ -297,6 +303,8 @@ impl Peek for PrimitiveValType {
                 | Some(("u32", _))
                 | Some(("s64", _))
                 | Some(("u64", _))
+                | Some(("f32", _))
+                | Some(("f64", _))
                 | Some(("float32", _))
                 | Some(("float64", _))
                 | Some(("char", _))
diff --git a/crates/wast/src/component/wast.rs b/crates/wast/src/component/wast.rs
index 72d8bf15..28f1ce26 100644
--- a/crates/wast/src/component/wast.rs
+++ b/crates/wast/src/component/wast.rs
@@ -1,6 +1,6 @@
 use crate::kw;
 use crate::parser::{Cursor, Parse, Parser, Peek, Result};
-use crate::token::{Float32, Float64};
+use crate::token::{F32, F64};
 
 /// Expression that can be used inside of `invoke` expressions for core wasm
 /// functions.
@@ -16,8 +16,8 @@ pub enum WastVal<'a> {
     S32(i32),
     U64(u64),
     S64(i64),
-    Float32(Float32),
-    Float64(Float64),
+    F32(F32),
+    F64(F64),
     Char(char),
     String(&'a str),
     List(Vec<WastVal<'a>>),
@@ -53,8 +53,8 @@ static CASES: &[(&str, fn(Parser<'_>) -> Result<WastVal<'_>>)] = {
         ("s32.const", |p| Ok(S32(p.parse()?))),
         ("u64.const", |p| Ok(U64(p.parse()?))),
         ("s64.const", |p| Ok(S64(p.parse()?))),
-        ("f32.const", |p| Ok(Float32(p.parse()?))),
-        ("f64.const", |p| Ok(Float64(p.parse()?))),
+        ("f32.const", |p| Ok(F32(p.parse()?))),
+        ("f64.const", |p| Ok(F64(p.parse()?))),
         ("char.const", |p| {
             let s = p.parse::<&str>()?;
             let mut ch = s.chars();
diff --git a/crates/wast/src/core/binary.rs b/crates/wast/src/core/binary.rs
index d8860217..3023d543 100644
--- a/crates/wast/src/core/binary.rs
+++ b/crates/wast/src/core/binary.rs
@@ -832,13 +832,13 @@ impl Encode for BrTableIndices<'_> {
     }
 }
 
-impl Encode for Float32 {
+impl Encode for F32 {
     fn encode(&self, e: &mut Vec<u8>) {
         e.extend_from_slice(&self.bits.to_le_bytes());
     }
 }
 
-impl Encode for Float64 {
+impl Encode for F64 {
     fn encode(&self, e: &mut Vec<u8>) {
         e.extend_from_slice(&self.bits.to_le_bytes());
     }
diff --git a/crates/wast/src/core/expr.rs b/crates/wast/src/core/expr.rs
index 4ab4df8a..26622e15 100644
--- a/crates/wast/src/core/expr.rs
+++ b/crates/wast/src/core/expr.rs
@@ -571,8 +571,8 @@ instructions! {
 
         I32Const(i32) : [0x41] : "i32.const",
         I64Const(i64) : [0x42] : "i64.const",
-        F32Const(Float32) : [0x43] : "f32.const",
-        F64Const(Float64) : [0x44] : "f64.const",
+        F32Const(F32) : [0x43] : "f32.const",
+        F64Const(F64) : [0x44] : "f64.const",
 
         I32Clz : [0x67] : "i32.clz",
         I32Ctz : [0x68] : "i32.ctz",
@@ -1738,8 +1738,8 @@ pub enum V128Const {
     I16x8([i16; 8]),
     I32x4([i32; 4]),
     I64x2([i64; 2]),
-    F32x4([Float32; 4]),
-    F64x2([Float64; 2]),
+    F32x4([F32; 4]),
+    F64x2([F64; 2]),
 }
 
 impl V128Const {
diff --git a/crates/wast/src/core/memory.rs b/crates/wast/src/core/memory.rs
index 436afa94..174d9790 100644
--- a/crates/wast/src/core/memory.rs
+++ b/crates/wast/src/core/memory.rs
@@ -248,8 +248,8 @@ impl<'a> Parse<'a> for DataVal<'a> {
                 || consume::<kw::i16, i16, _>(p, l, r, |u, v| v.extend(&u.to_le_bytes()))?
                 || consume::<kw::i32, i32, _>(p, l, r, |u, v| v.extend(&u.to_le_bytes()))?
                 || consume::<kw::i64, i64, _>(p, l, r, |u, v| v.extend(&u.to_le_bytes()))?
-                || consume::<kw::f32, Float32, _>(p, l, r, |u, v| v.extend(&u.bits.to_le_bytes()))?
-                || consume::<kw::f64, Float64, _>(p, l, r, |u, v| v.extend(&u.bits.to_le_bytes()))?
+                || consume::<kw::f32, F32, _>(p, l, r, |u, v| v.extend(&u.bits.to_le_bytes()))?
+                || consume::<kw::f64, F64, _>(p, l, r, |u, v| v.extend(&u.bits.to_le_bytes()))?
                 || consume::<kw::v128, V128Const, _>(p, l, r, |u, v| v.extend(&u.to_le_bytes()))?
             {
                 Ok(DataVal::Integral(result))
diff --git a/crates/wast/src/core/wast.rs b/crates/wast/src/core/wast.rs
index d81a1c9e..9dd9a923 100644
--- a/crates/wast/src/core/wast.rs
+++ b/crates/wast/src/core/wast.rs
@@ -1,7 +1,7 @@
 use crate::core::{HeapType, V128Const};
 use crate::kw;
 use crate::parser::{Cursor, Parse, Parser, Peek, Result};
-use crate::token::{Float32, Float64, Index};
+use crate::token::{Index, F32, F64};
 
 /// Expression that can be used inside of `invoke` expressions for core wasm
 /// functions.
@@ -10,8 +10,8 @@ use crate::token::{Float32, Float64, Index};
 pub enum WastArgCore<'a> {
     I32(i32),
     I64(i64),
-    F32(Float32),
-    F64(Float64),
+    F32(F32),
+    F64(F64),
     V128(V128Const),
     RefNull(HeapType<'a>),
     RefExtern(u32),
@@ -67,8 +67,8 @@ impl Peek for WastArgCore<'_> {
 pub enum WastRetCore<'a> {
     I32(i32),
     I64(i64),
-    F32(NanPattern<Float32>),
-    F64(NanPattern<Float64>),
+    F32(NanPattern<F32>),
+    F64(NanPattern<F64>),
     V128(V128Pattern),
 
     /// A null reference is expected, optionally with a specified type.
@@ -188,8 +188,8 @@ pub enum V128Pattern {
     I16x8([i16; 8]),
     I32x4([i32; 4]),
     I64x2([i64; 2]),
-    F32x4([NanPattern<Float32>; 4]),
-    F64x2([NanPattern<Float64>; 2]),
+    F32x4([NanPattern<F32>; 4]),
+    F64x2([NanPattern<F64>; 2]),
 }
 
 impl<'a> Parse<'a> for V128Pattern {
diff --git a/crates/wast/src/token.rs b/crates/wast/src/token.rs
index e5a3d9ba..b2963410 100644
--- a/crates/wast/src/token.rs
+++ b/crates/wast/src/token.rs
@@ -639,13 +639,13 @@ macro_rules! float {
 }
 
 float! {
-    Float32 => {
+    F32 => {
         bits: u32,
         float: f32,
         exponent_bits: 8,
         name: strtof,
     }
-    Float64 => {
+    F64 => {
         bits: u64,
         float: f64,
         exponent_bits: 11,
diff --git a/crates/wit-component/src/encoding/types.rs b/crates/wit-component/src/encoding/types.rs
index d660612e..6a47c26c 100644
--- a/crates/wit-component/src/encoding/types.rs
+++ b/crates/wit-component/src/encoding/types.rs
@@ -117,8 +117,8 @@ pub trait ValtypeEncoder<'a> {
             Type::S16 => ComponentValType::Primitive(PrimitiveValType::S16),
             Type::S32 => ComponentValType::Primitive(PrimitiveValType::S32),
             Type::S64 => ComponentValType::Primitive(PrimitiveValType::S64),
-            Type::Float32 => ComponentValType::Primitive(PrimitiveValType::Float32),
-            Type::Float64 => ComponentValType::Primitive(PrimitiveValType::Float64),
+            Type::F32 => ComponentValType::Primitive(PrimitiveValType::F32),
+            Type::F64 => ComponentValType::Primitive(PrimitiveValType::F64),
             Type::Char => ComponentValType::Primitive(PrimitiveValType::Char),
             Type::String => ComponentValType::Primitive(PrimitiveValType::String),
             Type::Id(id) => {
diff --git a/crates/wit-component/src/printing.rs b/crates/wit-component/src/printing.rs
index 6a4074c2..f5be31c1 100644
--- a/crates/wit-component/src/printing.rs
+++ b/crates/wit-component/src/printing.rs
@@ -443,18 +443,18 @@ impl WitPrinter {
             Type::S16 => self.output.push_str("s16"),
             Type::S32 => self.output.push_str("s32"),
             Type::S64 => self.output.push_str("s64"),
-            Type::Float32 => {
+            Type::F32 => {
                 if self.print_f32_f64 {
                     self.output.push_str("f32")
                 } else {
-                    self.output.push_str("float32")
+                    self.output.push_str("f32")
                 }
             }
-            Type::Float64 => {
+            Type::F64 => {
                 if self.print_f32_f64 {
                     self.output.push_str("f64")
                 } else {
-                    self.output.push_str("float64")
+                    self.output.push_str("f64")
                 }
             }
             Type::Char => self.output.push_str("char"),
@@ -621,8 +621,8 @@ impl WitPrinter {
             | Type::S16
             | Type::S32
             | Type::S64
-            | Type::Float32
-            | Type::Float64
+            | Type::F32
+            | Type::F64
             | Type::Char
             | Type::String => return Ok(()),
 
@@ -893,6 +893,8 @@ fn is_keyword(name: &str) -> bool {
             | "s16"
             | "s32"
             | "s64"
+            | "f32"
+            | "f64"
             | "float32"
             | "float64"
             | "char"
diff --git a/crates/wit-parser/src/abi.rs b/crates/wit-parser/src/abi.rs
index 1ea01acc..f3d7fc82 100644
--- a/crates/wit-parser/src/abi.rs
+++ b/crates/wit-parser/src/abi.rs
@@ -210,8 +210,8 @@ impl Resolve {
             | Type::Char => result.push(WasmType::I32),
 
             Type::U64 | Type::S64 => result.push(WasmType::I64),
-            Type::Float32 => result.push(WasmType::F32),
-            Type::Float64 => result.push(WasmType::F64),
+            Type::F32 => result.push(WasmType::F32),
+            Type::F64 => result.push(WasmType::F64),
             Type::String => {
                 result.push(WasmType::Pointer);
                 result.push(WasmType::Length);
diff --git a/crates/wit-parser/src/ast.rs b/crates/wit-parser/src/ast.rs
index 64592f5c..835b39aa 100644
--- a/crates/wit-parser/src/ast.rs
+++ b/crates/wit-parser/src/ast.rs
@@ -540,8 +540,8 @@ enum Type<'a> {
     S16,
     S32,
     S64,
-    Float32,
-    Float64,
+    F32,
+    F64,
     Char,
     String,
     Name(Id<'a>),
@@ -970,8 +970,8 @@ impl<'a> Type<'a> {
             Some((_span, Token::S16)) => Ok(Type::S16),
             Some((_span, Token::S32)) => Ok(Type::S32),
             Some((_span, Token::S64)) => Ok(Type::S64),
-            Some((_span, Token::Float32)) => Ok(Type::Float32),
-            Some((_span, Token::Float64)) => Ok(Type::Float64),
+            Some((_span, Token::F32)) => Ok(Type::F32),
+            Some((_span, Token::F64)) => Ok(Type::F64),
             Some((_span, Token::Char)) => Ok(Type::Char),
 
             // tuple<T, U, ...>
diff --git a/crates/wit-parser/src/ast/lex.rs b/crates/wit-parser/src/ast/lex.rs
index 22409c81..e7a45fcf 100644
--- a/crates/wit-parser/src/ast/lex.rs
+++ b/crates/wit-parser/src/ast/lex.rs
@@ -63,8 +63,8 @@ pub enum Token {
     S16,
     S32,
     S64,
-    Float32,
-    Float64,
+    F32,
+    F64,
     Char,
     Record,
     Resource,
@@ -293,10 +293,10 @@ impl<'a> Tokenizer<'a> {
                     "s16" => S16,
                     "s32" => S32,
                     "s64" => S64,
-                    "f32" => Float32,
-                    "f64" => Float64,
-                    "float32" if !self.require_f32_f64 => Float32,
-                    "float64" if !self.require_f32_f64 => Float64,
+                    "f32" => F32,
+                    "f64" => F64,
+                    "float32" if !self.require_f32_f64 => F32,
+                    "float64" if !self.require_f32_f64 => F64,
                     "char" => Char,
                     "resource" => Resource,
                     "own" => Own,
@@ -543,8 +543,8 @@ impl Token {
             S16 => "keyword `s16`",
             S32 => "keyword `s32`",
             S64 => "keyword `s64`",
-            Float32 => "keyword `float32`",
-            Float64 => "keyword `float64`",
+            F32 => "keyword `f32`",
+            F64 => "keyword `f64`",
             Char => "keyword `char`",
             Own => "keyword `own`",
             Borrow => "keyword `borrow`",
diff --git a/crates/wit-parser/src/ast/resolve.rs b/crates/wit-parser/src/ast/resolve.rs
index 51707514..444b9973 100644
--- a/crates/wit-parser/src/ast/resolve.rs
+++ b/crates/wit-parser/src/ast/resolve.rs
@@ -1045,8 +1045,8 @@ impl<'a> Resolver<'a> {
             ast::Type::S16 => TypeDefKind::Type(Type::S16),
             ast::Type::S32 => TypeDefKind::Type(Type::S32),
             ast::Type::S64 => TypeDefKind::Type(Type::S64),
-            ast::Type::Float32 => TypeDefKind::Type(Type::Float32),
-            ast::Type::Float64 => TypeDefKind::Type(Type::Float64),
+            ast::Type::F32 => TypeDefKind::Type(Type::F32),
+            ast::Type::F64 => TypeDefKind::Type(Type::F64),
             ast::Type::Char => TypeDefKind::Type(Type::Char),
             ast::Type::String => TypeDefKind::Type(Type::String),
             ast::Type::Name(name) => {
@@ -1387,8 +1387,8 @@ fn collect_deps<'a>(ty: &ast::Type<'a>, deps: &mut Vec<ast::Id<'a>>) {
         | ast::Type::S16
         | ast::Type::S32
         | ast::Type::S64
-        | ast::Type::Float32
-        | ast::Type::Float64
+        | ast::Type::F32
+        | ast::Type::F64
         | ast::Type::Char
         | ast::Type::String
         | ast::Type::Flags(_)
diff --git a/crates/wit-parser/src/decoding.rs b/crates/wit-parser/src/decoding.rs
index cbf67c99..1fbb78f6 100644
--- a/crates/wit-parser/src/decoding.rs
+++ b/crates/wit-parser/src/decoding.rs
@@ -1381,8 +1381,8 @@ impl WitPackageDecoder<'_> {
             PrimitiveValType::Bool => Type::Bool,
             PrimitiveValType::Char => Type::Char,
             PrimitiveValType::String => Type::String,
-            PrimitiveValType::Float32 => Type::Float32,
-            PrimitiveValType::Float64 => Type::Float64,
+            PrimitiveValType::F32 => Type::F32,
+            PrimitiveValType::F64 => Type::F64,
         }
     }
 
diff --git a/crates/wit-parser/src/lib.rs b/crates/wit-parser/src/lib.rs
index 1905426e..3b5f8dbe 100644
--- a/crates/wit-parser/src/lib.rs
+++ b/crates/wit-parser/src/lib.rs
@@ -473,8 +473,8 @@ pub enum Type {
     S16,
     S32,
     S64,
-    Float32,
-    Float64,
+    F32,
+    F64,
     Char,
     String,
     Id(TypeId),
@@ -570,12 +570,7 @@ pub struct Case {
 
 impl Variant {
     pub fn tag(&self) -> Int {
-        match self.cases.len() {
-            n if n <= u8::max_value() as usize => Int::U8,
-            n if n <= u16::max_value() as usize => Int::U16,
-            n if n <= u32::max_value() as usize => Int::U32,
-            _ => panic!("too many cases to fit in a repr"),
-        }
+        discriminant_type(self.cases.len())
     }
 }
 
@@ -595,12 +590,18 @@ pub struct EnumCase {
 
 impl Enum {
     pub fn tag(&self) -> Int {
-        match self.cases.len() {
-            n if n <= u8::max_value() as usize => Int::U8,
-            n if n <= u16::max_value() as usize => Int::U16,
-            n if n <= u32::max_value() as usize => Int::U32,
-            _ => panic!("too many cases to fit in a repr"),
-        }
+        discriminant_type(self.cases.len())
+    }
+}
+
+/// This corresponds to the `discriminant_type` function in the Canonical ABI.
+fn discriminant_type(num_cases: usize) -> Int {
+    match num_cases.checked_sub(1) {
+        None => Int::U8,
+        Some(n) if n <= u8::max_value() as usize => Int::U8,
+        Some(n) if n <= u16::max_value() as usize => Int::U16,
+        Some(n) if n <= u32::max_value() as usize => Int::U32,
+        _ => panic!("too many cases to fit in a repr"),
     }
 }
 
@@ -745,3 +746,20 @@ impl Function {
         }
     }
 }
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn test_discriminant_type() {
+        assert_eq!(discriminant_type(1), Int::U8);
+        assert_eq!(discriminant_type(0x100), Int::U8);
+        assert_eq!(discriminant_type(0x101), Int::U16);
+        assert_eq!(discriminant_type(0x10000), Int::U16);
+        assert_eq!(discriminant_type(0x10001), Int::U32);
+        if let Ok(num_cases) = usize::try_from(0x100000000_u64) {
+            assert_eq!(discriminant_type(num_cases), Int::U32);
+        }
+    }
+}
diff --git a/crates/wit-parser/src/resolve.rs b/crates/wit-parser/src/resolve.rs
index 58bf6179..b7e1f95b 100644
--- a/crates/wit-parser/src/resolve.rs
+++ b/crates/wit-parser/src/resolve.rs
@@ -356,8 +356,8 @@ impl Resolve {
             | Type::S32
             | Type::U64
             | Type::S64
-            | Type::Float32
-            | Type::Float64 => true,
+            | Type::F32
+            | Type::F64 => true,
 
             Type::Bool | Type::Char | Type::String => false,
 
diff --git a/crates/wit-parser/src/serde_.rs b/crates/wit-parser/src/serde_.rs
index f7af8799..b554d2e6 100644
--- a/crates/wit-parser/src/serde_.rs
+++ b/crates/wit-parser/src/serde_.rs
@@ -67,8 +67,8 @@ impl Serialize for Type {
             Type::S16 => serializer.serialize_str("s16"),
             Type::S32 => serializer.serialize_str("s32"),
             Type::S64 => serializer.serialize_str("s64"),
-            Type::Float32 => serializer.serialize_str("float32"),
-            Type::Float64 => serializer.serialize_str("float64"),
+            Type::F32 => serializer.serialize_str("f32"),
+            Type::F64 => serializer.serialize_str("f64"),
             Type::Char => serializer.serialize_str("char"),
             Type::String => serializer.serialize_str("string"),
             Type::Id(type_id) => serializer.serialize_u64(type_id.index() as u64),
diff --git a/crates/wit-parser/src/sizealign.rs b/crates/wit-parser/src/sizealign.rs
index 2130e84f..5040e1a6 100644
--- a/crates/wit-parser/src/sizealign.rs
+++ b/crates/wit-parser/src/sizealign.rs
@@ -67,8 +67,8 @@ impl SizeAlign {
         match ty {
             Type::Bool | Type::U8 | Type::S8 => 1,
             Type::U16 | Type::S16 => 2,
-            Type::U32 | Type::S32 | Type::Float32 | Type::Char => 4,
-            Type::U64 | Type::S64 | Type::Float64 => 8,
+            Type::U32 | Type::S32 | Type::F32 | Type::Char => 4,
+            Type::U64 | Type::S64 | Type::F64 => 8,
             Type::String => {
                 if matches!(self.wasm_type, AddressSize::Wasm64) {
                     16
@@ -84,8 +84,8 @@ impl SizeAlign {
         match ty {
             Type::Bool | Type::U8 | Type::S8 => 1,
             Type::U16 | Type::S16 => 2,
-            Type::U32 | Type::S32 | Type::Float32 | Type::Char => 4,
-            Type::U64 | Type::S64 | Type::Float64 => 8,
+            Type::U32 | Type::S32 | Type::F32 | Type::Char => 4,
+            Type::U64 | Type::S64 | Type::F64 => 8,
             Type::String => {
                 if matches!(self.wasm_type, AddressSize::Wasm64) {
                     8
diff --git a/crates/wit-smith/src/generate.rs b/crates/wit-smith/src/generate.rs
index 1ae90d6d..bbcbc302 100644
--- a/crates/wit-smith/src/generate.rs
+++ b/crates/wit-smith/src/generate.rs
@@ -706,8 +706,8 @@ impl<'a> InterfaceGenerator<'a> {
             S16,
             S32,
             S64,
-            Float32,
-            Float64,
+            F32,
+            F64,
             Char,
             String,
             Id,
@@ -735,8 +735,8 @@ impl<'a> InterfaceGenerator<'a> {
                 Kind::S32 => dst.push_str("s32"),
                 Kind::U64 => dst.push_str("u64"),
                 Kind::S64 => dst.push_str("s64"),
-                Kind::Float32 => dst.push_str("float32"),
-                Kind::Float64 => dst.push_str("float64"),
+                Kind::F32 => dst.push_str("f32"),
+                Kind::F64 => dst.push_str("f64"),
                 Kind::Char => dst.push_str("char"),
                 Kind::String => dst.push_str("string"),
                 Kind::Id => {
diff --git a/src/bin/wasm-tools/json_from_wast.rs b/src/bin/wasm-tools/json_from_wast.rs
index f322c1a5..3c2ea65f 100644
--- a/src/bin/wasm-tools/json_from_wast.rs
+++ b/src/bin/wasm-tools/json_from_wast.rs
@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
 use wast::core::{HeapType, NanPattern, V128Const, V128Pattern, WastRetCore};
 use wast::lexer::Lexer;
 use wast::parser::{self, ParseBuffer};
-use wast::token::{Float32, Float64, Span};
+use wast::token::{Span, F32, F64};
 use wast::{
     QuoteWat, QuoteWatTest, Wast, WastArg, WastDirective, WastExecute, WastInvoke, WastRet, Wat,
 };
@@ -495,11 +495,11 @@ fn nan_pattern_to_string<T>(pat: NanPattern<T>, to_string: fn(T) -> String) -> S
     }
 }
 
-fn f32_to_string(f: Float32) -> String {
+fn f32_to_string(f: F32) -> String {
     f.bits.to_string()
 }
 
-fn f64_to_string(f: Float64) -> String {
+fn f64_to_string(f: F64) -> String {
     f.bits.to_string()
 }
 


Test patch:
diff --git a/crates/wasm-compose/tests/compositions/complex-import/composed.wat b/crates/wasm-compose/tests/compositions/complex-import/composed.wat
index 3fc8cd5b..c72c0670 100644
--- a/crates/wasm-compose/tests/compositions/complex-import/composed.wat
+++ b/crates/wasm-compose/tests/compositions/complex-import/composed.wat
@@ -37,15 +37,15 @@
           (export (;7;) "h" (func (type 7)))
           (type (;8;) (func (param "x" u64)))
           (export (;8;) "i" (func (type 8)))
-          (type (;9;) (func (param "x" float32)))
+          (type (;9;) (func (param "x" f32)))
           (export (;9;) "j" (func (type 9)))
-          (type (;10;) (func (param "x" float64)))
+          (type (;10;) (func (param "x" f64)))
           (export (;10;) "k" (func (type 10)))
           (type (;11;) (func (param "x" bool)))
           (export (;11;) "l" (func (type 11)))
           (type (;12;) (func (param "x" string)))
           (export (;12;) "m" (func (type 12)))
-          (type (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+          (type (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
           (export (;14;) "record1" (type (eq 13)))
           (type (;15;) (func (param "x" 14)))
           (export (;13;) "n" (func (type 15)))
@@ -67,7 +67,7 @@
           (export (;27;) "option1" (type (eq 26)))
           (type (;28;) (func (param "x" 27)))
           (export (;18;) "s" (func (type 28)))
-          (type (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" 14)))
+          (type (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" 14)))
           (export (;30;) "variant1" (type (eq 29)))
           (type (;31;) (option 30))
           (type (;32;) (func (param "x" 31)))
@@ -90,7 +90,7 @@
   (import "b" (component (;1;) (type 1)))
   (type (;2;)
     (component
-      (type (;0;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+      (type (;0;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
       (export (;1;) "record1" (type (eq 0)))
       (type (;2;) (flags "a" "b" "c"))
       (export (;3;) "flags1" (type (eq 2)))
@@ -98,7 +98,7 @@
       (export (;5;) "enum1" (type (eq 4)))
       (type (;6;) (option 1))
       (export (;7;) "option1" (type (eq 6)))
-      (type (;8;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" 1)))
+      (type (;8;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" 1)))
       (export (;9;) "variant1" (type (eq 8)))
       (type (;10;) (func))
       (export (;0;) "a" (func (type 10)))
@@ -118,9 +118,9 @@
       (export (;7;) "h" (func (type 17)))
       (type (;18;) (func (param "x" u64)))
       (export (;8;) "i" (func (type 18)))
-      (type (;19;) (func (param "x" float32)))
+      (type (;19;) (func (param "x" f32)))
       (export (;9;) "j" (func (type 19)))
-      (type (;20;) (func (param "x" float64)))
+      (type (;20;) (func (param "x" f64)))
       (export (;10;) "k" (func (type 20)))
       (type (;21;) (func (param "x" bool)))
       (export (;11;) "l" (func (type 21)))
diff --git a/crates/wasm-compose/tests/compositions/complex/a.wat b/crates/wasm-compose/tests/compositions/complex/a.wat
index f1d3170f..611c01a7 100644
--- a/crates/wasm-compose/tests/compositions/complex/a.wat
+++ b/crates/wasm-compose/tests/compositions/complex/a.wat
@@ -8,11 +8,11 @@
   (type $t6 (func (param "x" u32)))
   (type $t7 (func (param "x" s64)))
   (type $t8 (func (param "x" u64)))
-  (type $t9 (func (param "x" float32)))
-  (type $t10 (func (param "x" float64)))
+  (type $t9 (func (param "x" f32)))
+  (type $t10 (func (param "x" f64)))
   (type $t11 (func (param "x" bool)))
   (type $t12 (func (param "x" string)))
-  (type $t13' (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+  (type $t13' (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
   (export $t13 "record1" (type $t13'))
   (type $t14 (func (param "x" $t13)))
   (type $t15 (list $t13))
@@ -28,7 +28,7 @@
   (type $t23' (option $t13))
   (export $t23 "option1" (type $t23'))
   (type $t24 (func (param "x" $t23)))
-  (type $t25' (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" $t13)))
+  (type $t25' (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" $t13)))
   (export $t25 "variant1" (type $t25'))
   (type $t26 (option $t25))
   (type $t27 (func (param "x" $t26)))
diff --git a/crates/wasm-compose/tests/compositions/complex/b.wat b/crates/wasm-compose/tests/compositions/complex/b.wat
index 86b9cf2b..bc433562 100644
--- a/crates/wasm-compose/tests/compositions/complex/b.wat
+++ b/crates/wasm-compose/tests/compositions/complex/b.wat
@@ -10,8 +10,8 @@
       (type $f7 (func (param "x" u32)))
       (type $f8 (func (param "x" s64)))
       (type $f9 (func (param "x" u64)))
-      (type $f10 (func (param "x" float32)))
-      (type $f11 (func (param "x" float64)))
+      (type $f10 (func (param "x" f32)))
+      (type $f11 (func (param "x" f64)))
       (type $f12 (func (param "x" bool)))
       (type $f13 (func (param "x" string)))
       (export "a" (func (type $f1)))
@@ -27,7 +27,7 @@
       (export "k" (func (type $f11)))
       (export "l" (func (type $f12)))
       (export "m" (func (type $f13)))
-      (type $t1' (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+      (type $t1' (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
       (export $t1 "record1"  (type (eq $t1')))
       (type $f14 (func (param "x" $t1)))
       (export "n" (func (type $f14)))
@@ -49,7 +49,7 @@
       (export $t6 "option1"  (type (eq $t6')))
       (type $f19 (func (param "x" $t6)))
       (export "s" (func (type $f19)))
-      (type $t7' (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" $t1)))
+      (type $t7' (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" $t1)))
       (export $t7 "variant1"  (type (eq $t7')))
       (type $t8 (option $t7))
       (type $f20 (func (param "x" $t8)))
diff --git a/crates/wasm-compose/tests/compositions/complex/composed.wat b/crates/wasm-compose/tests/compositions/complex/composed.wat
index 25f20639..d2ae822b 100644
--- a/crates/wasm-compose/tests/compositions/complex/composed.wat
+++ b/crates/wasm-compose/tests/compositions/complex/composed.wat
@@ -25,8 +25,8 @@
         (type (;6;) (func (param "x" u32)))
         (type (;7;) (func (param "x" s64)))
         (type (;8;) (func (param "x" u64)))
-        (type (;9;) (func (param "x" float32)))
-        (type (;10;) (func (param "x" float64)))
+        (type (;9;) (func (param "x" f32)))
+        (type (;10;) (func (param "x" f64)))
         (type (;11;) (func (param "x" bool)))
         (type (;12;) (func (param "x" string)))
         (export (;0;) "a" (func (type 0)))
@@ -42,7 +42,7 @@
         (export (;10;) "k" (func (type 10)))
         (export (;11;) "l" (func (type 11)))
         (export (;12;) "m" (func (type 12)))
-        (type (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+        (type (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
         (export (;14;) "record1" (type (eq 13)))
         (type (;15;) (func (param "x" 14)))
         (export (;13;) "n" (func (type 15)))
@@ -64,7 +64,7 @@
         (export (;27;) "option1" (type (eq 26)))
         (type (;28;) (func (param "x" 27)))
         (export (;18;) "s" (func (type 28)))
-        (type (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" 14)))
+        (type (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" 14)))
         (export (;30;) "variant1" (type (eq 29)))
         (type (;31;) (option 30))
         (type (;32;) (func (param "x" 31)))
@@ -327,11 +327,11 @@
     (type $t6 (;6;) (func (param "x" u32)))
     (type $t7 (;7;) (func (param "x" s64)))
     (type $t8 (;8;) (func (param "x" u64)))
-    (type $t9 (;9;) (func (param "x" float32)))
-    (type $t10 (;10;) (func (param "x" float64)))
+    (type $t9 (;9;) (func (param "x" f32)))
+    (type $t10 (;10;) (func (param "x" f64)))
     (type $t11 (;11;) (func (param "x" bool)))
     (type $t12 (;12;) (func (param "x" string)))
-    (type $t13' (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" float32) (field "j" float64) (field "k" bool) (field "l" string)))
+    (type $t13' (;13;) (record (field "a" s8) (field "b" u8) (field "c" s16) (field "d" u16) (field "e" s32) (field "f" u32) (field "g" s64) (field "h" u64) (field "i" f32) (field "j" f64) (field "k" bool) (field "l" string)))
     (export $t13 (;14;) "record1" (type $t13'))
     (type $t14 (;15;) (func (param "x" $t13)))
     (type $t15 (;16;) (list $t13))
@@ -347,7 +347,7 @@
     (type $t23' (;26;) (option $t13))
     (export $t23 (;27;) "option1" (type $t23'))
     (type $t24 (;28;) (func (param "x" $t23)))
-    (type $t25' (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" float32) (case "j" float64) (case "k" bool) (case "l" string) (case "m" $t13)))
+    (type $t25' (;29;) (variant (case "a" s8) (case "b" u8) (case "c" s16) (case "d" u16) (case "e" s32) (case "f" u32) (case "g" s64) (case "h" u64) (case "i" f32) (case "j" f64) (case "k" bool) (case "l" string) (case "m" $t13)))
     (export $t25 (;30;) "variant1" (type $t25'))
     (type $t26 (;31;) (option $t25))
     (type $t27 (;32;) (func (param "x" $t26)))
diff --git a/crates/wit-component/tests/components/imports/component.wat b/crates/wit-component/tests/components/imports/component.wat
index 4a4c13d1..a344d7f3 100644
--- a/crates/wit-component/tests/components/imports/component.wat
+++ b/crates/wit-component/tests/components/imports/component.wat
@@ -30,7 +30,7 @@
       (export (;0;) "foo1" (func (type 0)))
       (type (;1;) (func (param "x" u8)))
       (export (;1;) "foo2" (func (type 1)))
-      (type (;2;) (func (param "x" float32)))
+      (type (;2;) (func (param "x" f32)))
       (export (;2;) "foo3" (func (type 2)))
     )
   )
diff --git a/crates/wit-component/tests/components/imports/component.wit.print b/crates/wit-component/tests/components/imports/component.wit.print
index 7c1ee1ff..3b065ea3 100644
--- a/crates/wit-component/tests/components/imports/component.wit.print
+++ b/crates/wit-component/tests/components/imports/component.wit.print
@@ -24,6 +24,6 @@ world root {
 
     foo2: func(x: u8);
 
-    foo3: func(x: float32);
+    foo3: func(x: f32);
   }
 }
diff --git a/crates/wit-component/tests/components/imports/module.wit b/crates/wit-component/tests/components/imports/module.wit
index 8fa0f3be..33239350 100644
--- a/crates/wit-component/tests/components/imports/module.wit
+++ b/crates/wit-component/tests/components/imports/module.wit
@@ -21,7 +21,7 @@ world module {
   import foo: interface {
     foo1: func();
     foo2: func(x: u8);
-    foo3: func(x: float32);
+    foo3: func(x: f32);
     unused: func();
 
     /// doesn't show up in the wit output despite being exported here since it's
diff --git a/crates/wit-component/tests/interfaces/floats.wat b/crates/wit-component/tests/interfaces/floats.wat
index 6de019f1..10bb9a93 100644
--- a/crates/wit-component/tests/interfaces/floats.wat
+++ b/crates/wit-component/tests/interfaces/floats.wat
@@ -3,14 +3,14 @@
     (component
       (type (;0;)
         (instance
-          (type (;0;) (func (param "x" float32)))
-          (export (;0;) "float32-param" (func (type 0)))
-          (type (;1;) (func (param "x" float64)))
-          (export (;1;) "float64-param" (func (type 1)))
-          (type (;2;) (func (result float32)))
-          (export (;2;) "float32-result" (func (type 2)))
-          (type (;3;) (func (result float64)))
-          (export (;3;) "float64-result" (func (type 3)))
+          (type (;0;) (func (param "x" f32)))
+          (export (;0;) "f32-param" (func (type 0)))
+          (type (;1;) (func (param "x" f64)))
+          (export (;1;) "f64-param" (func (type 1)))
+          (type (;2;) (func (result f32)))
+          (export (;2;) "f32-result" (func (type 2)))
+          (type (;3;) (func (result f64)))
+          (export (;3;) "f64-result" (func (type 3)))
         )
       )
       (export (;0;) "foo:floats/floats" (instance (type 0)))
@@ -23,14 +23,14 @@
         (component
           (type (;0;)
             (instance
-              (type (;0;) (func (param "x" float32)))
-              (export (;0;) "float32-param" (func (type 0)))
-              (type (;1;) (func (param "x" float64)))
-              (export (;1;) "float64-param" (func (type 1)))
-              (type (;2;) (func (result float32)))
-              (export (;2;) "float32-result" (func (type 2)))
-              (type (;3;) (func (result float64)))
-              (export (;3;) "float64-result" (func (type 3)))
+              (type (;0;) (func (param "x" f32)))
+              (export (;0;) "f32-param" (func (type 0)))
+              (type (;1;) (func (param "x" f64)))
+              (export (;1;) "f64-param" (func (type 1)))
+              (type (;2;) (func (result f32)))
+              (export (;2;) "f32-result" (func (type 2)))
+              (type (;3;) (func (result f64)))
+              (export (;3;) "f64-result" (func (type 3)))
             )
           )
           (import "foo:floats/floats" (instance (;0;) (type 0)))
diff --git a/crates/wit-component/tests/interfaces/floats.wit b/crates/wit-component/tests/interfaces/floats.wit
index fa75f8b5..8333cc91 100644
--- a/crates/wit-component/tests/interfaces/floats.wit
+++ b/crates/wit-component/tests/interfaces/floats.wit
@@ -1,10 +1,10 @@
 package foo:floats;
 
 interface floats {
-  float32-param: func(x: float32);
-  float64-param: func(x: float64);
-  float32-result: func() -> float32;
-  float64-result: func() -> float64;
+  f32-param: func(x: f32);
+  f64-param: func(x: f64);
+  f32-result: func() -> f32;
+  f64-result: func() -> f64;
 }
 
 world floats-world {
diff --git a/crates/wit-component/tests/interfaces/floats.wit.print b/crates/wit-component/tests/interfaces/floats.wit.print
index 39cabef5..e460087d 100644
--- a/crates/wit-component/tests/interfaces/floats.wit.print
+++ b/crates/wit-component/tests/interfaces/floats.wit.print
@@ -1,13 +1,13 @@
 package foo:floats;
 
 interface floats {
-  float32-param: func(x: float32);
+  f32-param: func(x: f32);
 
-  float64-param: func(x: float64);
+  f64-param: func(x: f64);
 
-  float32-result: func() -> float32;
+  f32-result: func() -> f32;
 
-  float64-result: func() -> float64;
+  f64-result: func() -> f64;
 }
 
 world floats-world {
diff --git a/crates/wit-component/tests/interfaces/lists.wat b/crates/wit-component/tests/interfaces/lists.wat
index d0a559e0..c208b8de 100644
--- a/crates/wit-component/tests/interfaces/lists.wat
+++ b/crates/wit-component/tests/interfaces/lists.wat
@@ -13,7 +13,7 @@
           (type (;7;) (list 6))
           (type (;8;) (variant (case "a" string) (case "b") (case "c" u32) (case "d" 7)))
           (export (;9;) "some-variant" (type (eq 8)))
-          (type (;10;) (tuple string u8 s8 u16 s16 u32 s32 u64 s64 float32 float64 char))
+          (type (;10;) (tuple string u8 s8 u16 s16 u32 s32 u64 s64 f32 f64 char))
           (type (;11;) (list 10))
           (export (;12;) "load-store-all-sizes" (type (eq 11)))
           (type (;13;) (func (param "x" 0)))
@@ -39,12 +39,12 @@
           (type (;26;) (list s64))
           (type (;27;) (func (param "x" 26)))
           (export (;7;) "list-s64-param" (func (type 27)))
-          (type (;28;) (list float32))
+          (type (;28;) (list f32))
           (type (;29;) (func (param "x" 28)))
-          (export (;8;) "list-float32-param" (func (type 29)))
-          (type (;30;) (list float64))
+          (export (;8;) "list-f32-param" (func (type 29)))
+          (type (;30;) (list f64))
           (type (;31;) (func (param "x" 30)))
-          (export (;9;) "list-float64-param" (func (type 31)))
+          (export (;9;) "list-f64-param" (func (type 31)))
           (type (;32;) (func (result 0)))
           (export (;10;) "list-u8-ret" (func (type 32)))
           (type (;33;) (func (result 14)))
@@ -62,9 +62,9 @@
           (type (;39;) (func (result 26)))
           (export (;17;) "list-s64-ret" (func (type 39)))
           (type (;40;) (func (result 28)))
-          (export (;18;) "list-float32-ret" (func (type 40)))
+          (export (;18;) "list-f32-ret" (func (type 40)))
           (type (;41;) (func (result 30)))
-          (export (;19;) "list-float64-ret" (func (type 41)))
+          (export (;19;) "list-f64-ret" (func (type 41)))
           (type (;42;) (tuple u8 s8))
           (type (;43;) (list 42))
           (type (;44;) (tuple s64 u32))
@@ -115,7 +115,7 @@
               (type (;7;) (list 6))
               (type (;8;) (variant (case "a" string) (case "b") (case "c" u32) (case "d" 7)))
               (export (;9;) "some-variant" (type (eq 8)))
-              (type (;10;) (tuple string u8 s8 u16 s16 u32 s32 u64 s64 float32 float64 char))
+              (type (;10;) (tuple string u8 s8 u16 s16 u32 s32 u64 s64 f32 f64 char))
               (type (;11;) (list 10))
               (export (;12;) "load-store-all-sizes" (type (eq 11)))
               (type (;13;) (func (param "x" 0)))
@@ -141,12 +141,12 @@
               (type (;26;) (list s64))
               (type (;27;) (func (param "x" 26)))
               (export (;7;) "list-s64-param" (func (type 27)))
-              (type (;28;) (list float32))
+              (type (;28;) (list f32))
               (type (;29;) (func (param "x" 28)))
-              (export (;8;) "list-float32-param" (func (type 29)))
-              (type (;30;) (list float64))
+              (export (;8;) "list-f32-param" (func (type 29)))
+              (type (;30;) (list f64))
               (type (;31;) (func (param "x" 30)))
-              (export (;9;) "list-float64-param" (func (type 31)))
+              (export (;9;) "list-f64-param" (func (type 31)))
               (type (;32;) (func (result 0)))
               (export (;10;) "list-u8-ret" (func (type 32)))
               (type (;33;) (func (result 14)))
@@ -164,9 +164,9 @@
               (type (;39;) (func (result 26)))
               (export (;17;) "list-s64-ret" (func (type 39)))
               (type (;40;) (func (result 28)))
-              (export (;18;) "list-float32-ret" (func (type 40)))
+              (export (;18;) "list-f32-ret" (func (type 40)))
               (type (;41;) (func (result 30)))
-              (export (;19;) "list-float64-ret" (func (type 41)))
+              (export (;19;) "list-f64-ret" (func (type 41)))
               (type (;42;) (tuple u8 s8))
               (type (;43;) (list 42))
               (type (;44;) (tuple s64 u32))
diff --git a/crates/wit-component/tests/interfaces/lists.wit b/crates/wit-component/tests/interfaces/lists.wit
index 6d192250..fe95b78c 100644
--- a/crates/wit-component/tests/interfaces/lists.wit
+++ b/crates/wit-component/tests/interfaces/lists.wit
@@ -32,7 +32,7 @@ interface lists {
     d(list<other-variant>),
   }
 
-  type load-store-all-sizes = list<tuple<string, u8, s8, u16, s16, u32, s32, u64, s64, float32, float64, char>>;
+  type load-store-all-sizes = list<tuple<string, u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, char>>;
 
   list-u8-param: func(x: list<u8>);
 
@@ -50,9 +50,9 @@ interface lists {
 
   list-s64-param: func(x: list<s64>);
 
-  list-float32-param: func(x: list<float32>);
+  list-f32-param: func(x: list<f32>);
 
-  list-float64-param: func(x: list<float64>);
+  list-f64-param: func(x: list<f64>);
 
   list-u8-ret: func() -> list<u8>;
 
@@ -70,9 +70,9 @@ interface lists {
 
   list-s64-ret: func() -> list<s64>;
 
-  list-float32-ret: func() -> list<float32>;
+  list-f32-ret: func() -> list<f32>;
 
-  list-float64-ret: func() -> list<float64>;
+  list-f64-ret: func() -> list<f64>;
 
   tuple-list: func(x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>;
 
diff --git a/crates/wit-component/tests/interfaces/lists.wit.print b/crates/wit-component/tests/interfaces/lists.wit.print
index 6d192250..fe95b78c 100644
--- a/crates/wit-component/tests/interfaces/lists.wit.print
+++ b/crates/wit-component/tests/interfaces/lists.wit.print
@@ -32,7 +32,7 @@ interface lists {
     d(list<other-variant>),
   }
 
-  type load-store-all-sizes = list<tuple<string, u8, s8, u16, s16, u32, s32, u64, s64, float32, float64, char>>;
+  type load-store-all-sizes = list<tuple<string, u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, char>>;
 
   list-u8-param: func(x: list<u8>);
 
@@ -50,9 +50,9 @@ interface lists {
 
   list-s64-param: func(x: list<s64>);
 
-  list-float32-param: func(x: list<float32>);
+  list-f32-param: func(x: list<f32>);
 
-  list-float64-param: func(x: list<float64>);
+  list-f64-param: func(x: list<f64>);
 
   list-u8-ret: func() -> list<u8>;
 
@@ -70,9 +70,9 @@ interface lists {
 
   list-s64-ret: func() -> list<s64>;
 
-  list-float32-ret: func() -> list<float32>;
+  list-f32-ret: func() -> list<f32>;
 
-  list-float64-ret: func() -> list<float64>;
+  list-f64-ret: func() -> list<f64>;
 
   tuple-list: func(x: list<tuple<u8, s8>>) -> list<tuple<s64, u32>>;
 
diff --git a/crates/wit-component/tests/interfaces/variants.wat b/crates/wit-component/tests/interfaces/variants.wat
index 90351272..2393ae21 100644
--- a/crates/wit-component/tests/interfaces/variants.wat
+++ b/crates/wit-component/tests/interfaces/variants.wat
@@ -9,17 +9,17 @@
           (export (;3;) "single" (type (eq 2)))
           (type (;4;) (variant (case "a") (case "c" 1) (case "d" string) (case "e" 3) (case "f") (case "g" u32)))
           (export (;5;) "v1" (type (eq 4)))
-          (type (;6;) (variant (case "a" s32) (case "b" float32)))
+          (type (;6;) (variant (case "a" s32) (case "b" f32)))
           (export (;7;) "casts1" (type (eq 6)))
-          (type (;8;) (variant (case "a" float64) (case "b" float32)))
+          (type (;8;) (variant (case "a" f64) (case "b" f32)))
           (export (;9;) "casts2" (type (eq 8)))
-          (type (;10;) (variant (case "a" float64) (case "b" u64)))
+          (type (;10;) (variant (case "a" f64) (case "b" u64)))
           (export (;11;) "casts3" (type (eq 10)))
           (type (;12;) (variant (case "a" u32) (case "b" s64)))
           (export (;13;) "casts4" (type (eq 12)))
-          (type (;14;) (variant (case "a" float32) (case "b" s64)))
+          (type (;14;) (variant (case "a" f32) (case "b" s64)))
           (export (;15;) "casts5" (type (eq 14)))
-          (type (;16;) (tuple float32 u32))
+          (type (;16;) (tuple f32 u32))
           (type (;17;) (tuple u32 u32))
           (type (;18;) (variant (case "a" 16) (case "b" 17)))
           (export (;19;) "casts6" (type (eq 18)))
@@ -42,7 +42,7 @@
           (type (;30;) (option 29))
           (type (;31;) (option u32))
           (type (;32;) (option 1))
-          (type (;33;) (option float32))
+          (type (;33;) (option f32))
           (type (;34;) (option 28))
           (type (;35;) (func (param "a" 28) (param "b" 30) (param "c" 31) (param "d" 32) (param "e" 33) (param "g" 34)))
           (export (;6;) "option-arg" (func (type 35)))
@@ -104,17 +104,17 @@
               (export (;3;) "single" (type (eq 2)))
               (type (;4;) (variant (case "a") (case "c" 1) (case "d" string) (case "e" 3) (case "f") (case "g" u32)))
               (export (;5;) "v1" (type (eq 4)))
-              (type (;6;) (variant (case "a" s32) (case "b" float32)))
+              (type (;6;) (variant (case "a" s32) (case "b" f32)))
               (export (;7;) "casts1" (type (eq 6)))
-              (type (;8;) (variant (case "a" float64) (case "b" float32)))
+              (type (;8;) (variant (case "a" f64) (case "b" f32)))
               (export (;9;) "casts2" (type (eq 8)))
-              (type (;10;) (variant (case "a" float64) (case "b" u64)))
+              (type (;10;) (variant (case "a" f64) (case "b" u64)))
               (export (;11;) "casts3" (type (eq 10)))
               (type (;12;) (variant (case "a" u32) (case "b" s64)))
               (export (;13;) "casts4" (type (eq 12)))
-              (type (;14;) (variant (case "a" float32) (case "b" s64)))
+              (type (;14;) (variant (case "a" f32) (case "b" s64)))
               (export (;15;) "casts5" (type (eq 14)))
-              (type (;16;) (tuple float32 u32))
+              (type (;16;) (tuple f32 u32))
               (type (;17;) (tuple u32 u32))
               (type (;18;) (variant (case "a" 16) (case "b" 17)))
               (export (;19;) "casts6" (type (eq 18)))
@@ -137,7 +137,7 @@
               (type (;30;) (option 29))
               (type (;31;) (option u32))
               (type (;32;) (option 1))
-              (type (;33;) (option float32))
+              (type (;33;) (option f32))
               (type (;34;) (option 28))
               (type (;35;) (func (param "a" 28) (param "b" 30) (param "c" 31) (param "d" 32) (param "e" 33) (param "g" 34)))
               (export (;6;) "option-arg" (func (type 35)))
diff --git a/crates/wit-component/tests/interfaces/variants.wit b/crates/wit-component/tests/interfaces/variants.wit
index f0374769..35c975f0 100644
--- a/crates/wit-component/tests/interfaces/variants.wit
+++ b/crates/wit-component/tests/interfaces/variants.wit
@@ -20,16 +20,16 @@ interface variants {
 
   variant casts1 {
     a(s32),
-    b(float32),
+    b(f32),
   }
 
   variant casts2 {
-    a(float64),
-    b(float32),
+    a(f64),
+    b(f32),
   }
 
   variant casts3 {
-    a(float64),
+    a(f64),
     b(u64),
   }
 
@@ -39,12 +39,12 @@ interface variants {
   }
 
   variant casts5 {
-    a(float32),
+    a(f32),
     b(s64),
   }
 
   variant casts6 {
-    a(tuple<float32, u32>),
+    a(tuple<f32, u32>),
     b(tuple<u32, u32>),
   }
 
@@ -59,8 +59,8 @@ interface variants {
   v1-result: func() -> v1;
   bool-arg: func(x: bool);
   bool-result: func() -> bool;
-  option-arg: func(a: option<bool>, b: option<tuple<u32>>, c: option<u32>, d: option<e1>, e: option<float32>, g: option<option<bool>>);
-  option-result: func() -> tuple<option<bool>, option<tuple<u32>>, option<u32>, option<e1>, option<float32>, option<option<bool>>>;
+  option-arg: func(a: option<bool>, b: option<tuple<u32>>, c: option<u32>, d: option<e1>, e: option<f32>, g: option<option<bool>>);
+  option-result: func() -> tuple<option<bool>, option<tuple<u32>>, option<u32>, option<e1>, option<f32>, option<option<bool>>>;
   casts: func(a: casts1, b: casts2, c: casts3, d: casts4, e: casts5, f: casts6) -> tuple<casts1, casts2, casts3, casts4, casts5, casts6>;
   expected-arg: func(a: result, b: result<_, e1>, c: result<e1>, d: result<tuple<u32>, tuple<u32>>, e: result<u32, v1>, f: result<string, list<u8>>);
   expected-result: func() -> tuple<result, result<_, e1>, result<e1>, result<tuple<u32>, tuple<u32>>, result<u32, v1>, result<string, list<u8>>>;
diff --git a/crates/wit-component/tests/interfaces/variants.wit.print b/crates/wit-component/tests/interfaces/variants.wit.print
index ae72ce51..c27233c2 100644
--- a/crates/wit-component/tests/interfaces/variants.wit.print
+++ b/crates/wit-component/tests/interfaces/variants.wit.print
@@ -20,16 +20,16 @@ interface variants {
 
   variant casts1 {
     a(s32),
-    b(float32),
+    b(f32),
   }
 
   variant casts2 {
-    a(float64),
-    b(float32),
+    a(f64),
+    b(f32),
   }
 
   variant casts3 {
-    a(float64),
+    a(f64),
     b(u64),
   }
 
@@ -39,12 +39,12 @@ interface variants {
   }
 
   variant casts5 {
-    a(float32),
+    a(f32),
     b(s64),
   }
 
   variant casts6 {
-    a(tuple<float32, u32>),
+    a(tuple<f32, u32>),
     b(tuple<u32, u32>),
   }
 
@@ -65,9 +65,9 @@ interface variants {
 
   bool-result: func() -> bool;
 
-  option-arg: func(a: option<bool>, b: option<tuple<u32>>, c: option<u32>, d: option<e1>, e: option<float32>, g: option<option<bool>>);
+  option-arg: func(a: option<bool>, b: option<tuple<u32>>, c: option<u32>, d: option<e1>, e: option<f32>, g: option<option<bool>>);
 
-  option-result: func() -> tuple<option<bool>, option<tuple<u32>>, option<u32>, option<e1>, option<float32>, option<option<bool>>>;
+  option-result: func() -> tuple<option<bool>, option<tuple<u32>>, option<u32>, option<e1>, option<f32>, option<option<bool>>>;
 
   casts: func(a: casts1, b: casts2, c: casts3, d: casts4, e: casts5, f: casts6) -> tuple<casts1, casts2, casts3, casts4, casts5, casts6>;
 
diff --git a/crates/wit-parser/tests/ui/functions.wit b/crates/wit-parser/tests/ui/functions.wit
index 8c4d8da0..e04025d5 100644
--- a/crates/wit-parser/tests/ui/functions.wit
+++ b/crates/wit-parser/tests/ui/functions.wit
@@ -6,9 +6,9 @@ interface functions {
   f3: func(a: u32,);
   f4: func() -> u32;
   f6: func() -> tuple<u32, u32>;
-  f7: func(a: float32, b: float32) -> tuple<u32, u32>;
-  f8: func(a: option<u32>) -> result<u32, float32>;
-  f9: func() -> (u: u32, f: float32);
+  f7: func(a: f32, b: f32) -> tuple<u32, u32>;
+  f8: func(a: option<u32>) -> result<u32, f32>;
+  f9: func() -> (u: u32, f: f32);
   f10: func() -> (u: u32);
   f11: func() -> ();
 }
diff --git a/crates/wit-parser/tests/ui/functions.wit.json b/crates/wit-parser/tests/ui/functions.wit.json
index bb2867cd..902fe357 100644
--- a/crates/wit-parser/tests/ui/functions.wit.json
+++ b/crates/wit-parser/tests/ui/functions.wit.json
@@ -59,11 +59,11 @@
           "params": [
             {
               "name": "a",
-              "type": "float32"
+              "type": "f32"
             },
             {
               "name": "b",
-              "type": "float32"
+              "type": "f32"
             }
           ],
           "results": [
@@ -98,7 +98,7 @@
             },
             {
               "name": "f",
-              "type": "float32"
+              "type": "f32"
             }
           ]
         },
@@ -148,7 +148,7 @@
       "kind": {
         "result": {
           "ok": "u32",
-          "err": "float32"
+          "err": "f32"
         }
       },
       "owner": null
diff --git a/crates/wit-parser/tests/ui/resources-multiple.wit b/crates/wit-parser/tests/ui/resources-multiple.wit
index 1e7146b9..aee2d29a 100644
--- a/crates/wit-parser/tests/ui/resources-multiple.wit
+++ b/crates/wit-parser/tests/ui/resources-multiple.wit
@@ -10,9 +10,9 @@ interface resources-multiple {
     f3: func(a: u32,);
     f4: func() -> u32;
     f6: func() -> tuple<u32, u32>;
-    f7: func(a: float32, b: float32) -> tuple<u32, u32>;
-    f8: func(a: option<u32>) -> result<u32, float32>;
-    f9: func() -> (u: u32, f: float32);
+    f7: func(a: f32, b: f32) -> tuple<u32, u32>;
+    f8: func(a: option<u32>) -> result<u32, f32>;
+    f9: func() -> (u: u32, f: f32);
     f10: func() -> (u: u32);
     f11: func() -> ();
   }
diff --git a/crates/wit-parser/tests/ui/resources-multiple.wit.json b/crates/wit-parser/tests/ui/resources-multiple.wit.json
index b77d35f8..2914ab99 100644
--- a/crates/wit-parser/tests/ui/resources-multiple.wit.json
+++ b/crates/wit-parser/tests/ui/resources-multiple.wit.json
@@ -122,11 +122,11 @@
             },
             {
               "name": "a",
-              "type": "float32"
+              "type": "f32"
             },
             {
               "name": "b",
-              "type": "float32"
+              "type": "f32"
             }
           ],
           "results": [
@@ -174,7 +174,7 @@
             },
             {
               "name": "f",
-              "type": "float32"
+              "type": "f32"
             }
           ]
         },
@@ -254,7 +254,7 @@
       "kind": {
         "result": {
           "ok": "u32",
-          "err": "float32"
+          "err": "f32"
         }
       },
       "owner": null
diff --git a/crates/wit-parser/tests/ui/types.wit b/crates/wit-parser/tests/ui/types.wit
index f21b0119..4d007b64 100644
--- a/crates/wit-parser/tests/ui/types.wit
+++ b/crates/wit-parser/tests/ui/types.wit
@@ -9,9 +9,9 @@ interface types {
   type t6 = s16;
   type t7 = s32;
   type t8 = s64;
-  type t9a = float32;
+  type t9a = f32;
   type t9b = f32;
-  type t10a = float64;
+  type t10a = f64;
   type t10b = f64;
   type t11 = char;
   type t12 = list<char>;
diff --git a/crates/wit-parser/tests/ui/types.wit.json b/crates/wit-parser/tests/ui/types.wit.json
index e2d0b954..8874e354 100644
--- a/crates/wit-parser/tests/ui/types.wit.json
+++ b/crates/wit-parser/tests/ui/types.wit.json
@@ -139,7 +139,7 @@
     {
       "name": "t9a",
       "kind": {
-        "type": "float32"
+        "type": "f32"
       },
       "owner": {
         "interface": 0
@@ -148,7 +148,7 @@
     {
       "name": "t9b",
       "kind": {
-        "type": "float32"
+        "type": "f32"
       },
       "owner": {
         "interface": 0
@@ -157,7 +157,7 @@
     {
       "name": "t10a",
       "kind": {
-        "type": "float64"
+        "type": "f64"
       },
       "owner": {
         "interface": 0
@@ -166,7 +166,7 @@
     {
       "name": "t10b",
       "kind": {
-        "type": "float64"
+        "type": "f64"
       },
       "owner": {
         "interface": 0
diff --git a/crates/wit-parser/tests/ui/union-fuzz-2.wit b/crates/wit-parser/tests/ui/union-fuzz-2.wit
index 3d0e55b8..771dc320 100644
--- a/crates/wit-parser/tests/ui/union-fuzz-2.wit
+++ b/crates/wit-parser/tests/ui/union-fuzz-2.wit
@@ -1,7 +1,7 @@
 package foo:bar;
 
 world foo {
-    export foo: func() -> (%name2: float32);
+    export foo: func() -> (%name2: f32);
 }
 
 
diff --git a/crates/wit-parser/tests/ui/union-fuzz-2.wit.json b/crates/wit-parser/tests/ui/union-fuzz-2.wit.json
index c09a8c06..6d1bc4ff 100644
--- a/crates/wit-parser/tests/ui/union-fuzz-2.wit.json
+++ b/crates/wit-parser/tests/ui/union-fuzz-2.wit.json
@@ -12,7 +12,7 @@
             "results": [
               {
                 "name": "name2",
-                "type": "float32"
+                "type": "f32"
               }
             ]
           }
@@ -36,7 +36,7 @@
             "results": [
               {
                 "name": "name2",
-                "type": "float32"
+                "type": "f32"
               }
             ]
           }
diff --git a/tests/local/component-model/definedtypes.wast b/tests/local/component-model/definedtypes.wast
index 76fb5bf6..aa47a2c9 100644
--- a/tests/local/component-model/definedtypes.wast
+++ b/tests/local/component-model/definedtypes.wast
@@ -8,8 +8,10 @@
   (type $A7 s32)
   (type $A8 u64)
   (type $A9 s64)
-  (type $A10 float32)
-  (type $A11 float64)
+  (type $A10a f32)
+  (type $A11a f64)
+  (type $A10b float32)
+  (type $A11b float64)
   (type $A12 char)
   (type $A13 string)
 
@@ -37,7 +39,7 @@
   (type $A22a (result))
   (type $A22b (result $A7))
   (type $A22c (result (error $A8)))
-  (type $A22d (result $A9 (error $A10)))
+  (type $A22d (result $A9 (error $A10a)))
 )
 
 (assert_invalid
diff --git a/tests/snapshots/local/component-model/definedtypes.wast/0.print b/tests/snapshots/local/component-model/definedtypes.wast/0.print
index 51aa77c8..004da9a6 100644
--- a/tests/snapshots/local/component-model/definedtypes.wast/0.print
+++ b/tests/snapshots/local/component-model/definedtypes.wast/0.print
@@ -8,29 +8,31 @@
   (type $A7 (;6;) s32)
   (type $A8 (;7;) u64)
   (type $A9 (;8;) s64)
-  (type $A10 (;9;) float32)
-  (type $A11 (;10;) float64)
-  (type $A12 (;11;) char)
-  (type $A13 (;12;) string)
-  (type (;13;) (tuple char))
-  (type $A14b (;14;) (record (field "x" 13)))
-  (type $A14c (;15;) (record (field "x" $A1)))
-  (type $A15a (;16;) (variant (case "x")))
-  (type $A15b (;17;) (variant (case "x" $A1)))
-  (type $A15c (;18;) (variant (case "x") (case "y" string (refines 0)) (case "z" string (refines 1))))
-  (type $A15d (;19;) (variant (case "x") (case "y" string (refines 0)) (case "z" string (refines 1))))
-  (type (;20;) (tuple u8))
-  (type $A16a (;21;) (list 20))
-  (type $A16b (;22;) (list $A3))
-  (type $A17a (;23;) (tuple u8))
-  (type $A17b (;24;) (tuple $A4))
-  (type $A18b (;25;) (flags "x"))
-  (type $A19b (;26;) (enum "x"))
-  (type (;27;) (tuple u32))
-  (type $A21a (;28;) (option 27))
-  (type $A21b (;29;) (option $A6))
-  (type $A22a (;30;) (result))
-  (type $A22b (;31;) (result $A7))
-  (type $A22c (;32;) (result (error $A8)))
-  (type $A22d (;33;) (result $A9 (error $A10)))
+  (type $A10a (;9;) f32)
+  (type $A11a (;10;) f64)
+  (type $A10b (;11;) f32)
+  (type $A11b (;12;) f64)
+  (type $A12 (;13;) char)
+  (type $A13 (;14;) string)
+  (type (;15;) (tuple char))
+  (type $A14b (;16;) (record (field "x" 15)))
+  (type $A14c (;17;) (record (field "x" $A1)))
+  (type $A15a (;18;) (variant (case "x")))
+  (type $A15b (;19;) (variant (case "x" $A1)))
+  (type $A15c (;20;) (variant (case "x") (case "y" string (refines 0)) (case "z" string (refines 1))))
+  (type $A15d (;21;) (variant (case "x") (case "y" string (refines 0)) (case "z" string (refines 1))))
+  (type (;22;) (tuple u8))
+  (type $A16a (;23;) (list 22))
+  (type $A16b (;24;) (list $A3))
+  (type $A17a (;25;) (tuple u8))
+  (type $A17b (;26;) (tuple $A4))
+  (type $A18b (;27;) (flags "x"))
+  (type $A19b (;28;) (enum "x"))
+  (type (;29;) (tuple u32))
+  (type $A21a (;30;) (option 29))
+  (type $A21b (;31;) (option $A6))
+  (type $A22a (;32;) (result))
+  (type $A22b (;33;) (result $A7))
+  (type $A22c (;34;) (result (error $A8)))
+  (type $A22d (;35;) (result $A9 (error $A10a)))
 )