Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous "Unused import/using" when importing module types #11620

Closed
Aidan63 opened this issue Mar 29, 2024 · 1 comment · Fixed by #11732
Closed

Erroneous "Unused import/using" when importing module types #11620

Aidan63 opened this issue Mar 29, 2024 · 1 comment · Fixed by #11732
Milestone

Comments

@Aidan63
Copy link
Contributor

Aidan63 commented Mar 29, 2024

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.

@kLabz kLabz added this to the 5.0 preview 1 milestone Jul 21, 2024
@kLabz
Copy link
Contributor

kLabz commented Jul 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants