OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
452 stars 118 forks source link

TypeError: importedScope[a.foreign.name] is not a function #415

Closed GopherJ closed 1 year ago

GopherJ commented 1 year ago

we encountered this issue in https://github.com/para-space/paraspace-core image

leovigna commented 1 year ago

Had the same issue. Debugged this manually by ignoring files to isolate what file was causing the issue. Source code mentioned "// Delayed function call supports circular dependencies" but it seems the issue was stemming from @inheritdoc doc statements in an abstract contract.

When I had GrandChild -> Child -> Parent dependency with a @inheritdoc Child in the GrandChild contract, it worked for some of my non-abstract contracts so nested @inheritdoc seems to be working but just throws with my 1 abstract contract with the same configuration. For now as a quick fix, I just removed the @inheritdoc statements that would break solidity-docgen.

Hope this helps!

frangio commented 1 year ago

Can you share the full source code that reproduces the issue?

CarterAppleton commented 1 year ago

We're also experiencing this, you can repro on this commit of goldfinch-eng/mono

https://github.com/goldfinch-eng/mono/tree/4ffb02ed3363fd658eb144b52e59340e44e0e104

it's a monorepo so installation has some steps

We've fixed it temporarily by removing various @inheritdoc until it passed, but definitely not the ideal solution

frangio commented 1 year ago

Thanks. There was an error when using the syntax import {E} from ... and the imported symbols were not contracts (e.g. custom errors). This should be fixed in the latest version.

lnist commented 1 year ago

@frangio : I think ///@inheritdoc also fails in another case. Should I open a new issue?

A minimal example:

ImportedAs.sol

pragma solidity ^0.8.10;

Lib.sol

pragma solidity ^0.8.10;

import "./ImportedAs.sol" as ImportedAs;

Root.sol

pragma solidity ^0.8.10;

import {ImportedAs} from "./Lib.sol";

contract A {
   function f() internal virtual {}
}

contract B is A {
  ///@inheritdoc A
  function f() internal override {}
}
frangio commented 1 year ago

I'll take a look but please open another issue. The problem is probably lack of suport for import "" as X; syntax.