Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytes typedef does not compile #78

Open
arg0d opened this issue May 27, 2024 · 1 comment
Open

bytes typedef does not compile #78

arg0d opened this issue May 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@arg0d
Copy link
Collaborator

arg0d commented May 27, 2024

UDL

[Custom]
typedef bytes SomeType

Generated C#

using SomeType = bytes[];

Error

C:\workspace\uniffi-bindgen-cs\dotnet-tests\UniffiCS\gen\custom_types_builtin.cs(19,15): error CS8936: Feature 'using type alias' is not available in C# 10.0. Please use language version 12.0 or greater. [C:\workspace\uniffi-bindgen-cs\dotnet-tests\UniffiCS\UniffiCS.csproj::TargetFramework=net48]

Test diff repro:

diff --git a/fixtures/custom-types-builtin/src/custom_types_builtin.udl b/fixtures/custom-types-builtin/src/custom_types_builtin.udl
index c71fb4f..24170e0 100644
--- a/fixtures/custom-types-builtin/src/custom_types_builtin.udl
+++ b/fixtures/custom-types-builtin/src/custom_types_builtin.udl
@@ -12,6 +12,9 @@ typedef string MyString;
 [Custom]
 typedef sequence<string> Array;

+[Custom]
+typedef bytes Bytes;
+
 [Custom]
 typedef record<string, string> Table;

@@ -51,6 +54,7 @@ typedef double Double;
 dictionary CustomTypesBuiltin {
     MyString string;
     Array array;
+    Bytes bytes;
     Table table;
     Boolean boolean;
     Int8 int8;
diff --git a/fixtures/custom-types-builtin/src/lib.rs b/fixtures/custom-types-builtin/src/lib.rs
index 9352f02..56de1ba 100644
--- a/fixtures/custom-types-builtin/src/lib.rs
+++ b/fixtures/custom-types-builtin/src/lib.rs
@@ -23,6 +23,7 @@ macro_rules! define_custom_builtin_type {

 define_custom_builtin_type!(MyString, String);
 define_custom_builtin_type!(Array, Vec<String>);
+define_custom_builtin_type!(Bytes, Vec<u8>);
 define_custom_builtin_type!(Table, HashMap<String, String>);
 define_custom_builtin_type!(Boolean, bool);
 define_custom_builtin_type!(Int8, i8);
@@ -39,6 +40,7 @@ define_custom_builtin_type!(Double, f64);
 pub struct CustomTypesBuiltin {
     string: MyString,
     array: Array,
+    bytes: Bytes,
     table: Table,
     boolean: Boolean,
     int8: Int8,
@@ -57,6 +59,7 @@ pub fn get_custom_types_builtin() -> CustomTypesBuiltin {
     return CustomTypesBuiltin {
         string: MyString("Hello, world!".to_string()),
         array: Array(vec!["Hello, world!".to_string()]),
+        bytes: Bytes(vec![0x13, 0x37]),
         table: Table(HashMap::from([("hello".to_string(), "world".to_string())])),
         boolean: Boolean(true),
         int8: Int8(i8::MAX),
@arg0d arg0d added the bug Something isn't working label May 27, 2024
@arg0d
Copy link
Collaborator Author

arg0d commented May 27, 2024

This would be solved by #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant