diff --git a/working/3616 - enum value shorthand/proposal-simple-lrhn.md b/working/3616 - enum value shorthand/proposal-simple-lrhn.md index 9074a1d4bc..5f4b2baa71 100644 --- a/working/3616 - enum value shorthand/proposal-simple-lrhn.md +++ b/working/3616 - enum value shorthand/proposal-simple-lrhn.md @@ -37,7 +37,7 @@ We introduce grammar productions of the form: ::= ... -- all current productions | -- No selectors, no `.new`. - ::= + ::= * ::= @@ -91,7 +91,7 @@ Future futures = .wait([lazyString(), lazyString()]).then((list) => list This is a simple grammatical change. It allows new constructs in any place where we currently allow primary expressions followed by selector chains through the `` production ` *`, -and now also ` `. +and now also ` *`. The new grammar is added as a separate production, rather than making `` a ``, and sharing the `*` @@ -163,7 +163,7 @@ First, when inferring types for a `` of the form `` with context type scheme *C*, then assign *C* as the shorthand context of the leading ``. Then continue inferring a type for the entire `` -recursively on the chain of selectors of the ``, +recursively on the chain of selectors of the `*`, in the same way as for a ` *`. _This assigns the context type scheme of the entire, maximal selector chain to the static member shorthand head, moving it past any intermediate ``s._ @@ -265,10 +265,10 @@ this expression may have an actual context type. If it was followed by "real" se like `.parse(input).abs()`, then the recognized expression, `.parse(input)` in this example, likely has no context type._ -Expressions of the forms .new\<*typeArgs*\> or +Expressions of the forms .new\<*typeArgs*\>(*args*) or .new\<*typeArgs*\> (as a prefix of a ` *` production, or the entire chain) are compile-time errors, just like -the corresponding *T*.new\<*typeArgs*\> +the corresponding *T*.new\<*typeArgs*\>(*args*) and *T*.new\<*typeArgs*\> already are, whether used as instantiated tear-off or invoked. _(The grammar allows them, because `C.new` is a `` expression, but @@ -317,10 +317,11 @@ For `==`, we special-case when the right operand is (precisely!) a static member shorthand. If an expression has the form `e1 == e2` or `e1 != e2`, or a pattern has the -form `== e2`, where the static type of `e1`, or the matched value type of the -pattern, is *S1*, and *e2* is precisely a `` expression, -then assign the type *S1* as the shorthand context of the `` -of *e2* before inferring its static type the same way as above. +form `== e2` or `!= e2`, where the static type of `e1`, or the matched value +type of the pattern, is *S1*, and *e2* is precisely a `` +expression, then assign the type *S1* as the shorthand context of the +`` of *e2* before inferring its static type the same +way as above. This special-casing is only against an immediate static member shorthand. It does not change the *context type* of the second operand, so it would not @@ -386,13 +387,12 @@ a static declaration or constructor declaration *S* when looked up on *D*. * An expression of the form `.` is a constant expression if *S* declares a constant getter. * An expression of the form `.` that is not followed by an - ``, is a constant expression if `*S* declares + ``, is a constant expression if *S* declares a static method or constructor, and either type inference has not added type arguments as a generic function instantiation coercion, or the added type arguments are constant types. _Static tear-offs are constant. Instantiated static tear-offs are constant if the inferred type arguments are._ - that is not a constant expression.)_ * An expression of the form `.new` which is not followed by the selectors of an ``, is a constant expression if *S* declares a constant (unnamed) constructor, and either type