hyperledger/solang

Parse and resolve fails on `address.code`

bkushigian opened this issue · 1 comments

I know this is an EVM bytecode thing which y'all don't support, not sure if there's a good way to handle this? But yeah, would be great to be able to handle this after resolution! The below example uses AddressCode.sol with contents:

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

contract AddressCode {
    function addressCode(address addr) public view returns (uint256) {
        return addr.code.length;
    }
}

and the solang_parser binary generated from this testing repo (it just runs parse_and_resolve).

$ solang_parser testcase/address_code/AddressCode.sol 

=====  Error: testcase/address_code/AddressCode.sol  =====
error: 'code' not found
  ┌─ /Users/benku/solang_parse/testcase/address_code/AddressCode.sol:6:16
  │
6 │         return addr.code.length;
  │                ^^^^^^^^^

$ solc testcase/address_code/AddressCode.sol
Compiler run successful. No output generated.

Closing this is a duplicate of #809 But many thanks @bkushigian for reporting this (and all your other bugs!) to us 👍