OCamlPro / ocaml-solidity

Ocaml-solidity provides a Solidity parser and typechecker
https://ocamlpro.github.io/ocaml-solidity
Other
32 stars 10 forks source link

Error while trying to import the same identifier multiple times #32

Closed hra687261 closed 2 years ago

hra687261 commented 2 years ago

Given the files: m1.sol:

pragma solidity >=0.6.0;

contract A {
}

m2.sol:

pragma solidity >=0.6.0;

import "./m1.sol";

contract B is A {
}

m3.sol:

pragma solidity >=0.6.0;

import {A} from "./m1.sol";
import "./m2.sol";

Trying to parser and type-check m3.sol results in the following error:

.../m1.sol:3.10-3.11:
Type error: Identifier A already declared in module
   1   pragma solidity >=0.6.0;
   2   
   3 > contract A {}

While it should work since there is only one identifier A that is imported multiple times.

hra687261 commented 2 years ago

Fixed by #33