Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete incorrectly infers Autoload property types for custom class types #72990

Closed
Haydoggo opened this issue Feb 9, 2023 · 3 comments
Closed

Comments

@Haydoggo
Copy link
Contributor

Haydoggo commented Feb 9, 2023

Godot version

v4.0.rc1.official [8843d9a]

System information

Windows 10

Issue description

When referencing an Autoload's property, if that property is a custom class, autocomplete will incorrectly infer the type of that property as Object.

In Godot 3.5.1, this issue is not present and autocomplete acts as expected.

Steps to reproduce

Given the following 3 scripts:

# custom_class.gd
class_name CustomClass extends Node

var mesh : Mesh

↓ Add this one to Autoloads in project settings

# autoload.gd
extends Node

var mesh : Mesh
var custom_class : CustomClass
# main.gd
extends Node

func _ready():
	CustomClass.new().mesh # autocomplete works as expected
	Autoload.mesh # autocomplete works as expected
	Autoload.custom_class.mesh # autocomplete acts as though custom_class were of type Object

(At this point I restart the editor because there seem to be some issues with autocomplete and fresh autoloads/custom classes anyway)

In the final line of main.gd, after typing Autoload.custom_class., autocomplete suggests only members of Object (eg. free(), add_user_signal(), etc.), and does not suggest any members of CustomClass nor of its base type Node

Minimal reproduction project

AutoCompleteBug.zip

@Haydoggo Haydoggo changed the title Autocomplete incorrectly infers Autoload property types custom class types Autocomplete incorrectly infers Autoload property types for custom class types Feb 11, 2023
@clayjohn clayjohn added this to the 4.x milestone Feb 28, 2023
@DragonAxe
Copy link

I can confirm this still happens with Godot v4.0.stable.official [92bee43] on linux.

@thunderingmarmot
Copy link

This is also similar to a problem I have where an autoload singleton has some onready vars to reference its children and, when I access them outside of the singleton using its global variable, Godot only autocompletes their base class methods and not the ones I wrote in the child script, even if everything is statically typed.

@Calinou
Copy link
Member

Calinou commented Apr 1, 2023

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
@Calinou Calinou removed this from the 4.x milestone Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants