Skip to content

Commit d678b4d

Browse files
authored
[patterns] Fix "||" vs "&&" in rationale for no repeated named fields (#2729)
* [patterns] Fix "||" vs "&&" in rationale for no repeated named fields If this syntax were allowed, one would expect it to bind the variables from both patterns. The way to do that is with "&&". * [patterns] Fix typo in type inference example
1 parent 72807fa commit d678b4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

accepted/future-releases/0546-patterns/feature-specification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ var (:x, x: y) = (x: 1);
701701
```
702702

703703
*Destructuring the same field multiple times is never necessary because you can
704-
always just destructure it once with an `||` subpattern. If a user does it, it's
704+
always just destructure it once with an `&&` subpattern. If a user does it, it's
705705
mostly like a copy/paste mistake and it's more helpful to draw their attention
706706
to the error than silently accept it.*
707707

@@ -1684,7 +1684,7 @@ To orchestrate this, type inference on patterns proceeds in three phases:
16841684
16851685
```dart
16861686
T id<T>(T t) => t;
1687-
(T Function<T>(T), dynamic) record = (t, 'str');
1687+
(T Function<T>(T), dynamic) record = (id, 'str');
16881688
var (int Function(int) f, String s) = record;
16891689
```
16901690

0 commit comments

Comments
 (0)