From c4ba7862604ea90cdbdeedc960ffb6d41a85c4f0 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 14:50:01 -0500 Subject: [PATCH 1/6] Tweak the body of PutValue Set() returns "a Completion Record normally containing a Boolean", so PutValue's 4.c Return ? Set(...) would cause PutValue to possibly return a Boolean, which doesn't appear to be what's wanted. (Every op that has "Return ? PutValue(...)" claims that its only normal return is ~unused~.) --- spec.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 8ddde28e02..0a8d16ce7c 100644 --- a/spec.html +++ b/spec.html @@ -4234,7 +4234,8 @@

1. If IsUnresolvableReference(_V_) is *true*, then 1. If _V_.[[Strict]] is *true*, throw a *ReferenceError* exception. 1. Let _globalObj_ be GetGlobalObject(). - 1. Return ? Set(_globalObj_, _V_.[[ReferencedName]], _W_, *false*). + 1. Perform ? Set(_globalObj_, _V_.[[ReferencedName]], _W_, *false*). + 1. Return ~unused~. 1. If IsPropertyReference(_V_) is *true*, then 1. [id="step-putvalue-toobject"] Let _baseObj_ be ? ToObject(_V_.[[Base]]). 1. If IsPrivateReference(_V_) is *true*, then From af9e0186a515c59d7d0fdbbff560df8f781e08a7 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 17:20:54 -0500 Subject: [PATCH 2/6] Simplify PropertyDefinitionEvaluation's return type As it stands, PDE returns "a Completion Record normally containing a Boolean", but this is incorrect... - the 2nd definition has `Return ? CopyDataProperties`, which will return an Object, - the 4th definition has `Return ~empty~`, and - the 5th definition has `Return ? MethodDefinitionEvaluation ...`, which might return a PrivateElement. However, rather than add these possibilities into the return type, we can actually simplify it. Note that the spec has 3 calls to PDE: - 2 are `Perform ? PDE of ...`, and - 1 is `Return ? PDE of ...`, but it's within the definition of PDE itself, which means that ultimately, nobody cares about PDE's normal return. So it might as well return ~unused~. --- spec.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec.html b/spec.html index 0a8d16ce7c..0bd1ee7b47 100644 --- a/spec.html +++ b/spec.html @@ -18300,21 +18300,21 @@

Runtime Semantics: Evaluation

Runtime Semantics: PropertyDefinitionEvaluation ( _object_: unknown, - ): a Completion Record normally containing a Boolean + ): a Completion Record normally containing ~unused~

PropertyDefinitionList : PropertyDefinitionList `,` PropertyDefinition 1. Perform ? PropertyDefinitionEvaluation of |PropertyDefinitionList| with argument _object_. - 1. Return ? PropertyDefinitionEvaluation of |PropertyDefinition| with argument _object_. + 1. Perform ? PropertyDefinitionEvaluation of |PropertyDefinition| with argument _object_. PropertyDefinition : `...` AssignmentExpression 1. Let _exprValue_ be the result of evaluating |AssignmentExpression|. 1. Let _fromValue_ be ? GetValue(_exprValue_). 1. Let _excludedNames_ be a new empty List. - 1. Return ? CopyDataProperties(_object_, _fromValue_, _excludedNames_). + 1. Perform ? CopyDataProperties(_object_, _fromValue_, _excludedNames_). PropertyDefinition : IdentifierReference @@ -18322,7 +18322,7 @@

1. Let _exprValue_ be the result of evaluating |IdentifierReference|. 1. Let _propValue_ be ? GetValue(_exprValue_). 1. Assert: _object_ is an ordinary, extensible object with no non-configurable properties. - 1. Return ! CreateDataPropertyOrThrow(_object_, _propName_, _propValue_). + 1. Perform ! CreateDataPropertyOrThrow(_object_, _propName_, _propValue_). PropertyDefinition : PropertyName `:` AssignmentExpression @@ -18341,14 +18341,14 @@

1. Let _propValue_ be ? GetValue(_exprValueRef_). 1. If _isProtoSetter_ is *true*, then 1. If Type(_propValue_) is either Object or Null, then - 1. Return ! _object_.[[SetPrototypeOf]](_propValue_). - 1. Return ~empty~. + 1. Perform ! _object_.[[SetPrototypeOf]](_propValue_). + 1. Return ~unused~. 1. Assert: _object_ is an ordinary, extensible object with no non-configurable properties. - 1. Return ! CreateDataPropertyOrThrow(_object_, _propKey_, _propValue_). + 1. Perform ! CreateDataPropertyOrThrow(_object_, _propKey_, _propValue_). PropertyDefinition : MethodDefinition - 1. Return ? MethodDefinitionEvaluation of |MethodDefinition| with arguments _object_ and *true*. + 1. Perform ? MethodDefinitionEvaluation of |MethodDefinition| with arguments _object_ and *true*. From d59d56a98b24ee6bc142c6ade07189a0bd3f719e Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 22:44:27 -0500 Subject: [PATCH 3/6] Cases where we can use a more specific type --- spec.html | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec.html b/spec.html index 0bd1ee7b47..c038370279 100644 --- a/spec.html +++ b/spec.html @@ -1789,7 +1789,7 @@

Number::bitwiseNOT ( _x_: a Number, - ): a Number + ): an integral Number

@@ -1985,7 +1985,7 @@

Number::leftShift ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2002,7 +2002,7 @@

Number::signedRightShift ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2019,7 +2019,7 @@

Number::unsignedRightShift ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2116,7 +2116,7 @@

_op_: `&`, `^`, or `|`, _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2137,7 +2137,7 @@

Number::bitwiseAND ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2151,7 +2151,7 @@

Number::bitwiseXOR ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -2165,7 +2165,7 @@

