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

[bug]: Incorrect diff produced for if expression #57

Closed
swayamraina opened this issue Jun 16, 2020 · 3 comments
Closed

[bug]: Incorrect diff produced for if expression #57

swayamraina opened this issue Jun 16, 2020 · 3 comments
Labels
legacy-java Issues/PR related to older PiranhaJava implementation

Comments

@swayamraina
Copy link
Contributor

was working on #35 but it seems there is an issue in the current master branch where expressions are not correctly handled in if statements

to reproduce simply change the implementation in sample app (MyClass.bak)

  public void bar(boolean base) {
    if (base && expt.flagDisabled(TestExperimentName.SAMPLE_STALE_FLAG)) {
      System.out.println("Hi World");
    }
  }

The output diff is,

  public void bar(boolean y) {

  }
@mkr-plse mkr-plse added invalid legacy-java Issues/PR related to older PiranhaJava implementation labels Jun 16, 2020
@mkr-plse
Copy link
Contributor

See the configuration option here. Since the conditionalExpression evaluates to false, the output is indeed correct.

Please re-open if you see this behavior when the configuration option is changed.

@swayamraina
Copy link
Contributor Author

Shouldn't the diff file be,

  public void bar(boolean base) {
    if (base) {
      System.out.println("Hi World");
    }
  }

as the boolean base is a base check and the feature is checked only after the base passes.

@mkr-plse
Copy link
Contributor

Independent of base, expt.flagDisabled(TestExperimentName.SAMPLE_STALE_FLAG) will return false when flag is treated. So, the entire conditional expression evaluates to false.
Try this example when treated is changed to control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-java Issues/PR related to older PiranhaJava implementation
Projects
None yet
Development

No branches or pull requests

2 participants