Skip to content

[Bug] delete statement misparsed as variable declaration with custom type "delete" #1079

Closed

Description

@nolanv-be

Component

syn-solidity

What version of Alloy are you on?

syn-solidity v1.5.7

Operating System

Linux

Describe the bug

Description

When parsing a delete statement inside a function body, syn-solidity incorrectly parses it as a StmtVarDecl with a custom type named "delete" instead of recognizing it as a StmtExpr containing an ExprDelete.

Reproduction

contract Example {
    Status public status;
    
    enum Status { Pending, Active }
    
    function resetStatus() external returns (Status) {
        delete status;
        return status;
    }
}

Actual Behavior

The statement is parsed as:

Stmt::StmtVarDecl {
    declaration: VarDecl(
        VariableDeclaration {
            attrs: [],
            ty: Type::Custom(
                [
                    SolIdent(
                        "delete",
                    ),
                ],
            ),
            storage: None,
            name: Some(
                SolIdent(
                    "status",
                ),
            ),
        },
    ),
    assignment: None,
}

The delete keyword is being treated as a custom type name rather than being recognized as the delete unary operator.

Expected Behavior

The statement delete status; should be parsed as ExprDelete

Activity

  1. added
    bug
    on Feb 25, 2026
  2. nolanv-be commented on Mar 5, 2026

    @nolanv-be
    Author

    Sadly, I don't have the time to write tests and submit a PR, but the fix is up on my fork https://github.com/nolanv-be/core/tree/fix-syn-solidity.
    I also included a fix for YulPath, which was missing a deref.

  3. felixfaisal commented on Mar 12, 2026

    @felixfaisal

    Hey @nolanv-be happy to do it for you! if that's alright with you

  4. nolanv-be commented on Mar 14, 2026

    @nolanv-be
    Author

    @felixfaisal Happy to! But don't pull the latest commit on my fork because it was written by an LLM, so the quality isn't great and I don't trust the code. Here's the link to the branch before that last commit.
    https://github.com/alloy-rs/core/tree/e603f535f7ba77bddce53b5bde6284d8e0386dbe

  5. moved this from Todo to Done in Alloyon Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions