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

Godot 4 issues #11

Merged
merged 4 commits into from
Feb 28, 2023
Merged

Conversation

Bitphreak
Copy link
Contributor

@Bitphreak Bitphreak commented Feb 25, 2023

This PR fixes several issues with the new Godot 4 RC's

  1. @warning_ignore() is now expecting quoted warning names.
  2. Dictionary.keys() returns a generic Array as a Dictionary can have non-String keys, and not all keys in a given Dictionary need to be of the same type.

Issue 1 is resolved with this PR by quoting the warnings in all of @warning_ignore()

Issue 2 has two different resolutions due to different use cases.

addons/gdshell/scripts/gdshell_command_db.gd:get_all_command_names() returns an Array[String] as other commands might rely on this functionality it is best to maintain static typing for the Array. get_all_commands() now iterates over all keys and those which are of type string are added to a new Array[String] which is returned.

addons/gdshell/commands/default_commands/gdfetch.gd:construct_output uses the output from info.keys() directly and does not return it, which makes it safe to simply drop the static type from unused_info_keys and use it as a generic Array.

see: https://docs.godotengine.org/en/latest/classes/class_dictionary.html#class-dictionary-method-keys
see: https://www.reddit.com/r/godot/comments/10rqh9g/problem_with_typed_arrays_since_40_beta_17/

Bitphreak and others added 4 commits February 24, 2023 17:21
Dictionary keys can be any type not just String and dict.keys()
can not be upcast from return type of Array to Array[String].
As this function does not return the keys, it's safest and easiest
to just remove the String type from unused_info_keys and work with
the generics.
Dictionary keys can be any type not just String and dict.keys()
can not be upcast from return type of Array to Array[String].
As this function return the keys, it's best check each key and if
it is of type String add it to an Array[String] and return it
instead of info.keys()
@Kubulambula Kubulambula merged commit 5a9f7a2 into Kubulambula:main Feb 28, 2023
@Kubulambula
Copy link
Owner

Thanks! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants