HaxeFoundation / HaxeFoundation/haxe
confusing error message for incompatible overriden interface property type
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
interface A {
var x(get,never):Int;
}
interface B extends A {
var x(get,never):String;
}
```
This will currently reports:
```
src/Main.hx:2: characters 2-23 : In method get_x required by property x
src/Main.hx:2: characters 2-23 : error: Int should be String
src/Main.hx:2: characters 2-23 : have: (...) -> Int
src/Main.hx:2: characters 2-23 : want: (...) -> String
```
I find this extremely confusing, because:
* the position of the error message is the base interface, not the overriden one
* it talks about `get_x` method and its function types, even though it's an implementation detail for interfaces
I think it should instead point to the position of the `B.x` type hint (`:String`), or at least to the whole field and just mention the incompatible property type.
Contributor guide
Assessment
This issue has not been assessed yet.