From 72c07708e82c3594172083c567e949cc5d9d5e27 Mon Sep 17 00:00:00 2001 From: George Marques Date: Wed, 29 Sep 2021 11:23:16 -0300 Subject: GDScript: Don't allow builtin type names as identifiers --- modules/gdscript/gdscript_analyzer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/gdscript/gdscript_analyzer.cpp') diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 23e88ae059..aa62ad20ff 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -175,6 +175,11 @@ Error GDScriptAnalyzer::check_native_member_name_conflict(const StringName &p_me return ERR_PARSE_ERROR; } + if (GDScriptParser::get_builtin_type(p_member_name) != Variant::VARIANT_MAX) { + push_error(vformat(R"(The member "%s" cannot have the same name as a builtin type.)", p_member_name), p_member_node); + return ERR_PARSE_ERROR; + } + return OK; } -- cgit v1.2.3