@@ -76,21 +76,21 @@ library privacy comes into play.
76
76
77
77
## Proposal
78
78
79
- ### Local declarations
79
+ ### Declarations that are capable of declaring a wildcard
80
80
81
- A *local declaration* is any of:
81
+ Any of the following kinds of declarations can declare a wildcard :
82
82
83
83
* Function parameters. This includes top-level functions, local functions,
84
84
function expressions ("lambdas"), instance methods, static methods,
85
- constructors, etc. It includes all parameter kinds: simple, field formals,
86
- and function-typed formals, etc.:
85
+ constructors, etc. It includes all parameter kinds, excluding named
86
+ parameters: simple, field formals, and function-typed formals, etc.:
87
87
88
88
```dart
89
- Foo(_, this._, super._, void _(), {_} ) {}
89
+ Foo(_, this._, super._, void _()) {}
90
90
91
91
list.where((_) => true);
92
92
93
- void f(void g(_, _)) {}
93
+ void f(void g(int _, bool _)) {}
94
94
95
95
typedef T = void Function(String _, String _);
96
96
```
@@ -130,8 +130,8 @@ A *local declaration* is any of:
130
130
takeGenericCallback(<_>() => true);
131
131
```
132
132
133
- A local declaration whose name is `_` does not bind that name to anything. This
134
- means you can have multiple local declarations named `_` in the same namespace
133
+ A declaration whose name is `_` does not bind that name to anything. This
134
+ means you can have multiple declarations named `_` in the same namespace
135
135
without a collision error. The initializer, if there is one, is still executed,
136
136
but the value is not accessible.
137
137
@@ -153,12 +153,13 @@ Named fields of record types are unchanged. It is still a compile-time error for
153
153
154
154
``` dart
155
155
void f() {
156
- _() {} // Error .
157
- _(); // Error.
156
+ _() {} // Dead code .
157
+ _(); // Error, not in scope .
158
158
}
159
159
```
160
160
161
- It's an error to declare a local function declaration named ` _ ` .
161
+ A local function declaration named ` _ ` is dead code and will produce a warning
162
+ because the function is unreachable.
162
163
163
164
### Other declarations
164
165
0 commit comments