Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect location for doccoment without tag #1658

Open
klkvr opened this issue Jul 8, 2024 · 0 comments
Open

Incorrect location for doccoment without tag #1658

klkvr opened this issue Jul 8, 2024 · 0 comments

Comments

@klkvr
Copy link

klkvr commented Jul 8, 2024

Doccoments without tags are not being parsed correctly via parse_doccomments.

Can be reproduced with the following example:

pub fn main() {
    let src = "// SPDX-License-Identifier: MIT

/// Some doc comment
contract Counter {}";
    let (_, comments) = solang_parser::parse(src, 0).unwrap();
    let parsed = solang_parser::doccomment::parse_doccomments(&comments, 0, src.len());
    match &parsed[0] {
        solang_parser::doccomment::DocComment::Line {comment} => {
            assert!(comment.value_offset > src.len());
        }
        _ => unreachable!(),
    }
}

For parsed comment, value_offset will be out of bounds of the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant