### Godot version

4.2 (c5da2e54fe50cad34b5f93fa10538978b33af88d)

### System information

Windows 11

### Issue description

Attempting to run a scene with the following script report Identifier not found error:

![image](https://github.com/godotengine/godot/assets/3036176/3a63b930-0588-499d-80a2-4f88f5f07116)

This does not happen on 4.1.1 so this is a regression.

### Steps to reproduce

Create a script derived from Control and try to get access to the mouse_entered signal.

### Minimal reproduction project

[TestBug.zip](https://github.com/godotengine/godot/files/12237764/TestBug.zip)

err_line = -1;
	err_column = -1;
	error = "";
	parser = p_parser;
	main_script = p_script;
	const GDScriptParser::ClassNode *root = parser->get_tree();
	source = p_script->get_path();
	
	make_scripts(p_script, root, p_keep_state);
	main_script->_owner = nullptr;
	Error err = _populate_class_members(main_script, parser->get_tree(), p_keep_state);
	if (err) {
		return err;
	}
	err = _compile_class(main_script, root, p_keep_state);
	if (err) {
		return err;
	}
	if (has_static_data && !root->annotated_static_unload) {
		GDScriptCache::add_static_script(p_script);
	}
	return GDScriptCache::finish_compiling(main_script->path);
}
String GDScriptCompiler::get_error() const {