GDQuest / GDQuest/GDScript-formatter

Parse error when annotation and a `const` variable are on the same line

Open
#329 0 comments 0 reactions 0 assignees View on GitHub
upstream
Dominant language
Rust
Stars
455
Forks
39
Avg merge
1d 15h
Merged PRs (30d)
4

Description

Input:

```gdscript
func test_warnings():
@warning_ignore("unused_local_constant") const unused_local_constant = 1
```

Error: `the input GDScript code contains parse errors`

This code is fine:

```gdscript
func test_warnings():
@warning_ignore("unused_local_constant") var unused_local_constant = 1
```

This is also fine (but it gets formatted into the input code and you get the same error when formatting again):

```gdscript
func test_warnings():
@warning_ignore("unused_local_constant")
const unused_local_constant = 1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported annotation-plus-const input and compare it with the working var and multiline const cases. Trace the formatter/parser entry point that handles annotations and local declarations; done means the one-line const form parses successfully and repeated formatting does not reintroduce the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.