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

Enum values can't be used as match patterns #10571

Closed
mrcdk opened this issue Aug 22, 2017 · 1 comment · Fixed by #10542
Closed

Enum values can't be used as match patterns #10571

mrcdk opened this issue Aug 22, 2017 · 1 comment · Fixed by #10542

Comments

@mrcdk
Copy link
Contributor

mrcdk commented Aug 22, 2017

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 10. Godot 3.0alpha1

Issue description:

Enum values can't be used as match patterns. The error is: Parse Error: Only constant expressions or variables allowed in a pattern

The match documentation says that it should be possible under the variable pattern: matches the contents of a variable/enum

Steps to reproduce:

extends Node

enum Action { Up, Down }
var current_action = Action.Up

func something():
	match current_action:
		Action.Up: # Error here
			pass
		_:
			pass
@akien-mga akien-mga added this to the 3.0 milestone Aug 23, 2017
@akien-mga
Copy link
Member

There's actually a PR already to fix that :) #10542

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

Successfully merging a pull request may close this issue.

2 participants