solc-typed-ast icon indicating copy to clipboard operation
solc-typed-ast copied to clipboard

Error: Unknown field countLegs on MemberAccess #8048 of type TokenId.

Open ezcodeslide opened this issue 1 year ago • 3 comments

I ran into an issue using InferType.isFunctionCallExternal(). Not sure if I'm doing something wrong but wanted to reach out for an assessment/recommendation. I'm using solc-typed-ast 18.1.3.

Calling code:

// solcVersion === '0.8.25'
const inferType: InferType = new InferType(solcVersion);
// call is an instance of FunctionCall
return inferType.isFunctionCallExternal(call);

Error info:

Error: Unknown field countLegs on MemberAccess #8048 of type TokenId.

MemberAccess #8048
    id: 8048
    src: "31693:20:2"
    typeString: "function (TokenId) pure returns (uint256)"
    vExpression: Identifier #8047
    memberName: "countLegs"
    referencedDeclaration: 24438
    context: ASTContext #20
    parent: FunctionCall #8049
    <getter> children: Array(1) [ Identifier #8047 ]
    <getter> vReferencedDeclaration: FunctionDefinition #24438
    <getter> type: "MemberAccess"
    <getter> firstChild: Identifier #8047
    <getter> lastChild: Identifier #8047
    <getter> previousSibling: undefined
    <getter> nextSibling: undefined
    <getter> root: SourceUnit #9892
    <getter> sourceInfo: Object { offset: 31693, length: 20, sourceIndex: 2 }

    at assert (/home/user/project/node_modules/solc-typed-ast/src/misc/utils.ts:32:11)
    at InferType.typeOfMemberAccess (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:1303:15)
    at InferType.typeOf (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:1773:25)
    at InferType.isFunctionCallExternal (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:2719:26)

ezcodeslide avatar Apr 12 '24 02:04 ezcodeslide

I updated to solc-typed-ast 18.1.6. Now I get a different error.

SolTypeError: Unexpected argument type literal_hex_string to builtin function bytes.concat in FunctionCall #3519.
    at InferType.typeOfMemberAccessImpl (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:1440:39)
    at InferType.typeOfMemberAccess (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:1281:30)
    at InferType.typeOf (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:1778:25)
    at InferType.isFunctionCallExternal (/home/user/project/node_modules/solc-typed-ast/src/types/infer.ts:2724:26)
    at isFunctionCallExternal (/home/user/project/src/utils.ts:1413:20)

ezcodeslide avatar May 11 '24 03:05 ezcodeslide

Looking into this

cd1m0 avatar Jul 11 '24 08:07 cd1m0

Do you have a code sample you could provide to reproduce locally?

cd1m0 avatar Jul 17 '24 01:07 cd1m0