### Godot version

Godot 4 beta10

### System information

Windows 10 64 bits NVIDIA GeForce GTX 1060

### Issue description

In Godot 3 it was possible to type-hint a variable using constant preloaded script. But in Godot 4 it seems GDScript treats those variables as if they were variants with no known type, even though all the information is available.
Lines will not be highlighted as "safe", and attempting to use `:` to auto-hint variables assigned from properties or methods of the object will cause errors.

### Steps to reproduce

`body.gd`
```gdscript
extends RigidBody3D
```

`main.gd`
```gdscript
const MyBody = preload("./body.gd")

func _ready():
	var body := MyBody.new()
	print(body.name)

	# This causes an error
	#var pos := body.position

	body.freeze = true # This is supposed to be safe
	body.queue_free() # This is supposed to be safe
```

### Minimal reproduction project

[GDScriptSafeLineConstType.zip](https://github.com/godotengine/godot/files/10333076/GDScriptSafeLineConstType.zip)

check_class_member_name_conflict(p_class, member.signal->identifier->name, member.signal);
				member.signal->set_datatype(resolving_datatype);
				
				
				MethodInfo mi = MethodInfo(member.signal->identifier->name);
				for (int j = 0; j < member.signal->parameters.size(); j++) {
					GDScriptParser::ParameterNode *param = member.signal->parameters[j];
					GDScriptParser::DataType param_type = resolve_datatype(param->datatype_specifier);
					param_type.is_meta_type = false;
					param->set_datatype(param_type);
					mi.arguments.push_back(PropertyInfo(param_type.builtin_type, param->identifier->name));
					
				}
				member.signal->set_datatype(make_signal_type(mi));
				
				for (GDScriptParser::AnnotationNode *&E : member.signal->annotations) {
					E->apply(parser, member.signal);
				}
			} break;
			case GDScriptParser::ClassNode::Member::ENUM: {
				check_class_member_name_conflict(p_class, member.m_enum->identifier->name, member.m_enum);
				member.m_enum->set_datatype(resolving_datatype);
				GDScriptParser::DataType enum_type;
				enum_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
				enum_type.kind = GDScriptParser::DataType::ENUM;
				enum_type.builtin_type = Variant::DICTIONARY;
				enum_type.enum_type = member.m_enum->identifier->name;
				enum_type.native_type = p_class->fqcn + "." + member.m_enum->identifier->name;
				enum_type.is_meta_type = true;
				enum_type.is_constant = true;