Skip to content

AST reimport fails for inline assembly with uninitialized variable declarations #13684

@cameel

Description

@cameel

An attempt to import an AST produced by the compiler fails when the original source code contains an inline assembly block with a variable declaration without an initializer:

test.sol

contract C {
    function f() public pure {
        assembly {
            let x
        }
    }
}
solc test.sol --combined-json ast | solc --import-ast -
Failed to import AST: Expected "nodeType" to be of type string!

This is reproducible all the way down to 0.6.2, when the --import-ast option was introduced, though before 0.8.0 the error message was different and it seems to be failing for a different reason (even examples that work on 0.8.x fail on those versions)

Failed to import AST: Top-level node should be a 'SourceUnit'

Discovered by @aart in #13576 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛low effortThere is not much implementation work to be done. The task is very easy or tiny.low impactChanges are not very noticeable or potential benefits are limited.must have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.should compile without errorError is reported even though it shouldn't. Source is fine.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions