Skip to content

[BLOCKED BY MACRO_RULES SEMANTICS] Support liniting inside inline macros arguments #333

@MKowalski8

Description

@MKowalski8

Problem

Due to recent compiler changes related to inline macros, the linter currently cannot analyze code inside macro arguments. As a result, any diagnostics within inline macros like assert! are not reported.

For example:

assert!(if x > y || x < y {
    true
} else {
    false
});

assert!({((a)) == b});

assert!(if true == true {
    loop {
        let a: felt252 = 'hello';
        let b = a.clone();
        println!("{}", b);
        break ();
    }
    
    true
} else {
    true
});

assert!({
    let a: felt252 = 'hello';
    let a: Result<[u64; 2], felt252> = Result::Ok([10, 20]);
    let _x = match a {
        Result::Ok(v) => {
            v
        },
        Result::Err(_) => 
            [1, 2]
    };
    let b = a.clone(); 
    true
});

println!("{}", x / x);

Even though many issues are present, the linter is currently unable to report them.

Proposed Solution

No response

Notes

One notable change is that arguments in Syntax are now only represented as tokens. As a result, accessing this data directly at the Syntax level is likely no longer possible.

assert!((((a))) == b);
Image

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog LS

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions