Skip to content

Lexer misses the last comment after a const declaration #2356

@kayagokalp

Description

@kayagokalp

lex_commented() does not pick up // This is a comment next to a const with the following example:

contract;

const /* TEST: blah blah tests */ TEST: u16 = 10; // This is a comment next to a const

I believe this example is a valid sway program so while lexing we should include the last comment to the token stream.

I do suspect this happens not just after const but after the last semicolon in the source file (if there is no encapsulating braces etc). (Need to test this feeling and if that is the case I will update the title)

Realized while testing #2311

Metadata

Metadata

Assignees

Labels

P: criticalShould be looked at before anything elsebugSomething isn't workingcompiler: parserEverything to do with the parserteam:compilerCompiler Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions