Skip to content

Commit 205aa1f

Browse files
Clarify pattern type schema for object patterns with implicit type arguments. (#3562)
This change reflects what was implemented. See also https://dart-review.googlesource.com/c/sdk/+/346383, which introduces a language test validating this behavior.
1 parent 2965d6d commit 205aa1f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

accepted/3.0/patterns/feature-specification.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,14 @@ The context type schema for a pattern `p` is:
18771877
// ^-- Infer Foo<num>.
18781878
```
18791879
1880+
If the type the object name resolves to is generic, and no type
1881+
arguments are specified, then instantiate to bounds is used to
1882+
fill in provisional type arguments for the purpose of determining
1883+
the context type schema. *Note that during the type checking
1884+
phase, these provisional type arguments will be replaced with the
1885+
result of applying downwards inference. See "Type checking and
1886+
pattern required type" below.*
1887+
18801888
The pattern type schema for logical-or, null-check, constant, and relational
18811889
patterns is not defined, because those patterns are only allowed in refutable
18821890
contexts, and the pattern type schema is only used in irrefutable contexts.

0 commit comments

Comments
 (0)