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: Allow Strings and StringNames match each other in a match statement #78389

Merged
merged 1 commit into from Jun 19, 2023

Conversation

rune-scape
Copy link
Contributor

Strings and StringNames match each other in a match statement, dynamically and statically, to make StringName easier to use

var s = "abc"
var sn = &"abc"

match "abc":
   sn:
   	print("String matches StringName")
   _:
   	assert(false)

match &"abc":
   s:
   	print("StringName matches String")
   _:
   	assert(false)

@rune-scape rune-scape requested a review from a team as a code owner June 18, 2023 08:26
@Calinou Calinou added this to the 4.x milestone Jun 19, 2023
@adamscott adamscott modified the milestones: 4.x, 4.1 Jun 19, 2023
Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this PR for the 4.1 release. The GDScript team approved a part of #75170 (comment) (on April 14th), but asked @rune-scape to create a separate PR with the approved part (this PR). This should make it to this version.

@rune-scape added tests too, so I'm not worried.

@akien-mga akien-mga merged commit c211c22 into godotengine:master Jun 19, 2023
13 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov changed the title GDScript: Strings and StringNames match GDScript: Allow Strings and StringNames match each other in a match statement Jun 21, 2023
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.

None yet

4 participants