Skip to content

Commit 0277f03

Browse files
committed
[patterns] Correct context type schema for pattern for-in.
1 parent 777d65e commit 0277f03

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,8 +2665,8 @@ for (<keyword> <pattern> in <expression>) <statement>
26652665

26662666
Where `<keyword>` is `var` or `final` is treated like so:
26672667

2668-
1. Let `I` be the static type of `<expression>`, inferred using the context
2669-
type schema of `<pattern>`.
2668+
1. Let `I` be the static type of `<expression>`, inferred using context type
2669+
schema `Iterable<P>` where `P` is the context type schema of `<pattern>`.
26702670

26712671
2. Calculate the element type of `I`:
26722672

@@ -2700,8 +2700,8 @@ for (<keyword> <pattern> in <expression>) <element>
27002700

27012701
Where `<keyword>` is `var` or `final` is treated like so:
27022702

2703-
1. Let `I` be the static type of `<expression>`, inferred using the context
2704-
type schema of `<pattern>`.
2703+
1. Let `I` be the static type of `<expression>`, inferred using context type
2704+
schema `Iterable<P>` where `P` is the context type schema of `<pattern>`.
27052705

27062706
2. Calculate the element type of `I`:
27072707

@@ -3526,6 +3526,7 @@ Here is one way it could be broken down into separate pieces:
35263526
### 2.23
35273527
35283528
- Suggest warnings that implementations may want to report.
3529+
- Correct context type schema for pattern for-in statements and expressions.
35293530
35303531
### 2.22
35313532

0 commit comments

Comments
 (0)