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

Incorrect automatic refactoring for boolean expressions #2837

Open
groz opened this issue Dec 1, 2016 · 0 comments
Open

Incorrect automatic refactoring for boolean expressions #2837

groz opened this issue Dec 1, 2016 · 0 comments

Comments

@groz
Copy link

groz commented Dec 1, 2016

  • Plugin version (or commit hash): 0.13.1914

  • IDE name and version:
    IntelliJ IDEA 2016.3
    Build #IU-163.7743.44, built on November 17, 2016

  • Java version:
    JRE: 1.8.0_112-release-408-b2 x86_64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

  • OS name and version:
    macOS Sierra
    Version: 10.12.1 (16B2555)

  • What are you trying to do?
    I have this code:

type My struct {
	x     *int
}

func (my *My) cmp(other *My) bool {
	return (my.x == nil && other.x != nil) ||
		(my.x != nil && other.x == nil)
}
  • What would you expect to happen?
    No refactoring tips or a simple tip to remove brackets.

  • What happens?
    Intellij proposes automatic refactoring to:

func (my *My) cmp(other *My) bool {
	return my.x != nil && other.x == nil
}

This suggestion also pops up for all other similar boolean cases.

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

No branches or pull requests

1 participant