godotengine / godotengine/godot
Lambda requires extra line before End Of File
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in Godot 4.3
### System information
Windows 11, Godot 4.3-stable
### Issue description
If I leave a lamda at the end of the file like this (line 12):

The parser throws an error:

However, this is fine (with extra line 13):

Ignore the fact that I'm doing stupid signal stuff above and causing infinite recursion, that's not a bug that's lack of sleep 💩
Pretty annoying as I frequently write lambdas like this and they happen to be at the EOF.
### Steps to reproduce
Open the MRP, issue.gd will not be parsed correctly.
### Minimal reproduction project (MRP)
[lambda-eof-mrp.zip](https://github.com/user-attachments/files/16784606/lambda-eof-mrp.zip)
Contributor guide
Research direction
Open lambda-eof-mrp.zip and reproduce the parser error from issue.gd with the lambda at end of file. Trace the Godot parser behavior for the final lambda and verify that the reproduction parses without requiring an extra blank line at EOF.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100