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

Map with abstract key complains about mismatched types #11694

Open
EliteMasterEric opened this issue Jun 16, 2024 · 1 comment
Open

Map with abstract key complains about mismatched types #11694

EliteMasterEric opened this issue Jun 16, 2024 · 1 comment

Comments

@EliteMasterEric
Copy link
Contributor

Expected behavior

Given that JobIdentifier is an abstract, I should be able to create the following map:

static var callbackHandlers:Map<JobIdentifier, String> = new Map();

Actual behavior

However, I receive this error:

[ERROR] Test.hx:3: characters 60-69

 3 |   static var callbackHandlers:Map<JobIdentifier, String> = new Map();
   |                                                            ^^^^^^^^^
   | error: JobIdentifier should be _Test.JobIdentifierImpl
   | have: (haxe.IMap<_Test.JobIdentifierImpl, ...>) -> ...
   | want: (haxe.IMap<JobIdentifier, ...>) -> ...

Using new Map<JobIdentifier, String>() displays the same error.

Minimal reproduction

https://try.haxe.org/#b85078ba

Use case

I am using haxe-concurrent, and I trying to make a map storing data for each of a set of tasks, identified by their JobIdentifier.

@kLabz
Copy link
Contributor

kLabz commented Jun 17, 2024

Workaround would be to add to JobIdentifierImpl to your abstract.

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