Number::bitwiseOR ( _x_: a Number, _y_: a Number, - ): a Number + ): an integral Number

@@ -6498,7 +6498,7 @@

_F_: a constructor, optional _argumentsList_: unknown, optional _newTarget_: a constructor, - ): a Completion Record normally containing an ECMAScript language value + ): a Completion Record normally containing an Object

description
@@ -10505,7 +10505,7 @@

HasSuperBinding ( ): *false*

-

WithBaseObject ( ): an ECMAScript language value

+

WithBaseObject ( ): an Object or *undefined*

for
an object Environment Record _envRec_
@@ -10675,7 +10675,7 @@

GetThisBinding ( ): a Completion Record normally containing an ECMAScript la -

GetSuperBase ( ): a Completion Record normally containing an ECMAScript language value

+

GetSuperBase ( ): a Completion Record normally containing an Object, *null*, or *undefined*

for
a function Environment Record _envRec_
@@ -11036,7 +11036,7 @@

WithBaseObject ( ): *undefined*

-

GetThisBinding ( ): a Completion Record normally containing an ECMAScript language value

+

GetThisBinding ( ): a Completion Record normally containing an Object

for
a global Environment Record _envRec_
@@ -11681,7 +11681,7 @@

SetDefaultGlobalBindings ( _realmRec_: unknown, - ): a Completion Record normally containing an ECMAScript language value + ): a Completion Record normally containing an Object

@@ -14021,7 +14021,7 @@

ArraySpeciesCreate ( _originalArray_: unknown, _length_: a non-negative integer, - ): a Completion Record normally containing an ECMAScript language value + ): a Completion Record normally containing an Object

description
@@ -27463,7 +27463,7 @@

_sourceText_: ECMAScript source text, _realm_: unknown, _hostDefined_: unknown, - ): a Source Text Module Record or a List of *SyntaxError* objects + ): a Source Text Module Record or a non-empty List of *SyntaxError* objects

description
@@ -36017,7 +36017,7 @@

RegExpBuiltinExec ( _R_: an initialized RegExp instance, _S_: a String, - ): a Completion Record normally containing an Object or *null* + ): a Completion Record normally containing an Array exotic object or *null*

From 79f4d96eb39e19a5a0de07ebaef45454a8e0e42f Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 22:47:22 -0500 Subject: [PATCH 4/6] Cases where we need to add another alternative to the return type --- spec.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec.html b/spec.html index c038370279..4d23f95c94 100644 --- a/spec.html +++ b/spec.html @@ -4360,7 +4360,7 @@

FromPropertyDescriptor ( _Desc_: a Property Descriptor or *undefined*, - ): an Object + ): an Object or *undefined*

@@ -17345,7 +17345,7 @@

Syntax

-

Static Semantics: TV ( ): a String

+

Static Semantics: TV ( ): a String or *undefined*

description
A template literal component is interpreted by TV as a value of the String type. TV is used to construct the indexed components of a template object (colloquially, the template values). In TV, escape sequences are replaced by the UTF-16 code unit(s) of the Unicode code point represented by the escape sequence.
@@ -20431,7 +20431,7 @@

_lval_: an ECMAScript language value, _opText_: `**`, `*`, `/`, `%`, `+`, `-`, `<<`, `>>`, `>>>`, `&`, `^`, or `|`, _rval_: an ECMAScript language value, - ): a Completion Record normally containing a BigInt or a Number + ): a Completion Record normally containing a String, a BigInt, or a Number

@@ -20497,7 +20497,7 @@

_leftOperand_: a Parse Node, _opText_: a sequence of Unicode code points, _rightOperand_: a Parse Node, - ): a Completion Record normally containing a BigInt or a Number + ): a Completion Record normally containing a String, a BigInt, or a Number

@@ -25706,7 +25706,7 @@

_sourceText_: ECMAScript source text, _realm_: unknown, _hostDefined_: unknown, - ): a Script Record + ): a Script Record or a non-empty List of *SyntaxError* objects

description
From e477f5db74cbe1f9c3a248cc5b5bb80d3b2f8988 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 23:09:50 -0500 Subject: [PATCH 5/6] Change 2x "a generator" to "a Generator" because there's already 3 return-types that are "a Generator". (It would be good to get clear direction on this from the rest of the spec, but it's inconsistent.) --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 4d23f95c94..469a665b3d 100644 --- a/spec.html +++ b/spec.html @@ -39712,7 +39712,7 @@

CreateMapIterator ( _map_: an ECMAScript language value, _kind_: ~key+value~, ~key~, or ~value~, - ): a Completion Record normally containing a generator + ): a Completion Record normally containing a Generator

description
@@ -40001,7 +40001,7 @@

CreateSetIterator ( _set_: an ECMAScript language value, _kind_: ~key+value~ or ~value~, - ): a Completion Record normally containing a generator + ): a Completion Record normally containing a Generator

description
From 5048fd4dfcfcec6eea3f0441ee52d38f3dba132e Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Feb 2022 23:13:27 -0500 Subject: [PATCH 6/6] misc other fixes --- spec.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index 469a665b3d..acd963312a 100644 --- a/spec.html +++ b/spec.html @@ -12160,7 +12160,7 @@

Agents

-

AgentSignifier ( ): an opaque value used to identify an Agent

+

AgentSignifier ( ): an agent signifier

@@ -13526,7 +13526,7 @@

_key_: a property key or Private Name, _closure_: a function object, _enumerable_: a Boolean, - ): a Private Name or ~unused~ + ): a PrivateElement or ~unused~

@@ -41526,7 +41526,7 @@

RemoveWaiters ( _WL_: a WaiterList, _c_: a non-negative integer or +∞, - ): a List of agents + ): a List of agent signifiers