HaxeFoundation / HaxeFoundation/hxcpp

Std.isOfType Enum and Class

Open
#1,391 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

If you check whether a class or enum is a `Class` or `Enum` using `Std.isOfType`, both return `true`.

For example:

```haxe
package;

class Main
{
static function main():Void
{
trace(Std.isOfType(Example, Class), Std.isOfType(Example, Enum));
}
}

class Example
{
public var message:String;
public function new(message:String) this.message = message;
public function toString() return this.message;
}
```

`Example` is clearly not an enum, yet the output is `true,true`.

This only happens on the C++ target. I tried Eval, Neko, PHP, and JavaScript, but this doesn't happen on any of those targets.

Is there a workaround I can use?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by compiling and running the provided Main/Example program on the C++ target, then inspect hxcpp's runtime implementation of Std.isOfType and compare the result with Eval, Neko, PHP, and JavaScript. Done means the C++ target no longer reports Example as both Class and Enum.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.