HaxeFoundation / HaxeFoundation/haxe
Missing argument: 3 expected but 2 passed
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
I am using Map.
When the value is a String this line works only in JS target:
if(mymap["key"].indexOf("text")<0)
// do something
It throws a runtime error in HL target: Missing argument: 3 expected but 2 passed
To make it work in HL I have to go to the length of making sure the compiler knows it is a string:
var str:String = mymap["key"];
if(str.indexOf("text")<0)
// do something
Is it the expected behaviour? Would be nice if the code behaved the same war on both targets or threw error/warning during compilation and not crash at runtime like it does now.
Newest version of haxe.
Contributor guide
Research direction
Start by reducing the Map indexOf example and compare its behavior on the JS and HL targets. Trace the compiler or target entry points responsible for the differing argument handling, then add or run a regression test showing consistent behavior or a compile-time diagnostic instead of the runtime error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100