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

struct init missing arguments should have default value #319

Open
vird opened this issue Nov 10, 2020 · 0 comments
Open

struct init missing arguments should have default value #319

vird opened this issue Nov 10, 2020 · 0 comments

Comments

@vird
Copy link
Contributor

vird commented Nov 10, 2020

input:
pragma solidity ^0.5.11;

contract Test {
  struct Person {
    address payable account;
    uint age;
    uint skill;
    uint bet;
    mapping (address => uint) referralRewards;
  }

  function test() public {
    Person memory p = Person(msg.sender, 30, 100, 0);
  }
}

output:

type test_Person is record
  account : address;
  age : nat;
  skill : nat;
  bet : nat;
  referralRewards : map(address, nat);
end;

type test_args is unit;
type state is unit;

const burn_address : address = ("tz1ZZZZZZZZZZZZZZZZZZZZZZZZZZZZNkiRg" : address);

const test_Person_default : test_Person = record [ account = burn_address;
  age = 0n;
  skill = 0n;
  bet = 0n;
  referralRewards = (map end : map(address, nat)) ];

type router_enum is
  | Test of test_args;

function test (const res__unit : unit) : (unit) is
  block {
    const p : test_Person = record [ account = Tezos.sender;
      age = 30n;
      skill = 100n;
      bet = 0n ];
  } with (unit);

function main (const action : router_enum; const self : state) : (list(operation) * state) is
  (case action of
  | Test(match_action) -> block {
    (* This function does nothing, but it's present in router *)
    const tmp : unit = test(unit);
  } with (((nil: list(operation)), self))
  end);
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

1 participant