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

Getting invalid "Potential typo detected" warning #11219

Open
Geokureli opened this issue May 12, 2023 · 3 comments
Open

Getting invalid "Potential typo detected" warning #11219

Geokureli opened this issue May 12, 2023 · 3 comments
Labels

Comments

@Geokureli
Copy link

Geokureli commented May 12, 2023

Brought up in the discord. Was told by @kLabz to make an issue, as this warning persists, even on their branch that was intended to fix it

class Test {
  static var ID = 0;
  
  static function main() {
    switch(SortMethod.random()) {
      case XY | ID:
        //      ^^
        // Potential typo detected (expected similar values are SortMethod.ID)
    }
  }
}

enum abstract SortMethod(Int) {
  var XY = 0;
  var ID = 1;
  
  static public function random() {
    return Math.random() < 0.5 ? ID : XY;
  }
}
@kLabz kLabz self-assigned this May 13, 2023
@kLabz kLabz added feature-ide IDE / Editor support bug labels May 13, 2023
@kLabz kLabz removed their assignment May 16, 2023
@kLabz kLabz removed the feature-ide IDE / Editor support label May 16, 2023
@kLabz
Copy link
Contributor

kLabz commented May 16, 2023

Actually I'm not sure this could work.
Also tested it against module_resolution branch without success, I had (little) hope some changes about type inference there would have helped.

wdyt @Simn ?

@Simn
Copy link
Member

Simn commented May 30, 2023

I think we should remove this awkward static var matching in Haxe 5. That has always been a hack, and I don't even remember why we originally introduced it.

@Simn
Copy link
Member

Simn commented May 30, 2023

Actually that isn't the problem here, the typo detection code path is entered in too many cases. It should only be triggered if we outright fail to find the identifier in question.

Note that I think it's correct to resolve the static var ID here, as per our resolution order.

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

No branches or pull requests

3 participants