### Godot version

4.0.2

### System information

Ubuntu 22.04.1 LTS

### Issue description

So far I've found these ones:

![Screenshot from 2023-05-10 17-56-42](https://github.com/godotengine/godot/assets/85438892/b161b14a-cb7d-46fe-8398-816bf354a929)
![Screenshot from 2023-05-10 18-01-02](https://github.com/godotengine/godot/assets/85438892/b0fefcfb-4246-4ebb-ae7b-dd798d7a1d63)

But there are likely more like them. They are invalid, at least in the context I encountered them here (at the beginning of a regular line of script)

### Steps to reproduce

Type `Anchor` in the code editor.

### Minimal reproduction project

N/A
if (!is_function) {
				
				if (ProjectSettings::get_singleton()->has_autoload(p_symbol)) {
					const ProjectSettings::AutoloadInfo &autoload = ProjectSettings::get_singleton()->get_autoload(p_symbol);
					if (autoload.is_singleton) {
						String scr_path = autoload.path;
						if (!scr_path.ends_with(".gd")) {
							
							
							scr_path = scr_path.get_basename() + ".gd";
						}
						if (FileAccess::exists(scr_path)) {
							r_result.type = ScriptLanguage::LOOKUP_RESULT_SCRIPT_LOCATION;
							r_result.location = 0;
							r_result.script = ResourceLoader::load(scr_path);
							return OK;
						}
					}
				}
				
				HashMap<StringName, int> classes = GDScriptLanguage::get_singleton()->get_global_map();
				if (classes.has(p_symbol)) {
					Variant value = GDScriptLanguage::get_singleton()->get_global_array()[classes[p_symbol]];
					if (value.get_type() == Variant::OBJECT) {
						Object *obj = value;
						if (obj) {
							if (Object::cast_to<GDScriptNativeClass>(obj)) {
								r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS;
								r_result.class_name = Object::cast_to<GDScriptNativeClass>(obj)->get_name();
							} else {