### Godot version

4.0.1

### System information

Windows 11, Vulkan, ryzen 9 5900X, rx 6700xt

### Issue description

When creating a typed array
(take `var wheels: Array[VehicleWheel3D]` as an example)

and then trying to add a node to the array by referencing it with `$`
(for example `var wheels: Array[VehicleWheel3D] = [$BackLeftWheel]`)

it will return the following error:
_Cannot have an element of type "Node" in an array of type "Array[VehicleWheel3D]"_

I have a theory that this is due to `$MyNode` being the same as `get_node("MyNode")` for the parser and `get_node()` has a return type of `Node`, so the parser thinks that you are trying to append a `Node` to the array (Haven't checked that in the source code, it's just a theory). 

![image](https://user-images.githubusercontent.com/111653551/227974121-e0be38bc-8c99-47f1-adf6-775083805cff.png)

This can be worked around by casting the node as the intended type
(`var wheels: Array[VehicleWheel3D] = [$BackLeftWheel as VehicleWheel3D]`)

### Steps to reproduce

See "Issue description" and "Minimal reproduction project"

### Minimal reproduction project


[Typed Array issue rep project.zip](https://github.com/godotengine/godot/files/11080146/Typed.Array.issue.rep.project.zip)

for (int i = 0; i < p_match_branch->patterns.size(); i++) {
		resolve_match_pattern(p_match_branch->patterns[i], p_match_test);
	}
	resolve_suite(p_match_branch->block);
	decide_suite_type(p_match_branch, p_match_branch->block);
}
void GDScriptAnalyzer::resolve_match_pattern(GDScriptParser::PatternNode *p_match_pattern, GDScriptParser::ExpressionNode *p_match_test) {
	if (p_match_pattern == nullptr) {
		return;
	}
	GDScriptParser::DataType result;
	switch (p_match_pattern->pattern_type) {
		case GDScriptParser::PatternNode::PT_LITERAL:
			if (p_match_pattern->literal) {
				reduce_literal(p_match_pattern->literal);
				result = p_match_pattern->literal->get_datatype();
			}
			break;
		case GDScriptParser::PatternNode::PT_EXPRESSION:
			if (p_match_pattern->expression) {
				GDScriptParser::ExpressionNode *expr = p_match_pattern->expression;
				reduce_expression(expr);
				result = expr->get_datatype();
				if (!expr->is_constant) {
					while (expr && expr->type == GDScriptParser::Node::SUBSCRIPT) {
						GDScriptParser::SubscriptNode *sub = static_cast<GDScriptParser::SubscriptNode *>(expr);
						if (!sub->is_attribute) {
							expr = nullptr;
						} else {