### Godot version

Beta 17, master

### System information

Windows 11

### Issue description

Godot gets a hard crash while attempting to code-complete for member `const` of a class.

### Steps to reproduce

```GDScript
enum E { V1 }

const e := E
```

And then type a `.` after the last `E`, which triggers code hints/auto-completion for subscripts based on `E` and causes a hard crash.

Does not happen for `var e := E.V1`.

### Minimal reproduction project

See above.
}
	if (p_type->get_datatype().is_resolving()) {
		push_error(R"(Could not resolve datatype: Cyclic reference.)", p_type);
		return bad_type;
	}
	if (!p_type->get_datatype().has_no_type()) {
		return p_type->get_datatype();
	}
	GDScriptParser::DataType resolving_datatype;
	resolving_datatype.kind = GDScriptParser::DataType::RESOLVING;
	p_type->set_datatype(resolving_datatype);
	GDScriptParser::DataType result;
	result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
	result.builtin_type = Variant::OBJECT;
	if (p_type->type_chain.is_empty()) {
		
		result.kind = GDScriptParser::DataType::BUILTIN;
		result.builtin_type = Variant::NIL;
		p_type->set_datatype(result);
		return result;
	}
	StringName first = p_type->type_chain[0]->name;
	if (first == SNAME("Variant")) {
		if (p_type->type_chain.size() > 1) {
			
			push_error(R"(Variant doesn't contain nested types.)", p_type->type_chain[1]);
			return bad_type;
		}
		result.kind = GDScriptParser::DataType::VARIANT;
	} else if (first == SNAME("Object")) {