Skip to content

Commit 6224734

Browse files
committed
[augmentations] Clarify two corners of the proposal.
Fix #1957. Fix #2059.
1 parent b19b042 commit 6224734

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

working/augmentation-libraries/feature-specification.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Augmentation Libraries
22

3-
Author: [email protected], Version: 1.0
3+
Author: [email protected], Version: 1.1 (see Changelog at end)
44

55
Augmentation libraries allow splitting a Dart library into files. Unlike part
66
files, each augmentation has its [own imports][part imports] and top-level
@@ -148,6 +148,10 @@ merge its declarations into this library. It is a compile-time error if:
148148
* The library referenced in a `library augment` directive does not have an
149149
`import augment` directive pointing back to this augmentation.
150150

151+
* The same augmentation library is applied more than once. *In other words,
152+
you can't have redundant `import augment` directives that point to the same
153+
library.*
154+
151155
Since the main library and its augmentation both point to each other, these
152156
rules imply that a given augmentation file can only be used to augment a single
153157
library.
@@ -286,8 +290,10 @@ It is a compile-time error if:
286290
* The signature of the function augmentation does not exactly match the
287291
original function. This means the return types must be the same; there must
288292
be the same number of positional, optional, and named parameters; the types
289-
of corresponding positional and optional parameters must be the same; and
290-
the names and types of named parameters must be the same.
293+
of corresponding positional and optional parameters must be the same; the
294+
names and types of named parameters must be the same; any type parameters
295+
and bounds must be the same; and any `required` or `covariant` modifiers
296+
must match.
291297

292298
* The original function is declared `external` and the augmenting function
293299
uses `augment super()`.
@@ -671,3 +677,15 @@ part files can do. At that point, we can more strongly recommend the few users
671677
using them migrate to augmentations. In Dart 3.0, we can consider removing
672678
support for part files entirely, which would simplify the language and our
673679
tools.
680+
681+
## Changelog
682+
683+
### 1.1
684+
685+
* Make it an error to apply the same augmentation multiple times (#1957).
686+
* Clarify type parameters and parameter modifiers in function signature
687+
matching (#2059).
688+
689+
### 1.0
690+
691+
Initial version.

0 commit comments

Comments
 (0)