Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6ca7a18

Browse files
author
Dart CI
committed
Version 2.18.0-247.0.dev
Merge commit 'd2a3849f92ff99b29fcf3d8ab093f4a4f5df5446' into 'dev'
2 parents be9f4cb + d2a3849 commit 6ca7a18

34 files changed

+207
-335
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ client/tests/drt
7575
packages
7676
pubspec.lock
7777

78-
# The top level package files (these are auto-generated per checkout)
78+
# The top level package file (this is auto-generated per checkout).
7979
/.dart_tool/package_config.json
80-
/.packages
8180

8281
# Local pub storage
8382
.pub

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## 2.19.0
22

3+
#### Dart command line
4+
5+
- **Breaking change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
6+
The standalone `dartanalyzer` tool has been removed as previously
7+
announced. `dartanalyzer` is replaced by the `dart analyze` command.
8+
39
### Language
410

511
- **Breaking Change** [#48167](https://github.com/dart-lang/sdk/issues/48167):

DEPS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ vars = {
108108
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
109109
"dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea", # manually rev'd
110110

111-
"dartdoc_rev": "d8195107d3e65e20094bb2ca0a8e8576e3a765bf",
111+
"dartdoc_rev": "900432d8cb1e75c4f28c79d94c3036fd3b3ec21d",
112112
"devtools_rev": "0aa619c42a68d6db4c94a7838121811aba8f5eb1",
113113
"ffi_rev": "18b2b549d55009ff594600b04705ff6161681e07",
114114
"file_rev": "0132eeedea2933513bf230513a766a8baeab0c4f",
@@ -135,7 +135,7 @@ vars = {
135135
"path_rev": "7a0ed40280345b1c11df4c700c71e590738f4257",
136136
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
137137
"pool_rev": "fa84ddd0e39f45bf3f09dcc5d6b9fbdda7820fef",
138-
"protobuf_rev": "7ac39080eb886e6eec55983dcba76e855c038701",
138+
"protobuf_rev": "66593ca5a4d163b2f9a469a2b6368e12a710e550",
139139
"pub_rev": "9bf4289d6fd5d6872a8929d6312bbd7098f3ea9c", # manually rev'd
140140
"pub_semver_rev": "5c0b4bfd5ca57fe16f1319c581dc8c882e9b8cb2",
141141
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
@@ -153,15 +153,15 @@ vars = {
153153
"test_descriptor_rev": "5ed5d7f6bf1191592995dcb8eedbbc17df69d386",
154154
"test_process_rev": "3e695bcfeab551473ddc288970f345f30e5e1375",
155155
"test_reflective_loader_rev": "8d0de01bbe852fea1f8e33aba907abcba50a8a1e",
156-
"test_rev": "6d656f60f2c486efce5f4f22ff00dbb037a825f1",
156+
"test_rev": "ed73bb93b06280cd47108d202cd96bcf3494df65",
157157
"typed_data_rev": "bb10b64f9a56b8fb49307d4465474bf1c1309f6d",
158158
"usage_rev": "1d3c31e780af665fb796a27898a441fcb7d263db",
159159
"vector_math_rev": "cdcee487bde4353a6ba7a29bfc7db3840426e50f",
160160
"watcher_rev": "e00c0ea769e32821d91c0880da8eb736839a6e6d",
161161
"web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
162162
"web_socket_channel_rev": "99dbdc5769e19b9eeaf69449a59079153c6a8b1f",
163163
"WebCore_rev": "bcb10901266c884e7b3740abc597ab95373ab55c",
164-
"webdev_rev": "b0a4059dcdfb3af2a011cbefc5eb21fb0cfd8032",
164+
"webdev_rev": "9c4428472b04f50748ea4871829897cff43455a3",
165165
"webdriver_rev": "e1a9ad671ee82e05eee463f922a34585ed2d2f15",
166166
"webkit_inspection_protocol_rev": "57522d6b29d94903b765c757079d906555d5a171",
167167
"yaml_edit_rev": "01589b3ce447b03aed991db49f1ec6445ad5476d",

README.dart-sdk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ bin/ Binaries/scripts to compile, run, and manage Dart apps.
99
dartaotruntime Minimal Dart runtime for running AOT modules
1010
dart2js Dart to JavaScript production compiler
1111
dartdevc Dart to Javascript development compiler
12-
dartanalyzer Dart static analyzer
1312
dartdoc Dart documentation generator
1413

1514
include/ header files that define the Dart embedding API for use by

pkg/analyzer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@
478478
* Deprecated `AstFactory.indexExpressionForTarget()`. Please use
479479
`indexExpressionForTarget2` instead.
480480
* Deprecated `ClassElement.isOrInheritsProxy` and `ClassElement.isProxy`. The
481-
`@proxy` annotation is deprecated in the langauge, and will be removed.
481+
`@proxy` annotation is deprecated in the language, and will be removed.
482482
* Added new error codes: BODY_MIGHT_COMPLETE_NORMALLY,
483483
CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE,
484484
DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE, LATE_FINAL_LOCAL_ALREADY_ASSIGNED,

pkg/dev_compiler/lib/src/kernel/compiler.dart

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import '../js_ast/js_ast.dart' show ModuleItem, js;
3232
import '../js_ast/source_map_printer.dart'
3333
show NodeEnd, NodeSpan, HoverComment, continueSourceMap;
3434
import 'constants.dart';
35+
import 'future_or_normalizer.dart';
3536
import 'js_interop.dart';
3637
import 'js_typerep.dart';
3738
import 'kernel_helpers.dart';
@@ -939,7 +940,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
939940
}
940941
return _emitInterfaceType(t, emitNullability: emitNullability);
941942
} else if (t is FutureOrType) {
942-
var normalizedType = _normalizeFutureOr(t);
943+
var normalizedType = normalizeFutureOr(t, _coreTypes);
943944
if (normalizedType is FutureOrType) {
944945
_declareBeforeUse(_coreTypes.deprecatedFutureOrClass);
945946
var typeRep = _emitFutureOrTypeWithArgument(
@@ -2911,64 +2912,6 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
29112912
? visitNullType(const NullType())
29122913
: _emitNullabilityWrapper(runtimeCall('Never'), type.nullability);
29132914

2914-
/// Normalizes `FutureOr` types.
2915-
///
2916-
/// Any changes to the normalization logic here should be mirrored in the
2917-
/// classes.dart runtime library method named `normalizeFutureOr`.
2918-
DartType _normalizeFutureOr(FutureOrType futureOr) {
2919-
var typeArgument = futureOr.typeArgument;
2920-
if (typeArgument is DynamicType) {
2921-
// FutureOr<dynamic> --> dynamic
2922-
return typeArgument;
2923-
}
2924-
if (typeArgument is VoidType) {
2925-
// FutureOr<void> --> void
2926-
return typeArgument;
2927-
}
2928-
2929-
if (typeArgument is InterfaceType &&
2930-
typeArgument.classNode == _coreTypes.objectClass) {
2931-
// Normalize FutureOr of Object, Object?, Object*.
2932-
var nullable = futureOr.nullability == Nullability.nullable ||
2933-
typeArgument.nullability == Nullability.nullable;
2934-
var legacy = futureOr.nullability == Nullability.legacy ||
2935-
typeArgument.nullability == Nullability.legacy;
2936-
var nullability = nullable
2937-
? Nullability.nullable
2938-
: legacy
2939-
? Nullability.legacy
2940-
: Nullability.nonNullable;
2941-
return typeArgument.withDeclaredNullability(nullability);
2942-
} else if (typeArgument is NeverType) {
2943-
// FutureOr<Never> --> Future<Never>
2944-
return InterfaceType(
2945-
_coreTypes.futureClass, futureOr.nullability, [typeArgument]);
2946-
} else if (typeArgument is NullType) {
2947-
// FutureOr<Null> --> Future<Null>?
2948-
return InterfaceType(
2949-
_coreTypes.futureClass, Nullability.nullable, [typeArgument]);
2950-
} else if (futureOr.declaredNullability == Nullability.nullable &&
2951-
typeArgument.nullability == Nullability.nullable) {
2952-
// FutureOr<T?>? --> FutureOr<T?>
2953-
return futureOr.withDeclaredNullability(Nullability.nonNullable);
2954-
}
2955-
// The following is not part of the normalization spec but this is a
2956-
// convenient place to perform this change of nullability consistently. This
2957-
// only applies at compile-time and is not needed in the runtime version of
2958-
// the FutureOr normalization.
2959-
// FutureOr<T%>% --> FutureOr<T%>
2960-
//
2961-
// If the type argument has undetermined nullability the CFE propagates
2962-
// it to the FutureOr type as well. In this case we can represent the
2963-
// FutureOr type without any nullability wrappers and rely on the runtime to
2964-
// handle the nullability of the instantiated type appropriately.
2965-
if (futureOr.nullability == Nullability.undetermined &&
2966-
typeArgument.nullability == Nullability.undetermined) {
2967-
return futureOr.withDeclaredNullability(Nullability.nonNullable);
2968-
}
2969-
return futureOr;
2970-
}
2971-
29722915
@override
29732916
js_ast.Expression visitInterfaceType(InterfaceType type) =>
29742917
_emitInterfaceType(type);
@@ -2979,7 +2922,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
29792922

29802923
@override
29812924
js_ast.Expression visitFutureOrType(FutureOrType type) {
2982-
var normalizedType = _normalizeFutureOr(type);
2925+
var normalizedType = normalizeFutureOr(type, _coreTypes);
29832926
return normalizedType is FutureOrType
29842927
? _emitFutureOrType(normalizedType)
29852928
: normalizedType.accept(this);
@@ -6534,7 +6477,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
65346477
String? _annotationName(NamedNode node, bool Function(Expression) test) {
65356478
var annotation = findAnnotation(node, test);
65366479
return annotation != null
6537-
? _constants.getFieldValueFromAnnotation(annotation, 'name') as String
6480+
? _constants.getFieldValueFromAnnotation(annotation, 'name') as String?
65386481
: null;
65396482
}
65406483

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:kernel/ast.dart';
6+
import 'package:kernel/core_types.dart';
7+
import 'package:kernel/kernel.dart';
8+
import 'package:kernel/src/replacement_visitor.dart';
9+
10+
/// Normalizes all `FutureOr` types found in [type].
11+
DartType normalizeFutureOr(DartType type, CoreTypes coreTypes) =>
12+
type.accept1(_FutureOrNormalizer.instance(coreTypes), Variance.unrelated) ??
13+
type;
14+
15+
/// Visit methods returns a normalized version of `FutureOr` types or `null` if
16+
/// no normalization was applied.
17+
///
18+
/// The `variance` parameters in the visit methods are unused in this type
19+
/// replacement.
20+
///
21+
/// `FutureOr` types are normalized per the spec:
22+
/// https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
23+
///
24+
/// Any changes to the normalization logic here should be mirrored in the
25+
/// classes.dart runtime library method named `normalizeFutureOr`.
26+
class _FutureOrNormalizer extends ReplacementVisitor {
27+
final CoreTypes _coreTypes;
28+
29+
static _FutureOrNormalizer? _instance;
30+
31+
_FutureOrNormalizer._(this._coreTypes);
32+
33+
factory _FutureOrNormalizer.instance(CoreTypes coreTypes) =>
34+
_instance ?? (_instance = _FutureOrNormalizer._(coreTypes));
35+
36+
@override
37+
DartType? visitFutureOrType(FutureOrType futureOr, int variance) {
38+
var normalizedTypeArg = futureOr.typeArgument.accept1(this, variance);
39+
var typeArgument = normalizedTypeArg ?? futureOr.typeArgument;
40+
if (typeArgument is DynamicType) {
41+
// FutureOr<dynamic> --> dynamic
42+
return typeArgument;
43+
}
44+
if (typeArgument is VoidType) {
45+
// FutureOr<void> --> void
46+
return typeArgument;
47+
}
48+
49+
if (typeArgument is InterfaceType &&
50+
typeArgument.classNode == _coreTypes.objectClass) {
51+
// Normalize FutureOr of Object, Object?, Object*.
52+
var nullable = futureOr.nullability == Nullability.nullable ||
53+
typeArgument.nullability == Nullability.nullable;
54+
var legacy = futureOr.nullability == Nullability.legacy ||
55+
typeArgument.nullability == Nullability.legacy;
56+
var nullability = nullable
57+
? Nullability.nullable
58+
: legacy
59+
? Nullability.legacy
60+
: Nullability.nonNullable;
61+
return typeArgument.withDeclaredNullability(nullability);
62+
} else if (typeArgument is NeverType) {
63+
// FutureOr<Never> --> Future<Never>
64+
return InterfaceType(
65+
_coreTypes.futureClass, futureOr.nullability, [typeArgument]);
66+
} else if (typeArgument is NullType) {
67+
// FutureOr<Null> --> Future<Null>?
68+
return InterfaceType(
69+
_coreTypes.futureClass, Nullability.nullable, [typeArgument]);
70+
} else if (futureOr.declaredNullability == Nullability.nullable &&
71+
typeArgument.nullability == Nullability.nullable) {
72+
// FutureOr<T?>? --> FutureOr<T?>
73+
return futureOr.withDeclaredNullability(Nullability.nonNullable);
74+
}
75+
// The following is not part of the normalization spec but this is a
76+
// convenient place to perform this change of nullability consistently. This
77+
// only applies at compile-time and is not needed in the runtime version of
78+
// the FutureOr normalization.
79+
// FutureOr<T%>% --> FutureOr<T%>
80+
//
81+
// If the type argument has undetermined nullability the CFE propagates
82+
// it to the FutureOr type as well. In this case we can represent the
83+
// FutureOr type without any nullability wrappers and rely on the runtime to
84+
// handle the nullability of the instantiated type appropriately.
85+
if (futureOr.declaredNullability == Nullability.undetermined &&
86+
typeArgument.declaredNullability == Nullability.undetermined) {
87+
return futureOr.withDeclaredNullability(Nullability.nonNullable);
88+
}
89+
return null;
90+
}
91+
}

pkg/language_versioning_2.7_test/pubspec.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include: package:lints/recommended.yaml
2+
3+
analyzer:
4+
exclude:
5+
# These files have intentional errors.
6+
- test/lib_ex2.7_test.dart
7+
- test/lib_ex2.8_test.dart
8+
- test/lib_im2.7_test.dart
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: language_versioning_2_7_test
2+
version: 1.0.0
3+
description: >
4+
Tests of language versioning. Stored as a package in order to have its own
5+
package configuration and default language version
6+
7+
# This package is not intended for consumption on pub.dev. DO NOT publish.
8+
publish_to: none
9+
10+
environment:
11+
sdk: '>=2.7.0 <3.0.0'
12+
13+
dev_dependencies:
14+
lints: any

pkg/language_versioning_2.7_test/test/lib_ex2.7_test.dart renamed to pkg/language_versioning_2_7_test/test/lib_ex2.7_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
part "src/part_of_ex2.7_v_ex2.7.dart";
99

1010
// Specification requires the part file to have
11-
// the same explicit langauge version marker
11+
// the same explicit language version marker
1212
// as the including library,
1313
// not just the same languge version.
1414
part "src/part_of_ex2.7_v_im2.7.dart";

pkg/language_versioning_2.7_test/test/lib_im2.7_test.dart renamed to pkg/language_versioning_2_7_test/test/lib_im2.7_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
part "src/part_of_im2.7_v_im2.7.dart";
88

99
// Specification requires the part fsrc/ile to have
10-
// the same explicit langauge version marker
10+
// the same explicit language version marker
1111
// as the including library,
1212
// not just the same languge version.
1313
part "src/part_of_im2.7_v_ex2.7.dart";

pkg/test_runner/lib/src/build_configurations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ List<String> _selectBuildTargets(Configuration inner) {
8585
Compiler.fasta: ['create_sdk', 'dartdevc_test', 'kernel_platform_files'],
8686
Compiler.dartdevk: ['dartdevc_test'],
8787
Compiler.dart2js: ['create_sdk'],
88-
Compiler.dart2analyzer: ['create_sdk'],
88+
Compiler.dart2analyzer: ['create_sdk', 'utils/dartanalyzer'],
8989
Compiler.specParser: <String>[],
9090
};
9191
final result = [...targetsForCompilers[compiler]!];

pkg/test_runner/lib/src/command.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,20 +559,37 @@ class BrowserTestCommand extends Command {
559559
}
560560

561561
class AnalysisCommand extends ProcessCommand {
562+
final List<String> commonAnalyzerCliArguments;
563+
562564
AnalysisCommand(String executable, List<String> arguments,
563-
Map<String, String> environmentOverrides, {int index = 0})
565+
this.commonAnalyzerCliArguments, Map<String, String> environmentOverrides,
566+
{int index = 0})
564567
: super('dart2analyzer', executable, arguments, environmentOverrides,
565568
null, index);
566569

567-
AnalysisCommand indexedCopy(int index) =>
568-
AnalysisCommand(executable, arguments, environmentOverrides,
569-
index: index);
570+
AnalysisCommand indexedCopy(int index) => AnalysisCommand(
571+
executable, arguments, commonAnalyzerCliArguments, environmentOverrides,
572+
index: index);
570573

571574
CommandOutput createOutput(int exitCode, bool timedOut, List<int> stdout,
572575
List<int> stderr, Duration time, bool compilationSkipped,
573576
[int? pid = 0]) =>
574577
AnalysisCommandOutput(
575578
this, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
579+
580+
@override
581+
List<String> get batchArguments => commonAnalyzerCliArguments;
582+
583+
@override
584+
List<String> get nonBatchArguments => commonAnalyzerCliArguments;
585+
586+
@override
587+
bool _equal(covariant ProcessCommand other) {
588+
return other is AnalysisCommand &&
589+
super._equal(other) &&
590+
deepJsonCompare(
591+
commonAnalyzerCliArguments, other.commonAnalyzerCliArguments);
592+
}
576593
}
577594

578595
class CompareAnalyzerCfeCommand extends ProcessCommand {

0 commit comments

Comments
 (0)