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

Child classes cannot use parent classes' enums as a type #59684

Closed
PrecisionRender opened this issue Mar 30, 2022 · 3 comments
Closed

Child classes cannot use parent classes' enums as a type #59684

PrecisionRender opened this issue Mar 30, 2022 · 3 comments

Comments

@PrecisionRender
Copy link
Contributor

PrecisionRender commented Mar 30, 2022

Godot version

v3.4.1.stable.official [aa1b958], v4.0.alpha5.official [d7d528c]

System information

Windows 11, Vulkan, Nvidia GeForce RTX 2060 Max-Q

Issue description

When creating an enum in a parent class, a child class cannot use the enum as a type. This makes overriding methods that take the enum as a parameter impossible, unless the parameter is set up without a type. I'm not sure if this is desired behavior or not, but it seems like an issue. Note that this happens in the 4.x branch as well as the 3.x branch.

Steps to reproduce

  1. Create a class in GDScript with a new script
  2. Extend that class with a new script
  3. Create an enum in the parent class
  4. Try to set a variable's type to the enum

Minimal reproduction project

EnumTest.zip

@rburing
Copy link
Member

rburing commented May 5, 2022

It is currently possible to use an enum from a parent class if you use more verbose syntax. In the test project, instead of

extends Directions
var directions: PossibleDirections

you can write

extends Directions
var directions: Directions.PossibleDirections

and it works.

@vnen would it be difficult to support the more concise syntax?

@DaGamingWolf
Copy link

perhaps, but i don't experience the issue as described. you can indeed use the enum of a parent class as a type. the problem only occurs when it's the parents' parent class(or higher on the inheritance tree) specifically.

@dalexeev
Copy link
Member

dalexeev commented Jul 3, 2023

The bug is not reproducible in 4.0.3 and master. Probably fixed by #69590. In 3.x, enums as types are not supported at all.

@akien-mga akien-mga added this to the 4.0 milestone Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants