haxe
haxe copied to clipboard
duplicate field access errors in some cases
class A {
static var A:Int;
}
class Main {
static function main() {
A.A;
}
}
gives
src/Main.hx:7: characters 5-6 : Cannot access private field A
src/Main.hx:7: characters 5-6 : Cannot access private field A
That's the case even in haxe 3.4.7, but it now also happens for lowercase fields, since the merge of module-statics and it's the reason for the current CI failures.
I believe the issue is caused by the fact that field access is done twice, because we do it extra time to get a Not_found error when resolving dot path:
https://github.com/HaxeFoundation/haxe/blob/01cfe550b9da7b50c1face9285e4612073653ae8/src/typing/typerDotPath.ml#L102
It's a bit tricky to fix and will likely require refactoring TyperDotPath somehow again...
I just tried this and only get the error message once. Could you check again?
I hacked it around in a very ugly way, see linked commit above ;)