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

Resources with typed arrays of resources show up as the path to the resource instead of the class name in editor causing an error that the type does not match. #95851

Open
ryanbbernstein opened this issue Aug 20, 2024 · 2 comments

Comments

@ryanbbernstein
Copy link

Tested versions

  • Reproducible in 4.3 but was not present in 4.2

System information

Mac OS Sonoma M1

Issue description

Resources with typed arrays of resources show up as the path to the resource instead of the class name in editor causing an error that the type does not match. Removing the typing in script logic accessing the array fixes the error and the script runs correctly.

Resource contains:

@export var resources: Array[test_res]

Accessing it like so:

const CONTAINER: container_res = preload("res://container.tres")
...
for resource: test_res in CONTAINER.resources:

Produces:
Parse Error: Unable to iterate on value of type "Array[res://test_res.gd]" with variable of type "test_res".

I believe this is related to the following changes: #78219 #90751 #85024

Steps to reproduce

Create resource that contains an array of custom resources. Attempt to iterate or access values from the array as the custom resource class type.

Minimal reproduction project (MRP)

Minimum example files
testgd.zip

@matheusmdx
Copy link
Contributor

This looks like a duplicate of #95568

@ryanbbernstein
Copy link
Author

ryanbbernstein commented Aug 20, 2024

Yep, looks like it. I searched through the existing issues before posting and couldn't find anything related. Probably because the title doesn't include the word resource. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: For team assessment
Development

No branches or pull requests

3 participants