Found nothing like my issue with : _is:issue "match" in:title label:bug state:open_ searching's filter.
Godot version:
Godot Engine v3.2.3.stable.official
OS/device including version:
Ubuntu 20.04
GPU : Nvidia GeForce GTX 970
GPU driver : nvidia driver 450 (libre)
Proc : AMD® Ryzen 9 3900x
Issue description:
Match is supposed to match with the first option... but don't.

Steps to reproduce:
Don't know too much.
Made a variable match with a enum's const.
Minimal reproduction project:
issue_minimal_project.zip
I can reproduce this on Godot 3.2.3.
That said, the first time I launched the project, I had a different output when clicking the Artistes/Albums button (it toggled between both states).
It works if you add an int type hint to your var declaration:
var searching_mode: int = searching_by.ARTIST
The variable's type can't be inferred for some reason…
I have the same bug at different location on my script, and it's the same. Thanks for your tips, it works !
What's crazy is that there is a part of my code that worked perfectly fine... Then just broke...
@karroffel implemented this, so he might be able to help. 🙂
@ShalokShalom karroffel no longer contributes to Godot core, so I'm afraid he can't help much here.
I just tested this on the current master and could not reproduce it. So at least it seems to have been fixed during the GDScript rewrite for 4.0.
That's good to hear ! Just have to wait for 4.0..... JUST ! ^^
JSON parse 0 as 0.0 float and you can't match float 0.0 with int 0 (not sure if it's a bug CC @vnen ) but the bug here is if a float value is a whole number it just prints the integer and ignore the decimal point which is harder for someone to debug.
var value = JSON.parse('0').result ## <-- a float value not integer
func _ready():
print(value) ## <-- prints 0 not 0.0
match value:
0:
print('0')
1:
print('1')
0.0:
print('0.0') ## <-- matches here
_:
print('default')
@ThakeeNathees GDScript is a strongly-typed language, so 0 not being equal to 0.0 is a design decision, not a bug.
Then, why do the if condition work, but match doesn't ?
== works on int and float arguments mostly for convenience. But match is type-strict all the time, since some comparisons would be invalid (if you try to use == with incompatible types you get an error).
So this isn't really a bug, you should cast for the type you expect it to be.
Now I wonder if I broke something on 4.0 or if the test was made with something different, because it should still only match if the type is the same.
@vnen my testing mentioned above didn't go through the json parser, my bad. it seems that it's still type-strict in 4.0
BTW, I think that matching a pattern with a literal, variable or constant should use the same mechanism and provide exactly the same convenience that the equality test == in that language provides. The reason: to avoid exactly the misunderstanding that led to this issue report.
It is also in line with other languages that support some duck-typing, AFAIK. E.g. case in Ruby (I think) and the pattern matching statement proposed for python https://www.python.org/dev/peps/pep-0622/#patterns
But I guess, this change would have to go into a new proposal.
Most helpful comment
I can reproduce this on Godot 3.2.3.
That said, the first time I launched the project, I had a different output when clicking the Artistes/Albums button (it toggled between both states).
It works if you add an
inttype hint to yourvardeclaration:The variable's type can't be inferred for some reason…