Open bkushigian opened 9 months ago
The following code is a simplified/minimized version of OpenZeppelin's ERC721 contract:
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.19; interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); } abstract contract ERC165 is IERC165 { function supportsInterface( bytes4 interfaceId ) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } } abstract contract ERC721 is ERC165 { function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC165) returns (bool) { return interfaceId == interfaceId; } }
This compiles with solc:
solc
$ solc testcase/override_errors/ERC721.sol Compiler run successful. No output generated.
but solang_parser fails to parse it:
solang_parser
$ solang_parser testcase/override_errors/ERC721.sol ===== Error: testcase/override_errors/ERC721.sol ===== error: function 'supportsInterface' missing overrides 'IERC165', specify 'override(IERC165,ERC165)' ┌─ testcase/override_errors/ERC721.sol:21:27 │ 21 │ ) public view virtual override(ERC165) returns (bool) { │ ^^^^^^^^^^^^^^^^
Further, solang_parser suggests the fix, which I have stored in testcase/override_errors/ERC721_suggested_fix.sol. solc failes to compile this:
testcase/override_errors/ERC721_suggested_fix.sol
$ solc testcase/override_errors/ERC721_suggested_fix.sol Error: Invalid contract specified in override list: "IERC165". --> testcase/override_errors/ERC721_suggested_fix.sol:21:27: | 21 | ) public view virtual override(IERC165, ERC165) returns (bool) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ Note: This contract: --> testcase/override_errors/ERC721_suggested_fix.sol:6:1: | 6 | interface IERC165 { | ^ (Relevant source part starts here and spans across multiple lines).
but solang_parser successfully parses it.
The following code is a simplified/minimized version of OpenZeppelin's ERC721 contract:
This compiles with
solc
:but
solang_parser
fails to parse it:Further,
solang_parser
suggests the fix, which I have stored intestcase/override_errors/ERC721_suggested_fix.sol
.solc
failes to compile this:but
solang_parser
successfully parses it.