Skip to content

Commit 15aa452

Browse files
committed
Mark instanceof as left-associative
May not have been originally intended this way, but it's how the language works right now, so specify it as such (#226).
1 parent 63d72a6 commit 15aa452

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

spec/10-expressions.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ instanceof-expression:
19351935
instanceof-subject 'instanceof' class-type-designator
19361936
19371937
instanceof-subject:
1938-
unary-expression
1938+
instanceof-expression
19391939
-->
19401940

19411941
<pre>
@@ -1944,17 +1944,13 @@ instanceof-subject:
19441944
<i><a href="#grammar-instanceof-subject">instanceof-subject</a></i> instanceof <i><a href="#grammar-class-type-designator">class-type-designator</a></i>
19451945

19461946
<i id="grammar-instanceof-subject">instanceof-subject:</i>
1947-
<i><a href="#grammar-unary-expression">unary-expression</a></i>
1947+
<i><a href="#grammar-instanceof-expression">instanceof-expression</a></i>
19481948
</pre>
19491949

1950-
**Constraints**
1951-
1952-
The *unary-expression* in *instanceof-subject* must not be any form of literal.
1953-
19541950
**Semantics**
19551951

19561952
Operator `instanceof` returns `TRUE` if the value designated by
1957-
*unary-expression* in *instanceof-subject* is an object having the type specified
1953+
*instanceof-subject* is an object having the type specified
19581954
by *class-type-designator*, is an object whose type is derived from that type,
19591955
or is an object whose type implements the interface specified by *class-type-designator*.
19601956
Otherwise, it returns `FALSE`.

spec/19-grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ The grammar notation is described in [Grammars section](09-lexical-structure.md#
563563
<i><a href="#grammar-instanceof-subject">instanceof-subject</a></i> instanceof <i><a href="#grammar-class-type-designator">class-type-designator</a></i>
564564

565565
<i id="grammar-instanceof-subject">instanceof-subject:</i>
566-
<i><a href="#grammar-unary-expression">unary-expression</a></i>
566+
<i><a href="#grammar-instanceof-expression">instanceof-expression</a></i>
567567

568568
<i id="grammar-logical-NOT-expression">logical-NOT-expression:</i>
569569
<i><a href="#grammar-instanceof-expression">instanceof-expression</a></i>

0 commit comments

Comments
 (0)