You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
GDScript: Consolidate behavior for assigning enum types
This makes sure that assigning values to enum-typed variables are consistent. Same enum is always valid, different enum is always invalid (without casting) and assigning `int` creates a warning if there is no casting. There are new test cases to ensure this behavior doesn't break in the future.
This commit is contained in:
@@ -106,8 +106,7 @@ public:
|
||||
NATIVE,
|
||||
SCRIPT,
|
||||
CLASS, // GDScript.
|
||||
ENUM, // Full enumeration.
|
||||
ENUM_VALUE, // Value from enumeration.
|
||||
ENUM, // Enumeration.
|
||||
VARIANT, // Can be any type.
|
||||
UNRESOLVED,
|
||||
};
|
||||
@@ -185,8 +184,6 @@ public:
|
||||
return builtin_type == p_other.builtin_type;
|
||||
case NATIVE:
|
||||
case ENUM:
|
||||
return native_type == p_other.native_type;
|
||||
case ENUM_VALUE:
|
||||
return native_type == p_other.native_type && enum_type == p_other.enum_type;
|
||||
case SCRIPT:
|
||||
return script_type == p_other.script_type;
|
||||
|
||||
Reference in New Issue
Block a user