Last Comment Bug 391350 - Incorrect type inference for array and object literals
: Incorrect type inference for array and object literals
Status: RESOLVED FIXED
:
Product: Rhino
Classification: Components
Component: Compiler (show other bugs)
: 1.6R6
: x86 Linux
: -- normal (vote)
: ---
Assigned To: Norris Boyd
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-08 05:31 PDT by Norris Boyd
Modified: 2007-08-08 05:38 PDT (History)
0 users
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Proposed patch (1.14 KB, patch)
2007-08-08 05:31 PDT, Norris Boyd
no flags Details | Diff | Review

Description Norris Boyd 2007-08-08 05:31:44 PDT
Created attachment 275765 [details] [diff] [review]
Proposed patch

The program

function f() {
  var x = {a:1,b:2};
  return x.a;
}
print(f());

will print "undefined" for optimization level 1 instead of 1 due to the optimizer incorrectly assuming the object literal in the tree is an operator with two number type operands that must thus produce a number.
Comment 1 Norris Boyd 2007-08-08 05:38:43 PDT
Fixed:

Checking in src/org/mozilla/javascript/optimizer/Block.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Block.java,v  <--  Block.java
new revision: 1.37.4.1; previous revision: 1.37
done

Note You need to log in before you can comment on or make changes to this bug.