Skip to content

Commit 656930c

Browse files
authored
Fix typos in import shorthand proposal
1 parent a39e174 commit 656930c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

working/0649 - Import shorthand/proposal.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dart Import Shorthand Syntax
22

3-
Author: [email protected]<br>Version: 2.2
3+
Author: [email protected]<br>Version: 2.2.1
44

55
This is a proposal for a shorter import syntax for Dart. It is defined as a shorthand syntax which expands to, and coexists with, the existing import syntax. It avoids unnecessary repetitions and uses short syntax for the most common imports.
66

@@ -56,7 +56,7 @@ You can omit the path (including the colon) to get a *package default shorthand*
5656

5757
You can omit the package name, and have just the colon and path, to get a *current package shorthand*, which uses the package of the surrounding as the package, so an `import :path` means the same as `import current_package:path`.
5858

59-
The package name `dart` is special-case to mean a *platform library shorthand*, so `import dart:async` does import `dart:async`.
59+
The package name `dart` is special-cased to mean a *platform library shorthand*, so `import dart:async` does import `dart:async`.
6060

6161
### Path import shorthand syntax
6262

@@ -135,10 +135,8 @@ Otherwise, if *name* is `dart`, then *p* a *platform library shorthand* and is a
135135

136136
If *p* is a *package default shorthand*, a `<DOTTED_NAME>`, <code>*name*</code>, then:
137137

138-
```
139138
* If *name* is a single `<SHORTHAND_NAME>`, then *p* is shorthand for <code>"package:*name*/*name*.dart"</code>.
140139
* If *name* is a `<DOTTED_NAME> '.’ <SHORTHAND_NAME>` of the form <code>*prefix*.*last*</code> then *p* is shorthand for <Code>"package:*name*/*last*.dart</code>.
141-
```
142140

143141
If *p* is a *current package shorthand*, `: <SHORTHAND_PATH>`, of the form <Code>:*path*</code>, then let *name* be the package name of the package that the surrounding file belongs to. Then *p* is shorthand for <Code>"package:*name*/*path*.dart"</code>. _(A leading-`:`-reference *only* works for code which is actually inside a package. Being “inside a package” in this regard is defined in the same way as used for language versioning, which means that the `test/` and `bin/` directories of a Pub package are inside the same package as the `lib/` directory, even if they cannot be referenced using a `package:` URI. Effectively `:path` becomes a canonical way for libraries outside of `lib/` to refer to package-URIs of the same package, without needing to repeat the package name.)_
144142

@@ -246,6 +244,9 @@ It’s not clear that there is something clean we can do here, but if there was,
246244
## Version history
247245

248246
1.0: Original version uploaded as language issue [#649](https://github.com/dart-lang/language/issues/649).
247+
249248
2.0: Remove shorthands for relative imports, just use the URIs, and don't allow shorthand syntax in `part` declarations.<br>2.1: Reinstate shorthands for relative imports, but keep `:` as the marker for same-package paths. Grammar allows multiple leading `../`’s. More discussion on `part of`.
250249

251250
2.2, 2021-11-02: Use `:` as marker for same-package paths and retain `/` as a path reference. Allow `-` in URI path segments.
251+
252+
2.2.1. Fix typos.

0 commit comments

Comments
 (0)