Erroneous "Unused import/using" when importing module types
Aidan63 opened this issue · comments
Aidan Lee commented
On nightlies if you have module Foo
containing
class Foo {
public static function foo() {}
}
class Bar {
public static function bar() {}
}
and another module imports a specific type and uses it
import Foo.Bar;
function main() {
Bar.bar();
}
You will receive an erroneous "Unused import/using" warning on that import. Changing the line to import the entire module import Foo
has it correctly detected as used. Importing specific module level functions do not suffer from this.
This works fine on 4.3.x so appears to be a regression.
Rudy Ges commented
Issue is that in this case, https://github.com/HaxeFoundation/haxe/blob/development/src/typing/typer.ml#L472 resolves with only the Bar
part of the import:
INFO src/Main.hx:1: characters 12-15
1 | import Foo.Bar;
| ^^^
Which doesn't mark the import as used.