DeclarationError: Undeclared identifier. bytes memory bytecode = type(aa).creationCode

browser/text.sol:5:37: DeclarationError: Undeclared identifier. bytes memory bytecode = type(aa).creationCode; ^^

:1234: Code to reproduce

pragma solidity ^0.5.16;
import './aa.sol';
contract w {
    function seyt() public {
       bytes memory bytecode = type(aa).creationCode;
    }


}

aa

pragma solidity ^0.5.14;
contract C {
    function set() public view returns(uint256 t){
       t=5;
    }
    uint256 e;
    function aaaa()public{
        e=222;
    }


}
1 Like

If you want to use type(aa).creationCode; to create a new contract, you should define the name of this contract is aa rather than C.

2 Likes