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

Support byte[].AsString() #297

Closed
Tommo-L opened this issue Jun 19, 2020 · 2 comments · Fixed by #303
Closed

Support byte[].AsString() #297

Tommo-L opened this issue Jun 19, 2020 · 2 comments · Fixed by #303

Comments

@Tommo-L
Copy link
Contributor

Tommo-L commented Jun 19, 2020

public static string testbytearray2(byte[] a)
{
      Map<string, string> some = new Map<string, string>();
     some[a.AsString()] = "teststring2";
     return Json.Serialize(some);
}

posted at neo-project/neo#1710 (comment)

In upper case, we should convert Buffer to ByteString, as c# byte[] is NeoVM.Buffer, c# string is NeoVM.ByteString. But the compiler just igore AsString method, and return a Buffer.

Three problems:

  1. Compiler forget to convert byte[] in argument parameter list to Buffer
  2. AsString should convert Buffer to ByteString.
  3. Map<Primitive, StackItem>, the key of map can only be Primitive.
@erikzhang
Copy link
Member

Map should support string only.

@shargon
Copy link
Member

shargon commented Jun 19, 2020

Map should support string only.

Primitive, also should support integer and boolean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants