-
Type:
Sub-task
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 8
-
Component/s: core-libs
-
None
-
b100
-
generic
-
generic
-
Verified
void operator should always evaluate to undefined.
See ECMA 11.4.2 The void Operator
jjs> void +this
>> NaN
>> => undefined instead of NaN
jjs> (function f(){return void +(void 0)})()
>> NaN
>> => undefined instead of NaN
jjs> void function(){}
>> Exception in thread "main" java.lang.AssertionError
>> at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276)
>> at jdk.nashorn.internal.codegen.Attr.enterBlock(Attr.java:297)
>> ...
See ECMA 11.4.2 The void Operator
jjs> void +this
>> NaN
>> => undefined instead of NaN
jjs> (function f(){return void +(void 0)})()
>> NaN
>> => undefined instead of NaN
jjs> void function(){}
>> Exception in thread "main" java.lang.AssertionError
>> at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276)
>> at jdk.nashorn.internal.codegen.Attr.enterBlock(Attr.java:297)
>> ...