reach-sh / reach-lang

Reach: The Safest and Smartest DApp Programming Language

Home Page:https://www.reach.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Solidity compiler failed with the message: Error: Invalid type for argument in function call. Invalid implicit conversion from struct T32 memory to struct T36 memory.

MetaB0y opened this issue · comments

I have a bunch of parallelReduces (6 in a row). The last two are very simple, it is

  const [needToConfiscate] = parallelReduce([!fullUnlock])
    .invariant(true)
    .while(needToConfiscate)
    .api_(Api.confiscate, () => {
      check(this == metaLabsAddress);

      return [
        (callback) => {
          callback(null);
          transfer([[balance(token), token]]).to(this);
          return [false];
        },
      ];
    });

  const [needToPay] = parallelReduce([!fullUnlock])
    .paySpec([wALGO])
    .invariant(true)
    .while(needToPay)
    .api_(Api.payAndRelease, (amount) => {
      check(this == metaLabsAddress);

      return [
        [0, [amount, wALGO]],
        (callback) => {
          callback(null);
          return [false];
        },
      ];
    })

It causes

The Solidity compiler failed with the message:
 
Error: Invalid type for argument in function call. Invalid implicit conversion from struct T32 memory to struct T36 memory requested.
   --> /tmp/reachc-sol-da154d2a4bf5dd20/compiled.sol:1691:10:
    |
1691 |       l6(la);
    |          ^^
    
CallStack (from HasCallStack):
 error, called at src/Reach/Util.hs:65:3 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Util
 impossible, called at src/Reach/Connector/ETH_Solidity.hs:1867:13 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Connector.ETH_Solidity

It is the initialization of needToPay with !fullUnlock in the second parallelReduce which causes the issue (if I change it to parallelReduce([true]), it compiles). What is weird that I have the same initialization of needToConfiscate in the first parallelReduce and it doesn't cause problems.

I hope that this information is enough to debug, if not please tell me and I will try to provide more details.

Sorry, this isn't enough information. Can you email me a gist or link to your code so I can investigate it?

I just messaged you on Discord about getting a copy of the program too. I'm going to close this since I haven't heard from you. Please feel free to reopen if you can get the program (I'll do that too if you resend it).

I provided the program which demonstrates this bug privately. I don't think I have permissions to reopen though.

Thank you!