hyperledger / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.25k stars 208 forks source link

Parse and resolve fails on `address.code` #1537

Closed bkushigian closed 11 months ago

bkushigian commented 11 months ago

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.
xermicus commented 11 months ago

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