You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I see, include in included files only works relative to the main contract file. This is ok if we have all files in the same project, but if we include a contract from another repository or an npm package and that contract includes something relative to it then it won't work. I think the best is to resolve includes relative to the current file.
include "./lib/Library.aes"
contract Includes =
entrypoint test(x: int): int = Library.sum(x, 4)
Library.aes
include "./Sublibrary.aes"
namespace Library =
function sum(x: int, y: int) : int = Sublibrary.sum(x, y)
Sublibrary.aes
namespace Sublibrary =
function sum(x: int, y: int) : int = x + y
$ aesophia_cli --version
Sophia compiler version 7.0.1
$ aesophia_cli ./Includes.aes
Parse error in'./lib/Library.aes' at line 1, col 1:
Couldn't find include file './Sublibrary.aes'
The compiler should search for paths relative to the file that has the include at first, and then relative to the path of the main contract. That's how the erlang compiler seems to handle includes.
So I think that both include "./Sublibrary.aes" and include "./lib/Sublibrary.aes" should work.
As I see,
include
in included files only works relative to the main contract file. This is ok if we have all files in the same project, but if we include a contract from another repository or an npm package and that contract includes something relative to it then it won't work. I think the best is to resolve includes relative to the current file.Reproduction
Includes.aes
Library.aes
Sublibrary.aes
But if I replace
in Library.aes then it works
The text was updated successfully, but these errors were encountered: