diff --git a/codegen/src/vm_type.rs b/codegen/src/vm_type.rs index d1188d1cd2..5e935c7a43 100644 --- a/codegen/src/vm_type.rs +++ b/codegen/src/vm_type.rs @@ -119,7 +119,7 @@ fn gen_impl(container: &Container, ident: Ident, generics: Generics, data: &Data }} }); quote!{ - _gluon_base::types::Type::variants( + _gluon_base::types::Type::variant( vec![#(#variants),*] ) } diff --git a/codegen/tests/derive_vm_type.rs b/codegen/tests/derive_vm_type.rs index 92f34311ee..5d09888e60 100644 --- a/codegen/tests/derive_vm_type.rs +++ b/codegen/tests/derive_vm_type.rs @@ -25,6 +25,24 @@ fn struct_() { ); } +#[derive(VmType)] +#[allow(unused)] +enum Enum { + One, + Two(u32), + Three { id: String }, +} + +#[test] +fn enum_() { + let vm = new_vm(); + + assert_eq!( + Enum::make_type(&vm).to_string(), + "| One\n| Two Int\n| Three String" + ); +} + #[derive(VmType)] #[allow(unused)] struct Newtype(Struct);