archives

« Bugzilla Issues Index

#296 — Coverage: Chapter 16 - Early error if PutValue will be called with non-Reference type


From the spec:
---
Attempts to call PutValue on any value for which an early determination can be made that the value is not a Reference (for example, executing the assignment statement 3=4).
---

Test262 needs more thorough tests for early errors in these situations, current engines vary widely in their behaviour:

`(print("he"),2) = 2`
Opera, IE10: print "he" and then throw ReferenceError
V8, JSC, SM: throw ReferenceError

`throw "NotEarlyError"; 2 = 2`
Opera, IE10, V8, JSC: throw the string "NotEarlyError"
SM: throws ReferenceError

`try { 2 = 2 } catch (e) { e instanceof ReferenceError }`
Opera, IE10, V8, JSC: return `true`
SM: throws uncatchable ReferenceError (when exec'ed in repl)


11.13.1-1-1, 11.13.1-1-2, 11.13.1-1-3 and 11.13.1-1-4 are of limited use for early error tests, because they execute the assignment only in an eval operation.


Tests are needed for assignment, compound assignment, pre- and post-order increment/decrement (these expressions call PutValue).