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 index_access #96

Open
KStasi opened this issue Feb 7, 2020 · 1 comment
Open

Support index_access #96

KStasi opened this issue Feb 7, 2020 · 1 comment

Comments

@KStasi
Copy link
Collaborator

KStasi commented Feb 7, 2020

example:

pragma solidity ^0.4.16;

contract BytesTest {
    function test10(bytes20 b0) public {
        bytes1 b6 = b0[1];
    }
}

@vird
Copy link
Contributor

vird commented Jul 20, 2020

N.b. should be compiled as const b6 : bytes = Bytes.sub(1n, 2n, b0);
for cast to int

function foo (const a : int ; const b : int) : int is
block { 
    const initial : int = 17;
    const packed : bytes = Bytes.pack(initial);
    const unpacked : option(int) = Bytes.unpack(packed);
    const value : int = case unpacked of 
      | None -> (failwith("cant unpack") : int)
      | Some(value) -> value
    end;
} with value

Also we need emulator tests for that

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

No branches or pull requests

2 participants