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

GDScript: Improve type inference for arrays and dictionaries #83718

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Oct 21, 2023

See #83660 (comment).

Infer hard Variant for elements of untyped arrays and dictionary keys/values if they are of hard type.

TODO: Subscript resolution:

var hard_dict := {key = "value"}
var hard_array := ["elem"]

var a := hard_dict["key"] # INFERENCE_ON_VARIANT warning, not error.
var b := hard_dict.key # INFERENCE_ON_VARIANT warning, not error.
var c := hard_array[0] # INFERENCE_ON_VARIANT warning, not error.

@dalexeev dalexeev force-pushed the gds-improve-type-inference-for-arrays-and-dictionaries branch from bf0b6b7 to 368d5de Compare October 24, 2023 13:05
@dalexeev dalexeev modified the milestones: 4.3, 4.4 May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant