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

Add specific error for use of Godot 3 export syntax #104636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Meorge
Copy link
Contributor

@Meorge Meorge commented Mar 26, 2025

Closes godotengine/godot-proposals#11542.

This PR adds a special error message for when the Godot 3 export syntax is used in a GDScript file:

"export(...)" was removed in Godot 4. Use "@export" instead.

CleanShot 2025-03-25 at 21 14 27@2x

Note

As can be seen in the commit, the (...) in the message is always included, even if the user types something like

export var my_var

with no arguments to export.
CleanShot 2025-03-25 at 21 19 29@2x
If necessary, I could try to get this to detect the presence of arguments and change the error message accordingly, but I suspect that may end up complicating the code for it a lot.

@Meorge Meorge requested a review from a team as a code owner March 26, 2025 04:20
@dalexeev dalexeev added this to the 4.5 milestone Mar 26, 2025
@dalexeev
Copy link
Member

Maybe it's worth adding a test to modules/gdscript/tests/scripts/parser/errors.

@Meorge Meorge force-pushed the feat/export-syntax-error branch from 5838bc2 to 0e5da00 Compare March 26, 2025 16:17
@Meorge Meorge requested a review from a team as a code owner March 26, 2025 16:17
@Meorge Meorge force-pushed the feat/export-syntax-error branch from 0e5da00 to 031bfa6 Compare March 27, 2025 04:41
Update modules/gdscript/gdscript_parser.cpp

Co-authored-by: Danil Alexeev <[email protected]>

Improve error message

Add tests
@Meorge Meorge force-pushed the feat/export-syntax-error branch from 031bfa6 to 78b6cca Compare March 28, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom error message for Godot 3 export syntax
2 participants