Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Maxim Mossienko
Subsystem
JavaScript
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Alexei Zhukov
    2 years ago (20 May 2009 19:24)
  • Updated by   root
    2 years ago (17 Jan 2010 21:15)
  • Jira: IDEADEV-37858
    (history, comments)
 
IDEA-48935 Invalid 'Simplify' in JS.
1
Issue is visible to: All Users
  The issue is visible to the selected user group only
Simplify inspection marks JavaScript expression in the following code
if (*var_name != false*) {
}

After simplifying the following code is produced:
if (var_name) {
}

This is incorrect.
Possible states of boolean variable:

State | (var_name != false) | (var_name) or (var_name == true)

true | true | true
false | false | false
undefined | true | false



Issue was resolved
Comments (1)
 
History
 
Linked Issues (?)
 
Eric Denman
  Eric Denman
16 Jun 2009 03:25
2 years ago
Seeing this on code like:

var checkers = $('checkbox' + foo);
var isCheckboxOn = (checkers && checkers.checked) ? true : false;

In this case, the intellij-recommended simplification doesn't work, and you end up with "isCheckbox" equal to "null" rather than "false"