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

lang: Fix parsing for bytes literals in the IDL #2261

Merged
merged 2 commits into from
Nov 16, 2022
Merged

lang: Fix parsing for bytes literals in the IDL #2261

merged 2 commits into from
Nov 16, 2022

Conversation

Aursen
Copy link
Contributor

@Aursen Aursen commented Nov 15, 2022

This is just a small correction for the generation of idl constants.

For example:

#[constant]
pub const BYTES_STR: &[u8] = b"test";

#[constant]
pub const BYTE_STR: u8 = b't';

It was generated like that before:

{
  "name": "BYTES_STR",
  "type": {
    "defined": "&[u8]"
  },
  "value": "b\"test\""
},
{
  "name": "BYTE_STR",
  "type": "u8",
  "value": "b't'"
}

Now:

{
  "name": "BYTES_STR",
  "type": "bytes",
  "value": "[116, 101, 115, 116]"
},
{
  "name": "BYTE_STR",
  "type": "u8",
  "value": "116"
}

Feel free to make comments especially on the quality of the code

@vercel
Copy link

vercel bot commented Nov 15, 2022

@Aursen is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@Aursen Aursen changed the title lang: Fix parsing of some constants lang: Fix parsing of some constants (WIP) Nov 15, 2022
@Aursen Aursen changed the title lang: Fix parsing of some constants (WIP) lang: Fix parsing for bytes literals in the IDL Nov 15, 2022
@Henry-E
Copy link
Contributor

Henry-E commented Nov 16, 2022

  • it adds functionality that fixes some kind of small issue
  • it adds a test to confirm this new functionality works
    Looks like a merge to me

@Henry-E Henry-E merged commit b107cbe into coral-xyz:master Nov 16, 2022
Henry-E pushed a commit to Henry-E/anchor that referenced this pull request Dec 6, 2022
* lang: Fix parsing of some constants

* Fix lint + changelog
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 this pull request may close these issues.

2 participants