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

if with instanceof pattern match and && breaks completion in nested if #1855

Closed
mfussenegger opened this issue Aug 24, 2021 · 4 comments · Fixed by #1945
Closed

if with instanceof pattern match and && breaks completion in nested if #1855

mfussenegger opened this issue Aug 24, 2021 · 4 comments · Fixed by #1945

Comments

@mfussenegger
Copy link
Contributor

Using eclipse.jdt.ls from master (63713d5) and Java 16.0.1 the following code snippet breaks completion in the inner if branch:

public class App {

    static class Symbol {
    }

    static class Ref extends Symbol {


       String name() {
          return "foo";
       }
    }

    static class Literal extends Symbol {
    }

    public void test(Symbol x, Symbol y) {
        if (x instanceof Ref ref && y instanceof Literal lit) {
          // ref.| completion works here, showing expected options
          if (ref.name() == "foo") {
            // ref.| completion doesn't work here - only shows `class` as an option
          }
        }
    }
}

As soon as the && y instanceof .. part is removed the completion starts to work

I suspect this is an upstream jdt bug

@fbricon
Copy link
Contributor

fbricon commented Aug 24, 2021

Yup, same issue in Eclipse IDE. Can you open a ticket in https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT?

@mfussenegger
Copy link
Contributor Author

@fbricon
Copy link
Contributor

fbricon commented Aug 24, 2021

thanks

fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Nov 17, 2021
Fixes eclipse-jdtls#1855

Signed-off-by: Fred Bricon <fbricon@gmail.com>
@fbricon fbricon added this to the Mid November milestone Nov 17, 2021
rgrunber pushed a commit that referenced this issue Nov 17, 2021
Fixes #1855

Signed-off-by: Fred Bricon <fbricon@gmail.com>
@rgrunber
Copy link
Contributor

Thanks for filing upstream. Should be fixed in the next release.

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

Successfully merging a pull request may close this issue.

3 participants