### Godot version

4.2.dev commit 013e8e3afb982d4b230f0039b6dc248b48794ab9

### System information

Any

### Issue description

The following code from [dialogic](https://github.com/coppolaemilio/dialogic) no longer works in 4.2-dev, but does in 4.1 and before:
```gdscript
class VariableFolder:
        var data = {}
        var path = ""
        var outside
        func _init(_data, _path, _outside):
                data = _data
                path = _path
                outside = _outside
        
        func _get(property):
                property = str(property)
                if property in data:
                        if typeof(data[property]) == TYPE_DICTIONARY:
                                return VariableFolder.new(data[property], path+"."+property, outside)  ### <====== ERROR ###
                        else:
                                return DialogicUtil.logical_convert(data[property])
        
        func _set(property, value):
                property = str(property)
                if not value is VariableFolder:
                        outside._set_value_in_dictionary(path+"."+property, outside.dialogic.current_state_info['variables'], value)
                        return true
                elif VariableFolder:
                        return true
```
On compilation this will give the error
```
SCRIPT ERROR: Compile Error: Identifier not found: VariableFolder
          at: GDScript::reload (res://addons/dialogic/Modules/Variable/subsystem_variables.gd:182)
```
(line 182 is the `VariableFolder.new` line)

i bisected it to the following commit, from #79880:
```
d53fc92b4c6b5e4484e8f0bfff6ac55163dde3fb is the first bad commit
commit d53fc92b4c6b5e4484e8f0bfff6ac55163dde3fb
Author: Danil Alexeev <danil@alexeev.xyz>
Date:   Tue Jul 25 14:21:49 2023 +0300

    GDScript: Fix bug with identifier shadowed below in current scope
```

### Steps to reproduce

i think the issue description is complete enough to allow reproduction, let me know if there's any problems.

### Minimal reproduction project

N/A
bool is_constructor = (base_type.is_meta_type || (p_call->callee && p_call->callee->type == GDScriptParser::Node::IDENTIFIER)) && p_call->function_name == SNAME("new");
	if (get_function_signature(p_call, is_constructor, base_type, p_call->function_name, return_type, par_types, default_arg_count, method_flags)) {
		
		for (const KeyValue<int, GDScriptParser::ArrayNode *> &E : arrays) {
			int index = E.key;
			if (index < par_types.size() && par_types[index].has_container_element_type()) {
				update_array_literal_element_type(E.value, par_types[index].get_container_element_type());
			}
		}
		validate_call_arg(par_types, default_arg_count, method_flags.has_flag(METHOD_FLAG_VARARG), p_call);
		if (base_type.kind == GDScriptParser::DataType::ENUM && base_type.is_meta_type) {
			
			base_type.is_meta_type = false;
		}
		if (is_self && static_context && !method_flags.has_flag(METHOD_FLAG_STATIC)) {
			if (parser->current_function) {
				
				GDScriptParser::FunctionNode *parent_function = parser->current_function;
				while (parent_function->source_lambda) {
					parent_function = parent_function->source_lambda->parent_function;
				}
				push_error(vformat(R"*(Cannot call non-static function "%s()" from static function "%s()".)*", p_call->function_name, parent_function->identifier->name), p_call);
			} else {
				push_error(vformat(R"*(Cannot call non-static function "%s()" for static variable initializer.)*", p_call->function_name), p_call);
			}
		} else if (!is_self && base_type.is_meta_type && !method_flags.has_flag(METHOD_FLAG_STATIC)) {
			base_type.is_meta_type = false; 
			push_error(vformat(R"*(Cannot call non-static function "%s()" on the class "%s" directly. Make an instance instead.)*", p_call->function_name, base_type.to_string()), p_call);
		} else if (is_self && !method_flags.has_flag(METHOD_FLAG_STATIC)) {
			mark_lambda_use_self();