From 6f451d85a41bc1e59a492993bbd4e11e82bd394c Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Mon, 13 Jan 2025 10:15:03 +0200 Subject: [PATCH 1/2] Fix some typos in Static shorthand proposal --- .../proposal-simple-lrhn.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/working/3616 - enum value shorthand/proposal-simple-lrhn.md b/working/3616 - enum value shorthand/proposal-simple-lrhn.md index a19e7449c1..442ffcc8dd 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._ @@ -266,11 +266,11 @@ 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 -.new\<*typeArgs*\> (as a prefix of a ` *` +.new\<*typeArgs*\>(*args*) (as a prefix of a ` *` production, or the entire chain) are compile-time errors, just like the corresponding *T*.new\<*typeArgs*\> -and *T*.new\<*typeArgs*\> already are, whether used as instantiated -tear-off or invoked. +and *T*.new\<*typeArgs*\>(*args*) already are, whether used as +instantiated tear-off or invoked. _(The grammar allows them, because `C.new` is a `` expression, but a `C.new`, or a `C.id` denoting a constructor, followed by type arguments is recognized and made an error to avoid it being interpreted as `(C.new)`.)_ @@ -317,7 +317,7 @@ 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 +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. @@ -387,7 +387,7 @@ 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 corresponding static 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 with base name ``, and either type inference has not added type arguments as a generic function instantiation coercion to the method, From dee336721a6c15d1c002c045a84b4a5561923296 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Mon, 20 Jan 2025 12:07:40 +0200 Subject: [PATCH 2/2] One more typo fixed --- working/3616 - enum value shorthand/proposal-simple-lrhn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/working/3616 - enum value shorthand/proposal-simple-lrhn.md b/working/3616 - enum value shorthand/proposal-simple-lrhn.md index 442ffcc8dd..90507ded10 100644 --- a/working/3616 - enum value shorthand/proposal-simple-lrhn.md +++ b/working/3616 - enum value shorthand/proposal-simple-lrhn.md @@ -457,7 +457,7 @@ const Endian endian = .big; // => Endian.big. A *constant pattern* `` is treated the same as that static member shorthand as an expression that has no following selectors, except with the _matched value type_ is set as the shorthand context -of the ``. +of the ``. The restriction to `` is intended to match the existing allowed constant patterns, `` and