Skip to content

Commit

Permalink
Update example in Static access shorthand proposal (#4191)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Dec 2, 2024
1 parent 0b1f014 commit 66c6aad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions working/3616 - enum value shorthand/proposal-simple-lrhn.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ That means you can write things like the following (with the intended meaning as
comments, specification to achieve that below):

```dart
Endian littleEndian = .little; // -> Endian.little (enum value)
// -> HttpClientResponseCompressionState.compressed (enum value)
HttpClientResponseCompressionState state = .compressed;
Endian littleEndian = .little; // -> Endian.little (static constant)
Endian hostEndian = .host; // -> Endian.host (getter)
// -> Endian.little, Endian.big, Endian.host
Endian endian = firstWord == 0xFEFF ? .little : firstWord = 0xFFFE ? .big : .host;
Expand Down Expand Up @@ -270,7 +273,7 @@ and <code>*T*.new\<*typeArgs*\></code> already are, whether used as instantiated
tear-off or invoked.
_(The grammar allows them, because `C.new` is a `<primary>` 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)<int>`.)
recognized and made an error to avoid it being interpreted as `(C.new)<int>`.)_

**Notice**: The invocation of a constructor is *not* using an instantiated type,
it’s behaving as if the constructor was preceded by a *raw type*, which type
Expand Down

0 comments on commit 66c6aad

Please sign in to comment.