### Godot version

v4.0.beta17.official [c40020513]

### System information

Apple M1 Max - macOS Ventura 13.1 (22C65)

### Issue description

I am getting an error due to functions no longer returning the correct typed array, when the function concatenates arrays and returns it.

In other words, the following fails:

```
func add_arrays() -> Array[ClassA]:
	var array_1: Array[ClassA] = []
	var array_2: Array[ClassA] = []
	return array_1 + array_2
```

<img width="864" alt="Screenshot 2023-02-02 at 1 02 53 PM" src="https://user-images.githubusercontent.com/905216/216320503-475bf4a1-353e-455c-87d5-69d036db706c.png">

I'm assuming when concatenating, the typing changes to a generic `Array` now? Just a guess. 

### Steps to reproduce

N/A

### Minimal reproduction project

[Godot Crash Project.zip](https://github.com/godotengine/godot/files/10568780/Godot.Crash.Project.zip)

Ref<GDScript> res = GDScriptCache::get_shallow_script(p_preload->resolved_path, err, parser->script_path);
				p_preload->resource = res;
				if (err != OK) {
					push_error(vformat(R"(Could not preload resource script "%s".)", p_preload->resolved_path), p_preload->path);
				}
			} else if (ResourceLoader::get_resource_type(p_preload->resolved_path) == "PackedScene") {
				Error err = OK;
				Ref<PackedScene> res = GDScriptCache::get_packed_scene(p_preload->resolved_path, err, parser->script_path);
				p_preload->resource = res;
				if (err != OK) {
					push_error(vformat(R"(Could not preload resource scene "%s".)", p_preload->resolved_path), p_preload->path);
				}
			} else {
				p_preload->resource = ResourceLoader::load(p_preload->resolved_path);
				if (p_preload->resource.is_null()) {
					push_error(vformat(R"(Could not preload resource file "%s".)", p_preload->resolved_path), p_preload->path);
				}
			}
		}
	}
	p_preload->is_constant = true;
	p_preload->reduced_value = p_preload->resource;
	p_preload->set_datatype(type_from_variant(p_preload->reduced_value, p_preload));
}
void GDScriptAnalyzer::reduce_self(GDScriptParser::SelfNode *p_self) {
	p_self->is_constant = false;
	p_self->set_datatype(type_from_metatype(parser->current_class->get_datatype()));
	mark_lambda_use_self();
}
void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscript, bool p_can_be_pseudo_type) {