diff options
Diffstat (limited to 'modules/gdscript')
19 files changed, 204 insertions, 46 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 718bf3f6d4..85ff5080f0 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -18,12 +18,13 @@ <param index="2" name="b8" type="int" /> <param index="3" name="a8" type="int" default="255" /> <description> - Returns a [Color] constructed from red ([param r8]), green ([param g8]), blue ([param b8]), and optionally alpha ([param a8]) integer channels, each divided by [code]255.0[/code] for their final value. + Returns a [Color] constructed from red ([param r8]), green ([param g8]), blue ([param b8]), and optionally alpha ([param a8]) integer channels, each divided by [code]255.0[/code] for their final value. Using [method Color8] instead of the standard [Color] constructor is useful when you need to match exact color values in an [Image]. [codeblock] var red = Color8(255, 0, 0) # Same as Color(1, 0, 0). var dark_blue = Color8(0, 0, 51) # Same as Color(0, 0, 0.2). var my_color = Color8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4). [/codeblock] + [b]Note:[/b] Due to the lower precision of [method Color8] compared to the standard [Color] constructor, a color created with [method Color8] will generally not be equal to the same color created with the standard [Color] constructor. Use [method Color.is_equal_approx] for comparisons to avoid issues with floating-point precision error. </description> </method> <method name="assert"> diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 1a1d021dbc..2646c1ad15 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2483,7 +2483,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b subclass = nullptr; break; } else { - Vector<StringName> extend_classes = subclass->extends; + Vector<GDScriptParser::IdentifierNode *> extend_classes = subclass->extends; Ref<FileAccess> subfile = FileAccess::open(subclass->extends_path, FileAccess::READ); if (subfile.is_null()) { @@ -2513,7 +2513,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b } const GDScriptParser::ClassNode *inner_class = subclass->members[i].m_class; - if (inner_class->identifier->name == extend_classes[0]) { + if (inner_class->identifier->name == extend_classes[0]->name) { extend_classes.remove_at(0); found = true; subclass = inner_class; @@ -2527,7 +2527,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b } } } else if (subclass->extends.size() == 1) { - *r_base_type = subclass->extends[0]; + *r_base_type = subclass->extends[0]->name; subclass = nullptr; } else { break; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 38d5ae6b77..a2cab25ce8 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -415,7 +415,8 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c push_error("Could not resolve an empty super class path.", p_class); return ERR_PARSE_ERROR; } - const StringName &name = p_class->extends[extends_index++]; + GDScriptParser::IdentifierNode *id = p_class->extends[extends_index++]; + const StringName &name = id->name; base.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; if (ScriptServer::is_global_class(name)) { @@ -426,13 +427,13 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c } else { Ref<GDScriptParserRef> base_parser = get_parser_for(base_path); if (base_parser.is_null()) { - push_error(vformat(R"(Could not resolve super class "%s".)", name), p_class); + push_error(vformat(R"(Could not resolve super class "%s".)", name), id); return ERR_PARSE_ERROR; } Error err = base_parser->raise_status(GDScriptParserRef::INHERITANCE_SOLVED); if (err != OK) { - push_error(vformat(R"(Could not resolve super class inheritance from "%s".)", name), p_class); + push_error(vformat(R"(Could not resolve super class inheritance from "%s".)", name), id); return err; } base = base_parser->get_parser()->head->get_datatype(); @@ -440,19 +441,19 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c } else if (ProjectSettings::get_singleton()->has_autoload(name) && ProjectSettings::get_singleton()->get_autoload(name).is_singleton) { const ProjectSettings::AutoloadInfo &info = ProjectSettings::get_singleton()->get_autoload(name); if (info.path.get_extension().to_lower() != GDScriptLanguage::get_singleton()->get_extension()) { - push_error(vformat(R"(Singleton %s is not a GDScript.)", info.name), p_class); + push_error(vformat(R"(Singleton %s is not a GDScript.)", info.name), id); return ERR_PARSE_ERROR; } Ref<GDScriptParserRef> info_parser = get_parser_for(info.path); if (info_parser.is_null()) { - push_error(vformat(R"(Could not parse singleton from "%s".)", info.path), p_class); + push_error(vformat(R"(Could not parse singleton from "%s".)", info.path), id); return ERR_PARSE_ERROR; } Error err = info_parser->raise_status(GDScriptParserRef::INHERITANCE_SOLVED); if (err != OK) { - push_error(vformat(R"(Could not resolve super class inheritance from "%s".)", name), p_class); + push_error(vformat(R"(Could not resolve super class inheritance from "%s".)", name), id); return err; } base = info_parser->get_parser()->head->get_datatype(); @@ -467,7 +468,7 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c for (GDScriptParser::ClassNode *look_class : script_classes) { if (look_class->identifier && look_class->identifier->name == name) { if (!look_class->get_datatype().is_set()) { - Error err = resolve_class_inheritance(look_class, p_class); + Error err = resolve_class_inheritance(look_class, id); if (err) { return err; } @@ -477,7 +478,7 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c break; } if (look_class->has_member(name)) { - resolve_class_member(look_class, name, p_class); + resolve_class_member(look_class, name, id); base = look_class->get_member(name).get_datatype(); found = true; break; @@ -485,27 +486,26 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c } if (!found) { - push_error(vformat(R"(Could not find base class "%s".)", name), p_class); + push_error(vformat(R"(Could not find base class "%s".)", name), id); return ERR_PARSE_ERROR; } } } for (int index = extends_index; index < p_class->extends.size(); index++) { + GDScriptParser::IdentifierNode *id = p_class->extends[index]; + if (base.kind != GDScriptParser::DataType::CLASS) { - push_error(R"(Super type "%s" is not a GDScript. Cannot get nested types.)", p_class); + push_error(vformat(R"(Cannot get nested types for extension from non-GDScript type "%s".)", base.to_string()), id); return ERR_PARSE_ERROR; } - // TODO: Extends could use identifier nodes. That way errors can be pointed out properly and it can be used here. - GDScriptParser::IdentifierNode *id = parser->alloc_node<GDScriptParser::IdentifierNode>(); - id->name = p_class->extends[index]; - reduce_identifier_from_base(id, &base); - GDScriptParser::DataType id_type = id->get_datatype(); + if (!id_type.is_set()) { - push_error(vformat(R"(Could not find type "%s" under base "%s".)", id->name, base.to_string()), p_class); + push_error(vformat(R"(Could not find nested type "%s".)", id->name), id); + return ERR_PARSE_ERROR; } base = id_type; @@ -2548,7 +2548,7 @@ void GDScriptAnalyzer::reduce_await(GDScriptParser::AwaitNode *p_await) { #ifdef DEBUG_ENABLED GDScriptParser::DataType to_await_type = p_await->to_await->get_datatype(); - if (!(to_await_type.has_no_type() || to_await_type.is_coroutine || to_await_type.builtin_type == Variant::SIGNAL)) { + if (!to_await_type.is_coroutine && !to_await_type.is_variant() && to_await_type.builtin_type != Variant::SIGNAL) { parser->push_warning(p_await, GDScriptWarning::REDUNDANT_AWAIT); } #endif @@ -4778,7 +4778,7 @@ void GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p } #ifdef DEBUG_ENABLED -bool GDScriptAnalyzer::is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context) { +void GDScriptAnalyzer::is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context) { const StringName &name = p_local->name; GDScriptParser::DataType base = parser->current_class->get_datatype(); GDScriptParser::ClassNode *base_class = base.class_type; @@ -4790,50 +4790,52 @@ bool GDScriptAnalyzer::is_shadowing(GDScriptParser::IdentifierNode *p_local, con for (MethodInfo &info : gdscript_funcs) { if (info.name == name) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "built-in function"); - return true; + return; } } + if (Variant::has_utility_function(name)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "built-in function"); - return true; + return; } else if (ClassDB::class_exists(name)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "global class"); - return true; + return; + } else if (GDScriptParser::get_builtin_type(name) != Variant::VARIANT_MAX) { + parser->push_warning(p_local, GDScriptWarning::SHADOWED_GLOBAL_IDENTIFIER, p_context, name, "built-in type"); + return; } } while (base_class != nullptr) { if (base_class->has_member(name)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE, p_context, p_local->name, base_class->get_member(name).get_type_name(), itos(base_class->get_member(name).get_line())); - return true; + return; } base_class = base_class->base_type.class_type; } StringName parent = base.native_type; while (parent != StringName()) { - ERR_FAIL_COND_V_MSG(!class_exists(parent), false, "Non-existent native base class."); + ERR_FAIL_COND_MSG(!class_exists(parent), "Non-existent native base class."); if (ClassDB::has_method(parent, name, true)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE_BASE_CLASS, p_context, p_local->name, "method", parent); - return true; + return; } else if (ClassDB::has_signal(parent, name, true)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE_BASE_CLASS, p_context, p_local->name, "signal", parent); - return true; + return; } else if (ClassDB::has_property(parent, name, true)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE_BASE_CLASS, p_context, p_local->name, "property", parent); - return true; + return; } else if (ClassDB::has_integer_constant(parent, name, true)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE_BASE_CLASS, p_context, p_local->name, "constant", parent); - return true; + return; } else if (ClassDB::has_enum(parent, name, true)) { parser->push_warning(p_local, GDScriptWarning::SHADOWED_VARIABLE_BASE_CLASS, p_context, p_local->name, "enum", parent); - return true; + return; } parent = ClassDB::get_parent_class(parent); } - - return false; } #endif diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index 7a50b32d4c..5902035bcd 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -131,7 +131,7 @@ class GDScriptAnalyzer { Ref<GDScriptParserRef> get_parser_for(const String &p_path); void reduce_identifier_from_base_set_class(GDScriptParser::IdentifierNode *p_identifier, GDScriptParser::DataType p_identifier_datatype); #ifdef DEBUG_ENABLED - bool is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context); + void is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context); #endif public: diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index e27b977e9d..5413eadf60 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1165,8 +1165,18 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code bool has_operation = assignment->operation != GDScriptParser::AssignmentNode::OP_NONE; if (has_operation) { // Perform operation. - GDScriptCodeGenerator::Address op_result = codegen.add_temporary(_gdtype_from_datatype(assignment->get_datatype(), codegen.script)); GDScriptCodeGenerator::Address og_value = _parse_expression(codegen, r_error, assignment->assignee); + + if (!has_setter && !assignment->use_conversion_assign) { + // If there's nothing special about the assignment, perform the assignment as part of the operator + gen->write_binary_operator(target, assignment->variant_op, og_value, assigned_value); + if (assigned_value.mode == GDScriptCodeGenerator::Address::TEMPORARY) { + gen->pop_temporary(); // Pop assigned value if not done before. + } + return GDScriptCodeGenerator::Address(); + } + + GDScriptCodeGenerator::Address op_result = codegen.add_temporary(_gdtype_from_datatype(assignment->get_datatype(), codegen.script)); gen->write_binary_operator(op_result, assignment->variant_op, og_value, assigned_value); to_assign = op_result; diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 63dfd4d27c..f3a86522ae 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1956,7 +1956,7 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context, GDScriptParser::CompletionContext c = p_context; c.current_line = type_test->operand->start_line; c.current_suite = suite; - if ((!id_type.is_set() || id_type.is_variant()) && type_test->test_datatype.is_hard_type()) { + if (type_test->test_datatype.is_hard_type()) { id_type = type_test->test_datatype; if (last_assign_line < c.current_line) { // Override last assignment. @@ -3368,10 +3368,10 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co if (context.current_class && context.current_class->extends.size() > 0) { bool success = false; - ClassDB::get_integer_constant(context.current_class->extends[0], p_symbol, &success); + ClassDB::get_integer_constant(context.current_class->extends[0]->name, p_symbol, &success); if (success) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT; - r_result.class_name = context.current_class->extends[0]; + r_result.class_name = context.current_class->extends[0]->name; r_result.class_member = p_symbol; return OK; } diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 00a3e41c2b..e2a37ab6e9 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -712,14 +712,14 @@ void GDScriptParser::parse_extends() { if (!consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected superclass name after "extends".)")) { return; } - current_class->extends.push_back(previous.literal); + current_class->extends.push_back(parse_identifier()); while (match(GDScriptTokenizer::Token::PERIOD)) { make_completion_context(COMPLETION_INHERIT_TYPE, current_class, chain_index++); if (!consume(GDScriptTokenizer::Token::IDENTIFIER, R"(Expected superclass name after ".".)")) { return; } - current_class->extends.push_back(previous.literal); + current_class->extends.push_back(parse_identifier()); } } @@ -4479,7 +4479,7 @@ void GDScriptParser::TreePrinter::print_class(ClassNode *p_class) { } else { first = false; } - push_text(p_class->extends[i]); + push_text(p_class->extends[i]->name); } } diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 346c9bc45d..29841ab060 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -710,7 +710,7 @@ public: bool extends_used = false; bool onready_used = false; String extends_path; - Vector<StringName> extends; // List for indexing: extends A.B.C + Vector<IdentifierNode *> extends; // List for indexing: extends A.B.C DataType base_type; String fqcn; // Fully-qualified class name. Identifies uniquely any class in the project. #ifdef TOOLS_ENABLED diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index 146ed10ceb..2ed444c7ad 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -717,7 +717,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode class_api["path"] = path; Array extends_class; for (int i = 0; i < p_class->extends.size(); i++) { - extends_class.append(String(p_class->extends[i])); + extends_class.append(String(p_class->extends[i]->name)); } class_api["extends_class"] = extends_class; class_api["extends_file"] = String(p_class->extends_path); diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.gd b/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.gd new file mode 100644 index 0000000000..54cf4d89ec --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.gd @@ -0,0 +1,5 @@ +class Foo extends RefCounted.Bar: + pass + +func test(): + print('not ok') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.out b/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.out new file mode 100644 index 0000000000..386d6261c6 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_non_gdscript_nested.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Cannot get nested types for extension from non-GDScript type "RefCounted". diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.gd b/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.gd new file mode 100644 index 0000000000..0f7d584edb --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.gd @@ -0,0 +1,8 @@ +class Foo: + pass + +class Bar extends Foo.Baz: + pass + +func test(): + print('not ok') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.out b/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.out new file mode 100644 index 0000000000..42873056f2 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_unknown.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Could not find nested type "Baz". diff --git a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd index 4c02fd4b0d..292db30bcd 100644 --- a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd +++ b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd @@ -11,5 +11,5 @@ func test(): print("done") -func regular_func(): +func regular_func() -> int: return 0 diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.gd b/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.gd new file mode 100644 index 0000000000..f8844d66a7 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.gd @@ -0,0 +1,53 @@ +signal my_signal() + +# CI cannot test async things. +func test_signals(): + await my_signal + var t: Signal = my_signal + await t + +func coroutine() -> void: + @warning_ignore("redundant_await") + await 0 + +func not_coroutine_variant(): + pass + +func not_coroutine_void() -> void: + pass + +func test(): + const CONST_NULL = null + var var_null = null + var var_int: int = 1 + var var_variant: Variant = 1 + var var_array: Array = [1] + + await CONST_NULL + await var_null + await var_int + await var_variant + await var_array[0] + + await coroutine + await coroutine() + await coroutine.call() + await self.coroutine() + await call(&"coroutine") + + await not_coroutine_variant + await not_coroutine_variant() + await self.not_coroutine_variant() + await not_coroutine_variant.call() + await call(&"not_coroutine_variant") + + await not_coroutine_void + await not_coroutine_void() + await self.not_coroutine_void() + await not_coroutine_void.call() + await call(&"not_coroutine_void") + + var callable: Callable = coroutine + await callable + await callable.call() + await callable.get_method() diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.out b/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.out new file mode 100644 index 0000000000..3d251c2906 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.out @@ -0,0 +1,37 @@ +GDTEST_OK +>> WARNING +>> Line: 26 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 28 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 32 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 38 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 44 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 45 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 46 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 51 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. +>> WARNING +>> Line: 53 +>> REDUNDANT_AWAIT +>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal. diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.gd b/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.gd new file mode 100644 index 0000000000..61945c9c8f --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.gd @@ -0,0 +1,12 @@ +var member: int = 0 + +@warning_ignore("unused_variable") +func test(): + var Array := 'Array' + var Node := 'Node' + var is_same := 'is_same' + var sqrt := 'sqrt' + var member := 'member' + var reference := 'reference' + + print('warn') diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.out b/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.out new file mode 100644 index 0000000000..9d0e567534 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/shadowning.out @@ -0,0 +1,26 @@ +GDTEST_OK +>> WARNING +>> Line: 5 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The variable 'Array' has the same name as a built-in type. +>> WARNING +>> Line: 6 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The variable 'Node' has the same name as a global class. +>> WARNING +>> Line: 7 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The variable 'is_same' has the same name as a built-in function. +>> WARNING +>> Line: 8 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The variable 'sqrt' has the same name as a built-in function. +>> WARNING +>> Line: 9 +>> SHADOWED_VARIABLE +>> The local variable "member" is shadowing an already-declared variable at line 1. +>> WARNING +>> Line: 10 +>> SHADOWED_VARIABLE_BASE_CLASS +>> The local variable "reference" is shadowing an already-declared method at the base class "RefCounted". +warn diff --git a/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd index 9da61ab184..1c39073be9 100644 --- a/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd +++ b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd @@ -4,5 +4,5 @@ func test(): print(await not_coroutine()) -func not_coroutine(): +func not_coroutine() -> String: return "awaited" |