Skip to content

Commit

Permalink
Version 3.5.0-128.0.dev
Browse files Browse the repository at this point in the history
Merge fc2700a into dev
  • Loading branch information
Dart CI committed May 3, 2024
2 parents 03b7868 + fc2700a commit 138695e
Show file tree
Hide file tree
Showing 30 changed files with 1,148 additions and 194 deletions.
158 changes: 80 additions & 78 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 3.5.0

### Dart Runtime

- The Dart VM only executes sound null safe code, running of unsound null
safe code using the option `--no-sound-null-safety` has been removed.

Expand Down Expand Up @@ -37,10 +38,22 @@ advantage of these improvements, set your package's

### Libraries

#### `dart:async`

- Added option for `ParallelWaitError` to get some meta-information that
it can expose in its `toString`, and the `Iterable<Future>.wait` and
`(Future,...,Future).wait` extension methods now provide that information.
Should make a `ParallelWaitError` easier to log.

#### `dart:cli`

- **Breaking change** [#52121][]: `waitFor` is removed in 3.4.

#### `dart:ffi`

- Added `Struct.create` and `Union.create` to create struct and union views
of the sequence of bytes stored in a subtype of `TypedData`.

#### `dart:io`

- **Breaking change** [#53863][]: `Stdout` has a new field `lineTerminator`,
Expand All @@ -60,25 +73,61 @@ advantage of these improvements, set your package's
to runtime errors when trying to use the return values. The implementation now
returns a `JSBoolean` to align with the interface. See issue [#55024] for
more details.

- Added `ExternalDartReference` and related conversion functions
`toExternalReference` and `toDartObject`. This is a faster alternative to
`JSBoxedDartObject`, but with fewer safety guarantees and fewer
interoperability capabilities. See [#55187] for more details.

- On dart2wasm, `JSBoxedDartObject` now is an actual JS object that wraps the
opaque Dart value instead of only externalizing the value. Like the JS
backends, you'll now get a more useful error when trying to use it in another
Dart runtime.

- Added `isA` helper to make type checks easier with interop types. See
[#54138][] for more details.

[#54138]: https://github.com/dart-lang/sdk/issues/54138
[#55024]: https://github.com/dart-lang/sdk/issues/55024
[#55187]: https://github.com/dart-lang/sdk/issues/55187

#### `dart:typed_data`

- **BREAKING CHANGE** [#53218][] [#53785][]: The unmodifiable view classes for
typed data are deprecated.

To create an unmodifiable view of a typed-data object, use the
`asUnmodifiableView()` methods added in Dart 3.3:

```dart
Uint8List data = ...;
final readOnlyView = data.asUnmodifiableView();
// readOnlyView has type Uint8List, and throws if attempted modified.
```

The reason for this change is to allow more flexibility in the implementation
of typed data, so the native and web platforms can use different strategies
to ensure that typed data has good performance.

The deprecated types will be removed in Dart 3.5.

[#53218]: https://github.com/dart-lang/sdk/issues/53218
[#53785]: https://github.com/dart-lang/sdk/issues/53785

### Tools

#### Analyzer

- Improved code completion. Fixed over 50% of completion correctness bugs,
tagged `analyzer-completion-correctness` in the [issue
tracker][analyzer-completion-correction-issues].

- Support for new annotations introduced in version 1.14.0 of the [meta]
package.

- Support for the [`@doNotSubmit`] annotation, noting that any usage of an
annotated member should not be submitted to source control.

- Support for the [`@mustBeConst`] annotation, which indicates that an
annotated parameter only accepts constant arguments.

Expand All @@ -89,16 +138,24 @@ advantage of these improvements, set your package's

#### Compilers

- The compilation environment will no longer pretend to contain
entries with value `""` for all `dart.library.foo` strings,
where `dart:foo` is not an available library.
Instead there will only be entries for the available libraries,
like `dart.library.core`, where the value was, and still is, `"true"`.
This should have no effect on `const bool.fromEnvironment(...)` or
`const String.fromEnvironment(...)` without a `defaultValue`
argument, an argument which was always ignored previously.
It changes the behavior of `const bool.hasEnvironment(...)` on such
an input, away from always being `true` and therefore useless.
- The compilation environment will no longer pretend to contain entries with
value `""` for all `dart.library.foo` strings, where `dart:foo` is not an
available library. Instead there will only be entries for the available
libraries, like `dart.library.core`, where the value was, and still is,
`"true"`. This should have no effect on `const bool.fromEnvironment(...)` or
`const String.fromEnvironment(...)` without a `defaultValue` argument, an
argument which was always ignored previously. It changes the behavior of
`const bool.hasEnvironment(...)` on such an input, away from always being
`true` and therefore useless.

#### DevTools

- Updated DevTools to version 2.33.0 from 2.31.1.
To learn more, check out the release notes for versions
[2.32.0][devtools-2-32-0] and [2.33.0][devtools-2-33-0].

[devtools-2-32-0]: https://docs.flutter.dev/tools/devtools/release-notes/release-notes-2.32.0
[devtools-2-33-0]: https://docs.flutter.dev/tools/devtools/release-notes/release-notes-2.33.0

#### Pub

Expand All @@ -107,73 +164,29 @@ advantage of these improvements, set your package's
`ignored_advisories` section in the `pubspec.yaml` file. To learn more about
pub's support for security advisories, visit
[dart.dev/go/pub-security-advisories][pub-security-advisories].
- `path`-dependencies inside `git`-dependencies are now resolved relative to the git
repo.

- `path`-dependencies inside `git`-dependencies are now resolved relative to the
git repo.

- All `dart pub` commands can now be run from any subdirectory of a project. Pub
will find the first parent directory with a `pubspec.yaml` and operate relative it.
will find the first parent directory with a `pubspec.yaml` and operate
relative it.

- New command `dart pub unpack` that downloads a package from pub.dev and
extracts it to a subfolder of the current directory.

This can be useful for inspecting the code, or playing with examples.

[pub-security-advisories]: https://dart.dev/go/pub-security-advisories

### Libraries

#### `dart:async`

- Added option for `ParallelWaitError` to get some meta-information that
it can expose in its `toString`, and the `Iterable<Future>.wait` and
`(Future,...,Future).wait` extension methods now provide that information.
Should make a `ParallelWaitError` easier to log.

#### `dart:ffi`

- Added `Struct.create` and `Union.create` to create struct and union views
of the sequence of bytes stored in a subtype of `TypedData`.

#### `dart:js_interop`

- On dart2wasm, `JSBoxedDartObject` now is an actual JS object that wraps the
opaque Dart value instead of only externalizing the value. Like the JS
backends, you'll now get a more useful error when trying to use it in another
Dart runtime.
- Added `isA` helper to make type checks easier with interop types. See
[#54138][] for more details.

[#54138]: https://github.com/dart-lang/sdk/issues/54138

#### `dart:typed_data`

- **BREAKING CHANGE** [#53218][] [#53785][]: The unmodifiable view classes for
typed data are deprecated.

To create an unmodifiable view of a typed-data object, use the
`asUnmodifiableView()` methods added in Dart 3.3:

```dart
Uint8List data = ...;
final readOnlyView = data.asUnmodifiableView();
// readOnlyView has type Uint8List, and throws if attempted modified.
```

The reason for this change is to allow more flexibility in the implementation
of typed data, so the native and web platforms can use different strategies
to ensure that typed data has good performance.

The deprecated types will be removed in Dart 3.5.

[#53218]: https://github.com/dart-lang/sdk/issues/53218
[#53785]: https://github.com/dart-lang/sdk/issues/53785

### Dart Runtime

- Dart VM flags and options can now be provided to any executable
generated using `dart compile exe` via the `DART_VM_OPTIONS` environment
variable. `DART_VM_OPTIONS` should be set to a list of comma-separated flags
and options with no whitespace. Options that allow for multiple values to be
provided as comma-separated values are not supported
(e.g., `--timeline-streams=Dart,GC,Compiler`).
- Dart VM flags and options can now be provided to any executable generated
using `dart compile exe` via the `DART_VM_OPTIONS` environment variable.
`DART_VM_OPTIONS` should be set to a list of comma-separated flags and options
with no whitespace. Options that allow for multiple values to be provided as
comma-separated values are not supported (e.g.,
`--timeline-streams=Dart,GC,Compiler`).

Example of a valid `DART_VM_OPTIONS` environment variable:

Expand All @@ -185,17 +198,6 @@ advantage of these improvements, set your package's
`Dart_NewExternalLatin1String` and `Dart_NewExternalUTF16String` functions are
removed from Dart C API.

### Tools

#### DevTools

- Updated DevTools to version 2.33.0 from 2.31.1.
To learn more, check out the release notes for versions
[2.32.0][devtools-2-32-0] and [2.33.0][devtools-2-33-0].

[devtools-2-32-0]: https://docs.flutter.dev/tools/devtools/release-notes/release-notes-2.32.0
[devtools-2-33-0]: https://docs.flutter.dev/tools/devtools/release-notes/release-notes-2.33.0

## 3.3.4 - 2024-04-17

This is a patch release that:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2476,6 +2476,19 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}

// `case ^ _:`
// The user want a type for incomplete WildcardPattern.
if (pattern is WildcardPattern) {
if (offset < pattern.name.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
return;
}
}

// `case Name ^:`
// The user wants the pattern variable name.
if (pattern is ConstantPattern) {
Expand Down Expand Up @@ -2504,6 +2517,11 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case WildcardPattern():
collector.completionLocation = 'WildcardPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
}
}

Expand Down Expand Up @@ -2875,6 +2893,18 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}

@override
void visitWildcardPattern(WildcardPattern node) {
var type = node.type;
if (type != null) {
if (type.coversOffset(offset)) {
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
}
}
}

@override
void visitWithClause(WithClause node) {
var parent = node.parent;
Expand Down Expand Up @@ -3219,10 +3249,10 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
void _forPattern(AstNode node, {bool mustBeConst = true}) {
var coveringNode = state.selection.coveringNode;

// `if (x case ^ y)`
// The user want a type for incomplete DeclaredVariablePattern.
if (node case CaseClause caseClause) {
var pattern = caseClause.guardedPattern.pattern;
// `if (x case ^ y)`
// The user wants a type for incomplete DeclaredVariablePattern.
if (pattern is ConstantPattern) {
if (pattern.expression case SimpleIdentifier identifier) {
if (!identifier.isSynthetic && offset < identifier.offset) {
Expand All @@ -3235,6 +3265,18 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
}
}
}
// `if (x case ^ _)`
// The user wants a type for incomplete WildcardPattern.
if (pattern is WildcardPattern) {
if (offset < pattern.name.offset) {
state.request.opType.includeConstructorSuggestions = false;
state.request.opType.mustBeConst = true;
declarationHelper(
mustBeType: true,
).addLexicalDeclarations(node);
return;
}
}
}

// `if (x case Name^) {}`
Expand Down Expand Up @@ -3271,6 +3313,11 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
case WildcardPattern():
collector.completionLocation = 'WildcardPattern_type';
state.request.opType.includeConstructorSuggestions = false;
type.accept(this);
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/analysis/session_helper.dart';
import 'package:analyzer/src/lint/linter.dart';
import 'package:analyzer/src/utilities/extensions/ast.dart';
import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart.dart'
show DartFileEditBuilderImpl;
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
Expand Down Expand Up @@ -49,12 +49,7 @@ abstract class DartSnippetProducer extends SnippetProducer {
.getAnalysisOptionsForFile(request.unit.file)
.codeStyleOptions;

bool get isInTestDirectory {
var path = request.unit.path;
return LinterContextImpl.getTestDirectories(
request.resourceProvider.pathContext)
.any(path.contains);
}
bool get isInTestDirectory => request.unit.unit.inTestDir;

/// Adds public imports for any elements fetched by [getClass] and [getMixin]
/// to [builder].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import 'try_statement_test.dart' as try_statement;
import 'type_argument_list_test.dart' as type_argument_list;
import 'type_test_test.dart' as type_test;
import 'variable_declaration_list_test.dart' as variable_declaration_list;
import 'wildcard_pattern_test.dart' as wildcard_pattern;
import 'with_clause_test.dart' as with_clause;

/// Tests suggestions produced at specific locations.
Expand Down Expand Up @@ -154,6 +155,7 @@ void main() {
type_argument_list.main();
type_test.main();
variable_declaration_list.main();
wildcard_pattern.main();
with_clause.main();
});
}
Loading

0 comments on commit 138695e

Please sign in to comment.