Skip to content

Compiler ignores files located under the base path in Standard JSON #11038

@cameel

Description

@cameel

Related to #11036.

Description

With --standard-json the compiler does respect --base-path in imports but not in the Standard JSON itself. Even if a file is present under the base path in the virtual filesystem, the compiler won't use it. It will read it from disk if available though.

input.json

{
    "language": "Solidity",
    "sources": {
        "/tmp/x/y/a.sol": {"content": "import \"b.sol\";"},
        "/tmp/b.sol":     {"content": "contract B {}"}
    },
    "settings": {"outputSelection": {"*": { "*": []}}
    }
}
solc --standard-json input.json --base-path /tmp | jq --indent 4
{
    [
        ...
        {
            "component": "general",
            "errorCode": "6275",
            "formattedMessage": "ParserError: Source \"b.sol\" not found: File not found.\n --> /tmp/x/y/a.sol:1:1:\n  |\n1 | import \"b.sol\";\n  | ^^^^^^^^^^^^^^^\n\n",
            "message": "Source \"b.sol\" not found: File not found.",
            "severity": "error",
            "sourceLocation": {
                "end": 15,
                "file": "/tmp/x/y/a.sol",
                "start": 0
            },
            "type": "ParserError"
        }
    ],
    ...
}

Environment

  • Compiler version: 0.8.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions