HaxeFoundation / HaxeFoundation/haxe
Mismatch on field/getter fails only on mac cpp
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
The following results in an error on my mac
```hx
class Test {
static function main() {
new Object().run();
}
}
class Object extends Derived
{
var top(get, default):Base;
function get_top():Derived // Note: not a Base
{
return this;
}
public function run()
{
trace(top);
}
}
class Base {}
class Derived extends Base { public function new () {} }
```
The error is
> Error: ./src/states/Test.cpp:107:86: error: conditional expression is ambiguous; 'ObjectPtr' can be converted to 'ObjectPtr' and vice versa
if (HX_FIELD_EQ(inName,"top") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_top() : top ); }
It almost seems like this shouldn't be allowed
Note: my actual test was a blank flixel project, built via `lime test mac -debug - clean`
Contributor guide
Research direction
Reproduce the blank project case with `lime test mac -debug - clean`, then inspect the generated `./src/states/Test.cpp` around line 107 and the field/getter handling that produces the conditional expression. Determine how the mismatched `Base` field type and `Derived` getter should be handled so the mac C++ build no longer fails with an ambiguous conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100