Skip to content

Commit d33eaee

Browse files
authored
Prepare a hotfix release of DWDS 22.1.0+1 (#2321)
1 parent 50b8ae8 commit d33eaee

File tree

18 files changed

+316
-493
lines changed

18 files changed

+316
-493
lines changed

Diff for: .github/workflows/dart.yml

+92-470
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dwds/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
## 22.1.0+1
2+
3+
- Fix a null cast error when debugging a `Class` from VS Code. - [#2303](https://github.com/dart-lang/webdev/pull/2303)
4+
15
## 22.1.0
6+
27
- Update `package:vm_service` constraint to `^13.0.0`. - [#2235](https://github.com/dart-lang/webdev/pull/2265)
38

49
## 22.0.0

Diff for: dwds/lib/src/debugging/classes.dart

+6-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ class ClassHelper extends Domain {
9696
throw ChromeDebugException(e.json, evalContents: expression);
9797
}
9898

99-
final classDescriptor = result.value as Map<String, dynamic>;
99+
final classDescriptor = _mapify(result.value);
100100
final methodRefs = <FuncRef>[];
101-
final methodDescriptors =
102-
classDescriptor['methods'] as Map<String, dynamic>;
101+
final methodDescriptors = _mapify(classDescriptor['methods']);
103102
methodDescriptors.forEach((name, descriptor) {
104103
final methodId = 'methods|$classId|$name';
105104
methodRefs.add(
@@ -118,7 +117,7 @@ class ClassHelper extends Domain {
118117
});
119118
final fieldRefs = <FieldRef>[];
120119

121-
final fieldDescriptors = classDescriptor['fields'] as Map<String, dynamic>;
120+
final fieldDescriptors = _mapify(classDescriptor['fields']);
122121
fieldDescriptors.forEach((name, descriptor) {
123122
final classMetaData = ClassMetaData(
124123
runtimeKind: RuntimeObjectKind.type,
@@ -168,4 +167,7 @@ class ClassHelper extends Domain {
168167
superClass: superClassRef,
169168
);
170169
}
170+
171+
Map<String, dynamic> _mapify(dynamic map) =>
172+
(map as Map<String, dynamic>?) ?? <String, dynamic>{};
171173
}

Diff for: dwds/lib/src/debugging/location.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class DartLocation {
7878
int get hashCode => Object.hashAll([uri, line, column]);
7979

8080
@override
81-
bool operator ==(Object? other) {
81+
bool operator ==(Object other) {
8282
if (other is! DartLocation) {
8383
return false;
8484
}

Diff for: dwds/lib/src/version.dart

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dwds/mono_pkg.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,20 @@ stages:
1515
- test: --tags=extension
1616
sdk:
1717
- dev
18-
- main
1918
os:
2019
- linux
2120
# Windows extension tests:
2221
- group:
2322
- test: --tags=extension
2423
sdk:
2524
- dev
26-
- main
2725
os:
2826
- windows
2927
# First test shard:
3028
- group:
3129
- test: --total-shards 3 --shard-index 0 --exclude-tags=extension
3230
sdk:
3331
- dev
34-
- main
3532
os:
3633
- linux
3734
- windows
@@ -40,7 +37,6 @@ stages:
4037
- test: --total-shards 3 --shard-index 1 --exclude-tags=extension
4138
sdk:
4239
- dev
43-
- main
4440
os:
4541
- linux
4642
- windows
@@ -49,7 +45,6 @@ stages:
4945
- test: --total-shards 3 --shard-index 2 --exclude-tags=extension
5046
sdk:
5147
- dev
52-
- main
5348
os:
5449
- linux
5550
- windows

Diff for: dwds/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dwds
22
# Every time this changes you need to run `dart run build_runner build`.
3-
version: 22.1.0
3+
version: 22.1.0+1
44
description: >-
55
A service that proxies between the Chrome debug protocol and the Dart VM
66
service protocol.

Diff for: dwds/test/inspector_test.dart

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:dwds/src/debugging/inspector.dart';
1111
import 'package:dwds/src/utilities/conversions.dart';
1212
import 'package:test/test.dart';
1313
import 'package:test_common/test_sdk_configuration.dart';
14+
import 'package:test_common/utilities.dart';
1415
import 'package:vm_service/vm_service.dart';
1516
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
1617

@@ -160,6 +161,10 @@ void main() {
160161
final names =
161162
properties.map((p) => p.name).where((x) => x != '__proto__').toList();
162163
final expected = [
164+
if (dartSdkIsAtLeast(
165+
newDdcTypeSystemVersion,
166+
))
167+
'\$ti',
163168
'_privateField',
164169
'abstractField',
165170
'closure',

Diff for: dwds/test/instances/class_inspection_test.dart

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// Copyright (c) 2023, 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+
@Tags(['daily'])
6+
@TestOn('vm')
7+
@Timeout(Duration(minutes: 2))
8+
9+
import 'package:test/test.dart';
10+
import 'package:test_common/logging.dart';
11+
import 'package:test_common/test_sdk_configuration.dart';
12+
import 'package:vm_service/vm_service.dart';
13+
14+
import '../fixtures/context.dart';
15+
import '../fixtures/project.dart';
16+
import 'common/test_inspector.dart';
17+
18+
void main() {
19+
// Enable verbose logging for debugging.
20+
final debug = false;
21+
22+
final provider = TestSdkConfigurationProvider(
23+
verbose: debug,
24+
);
25+
26+
final context =
27+
TestContext(TestProject.testExperimentWithSoundNullSafety, provider);
28+
final testInspector = TestInspector(context);
29+
30+
late VmService service;
31+
late Stream<Event> stream;
32+
late String isolateId;
33+
late ScriptRef mainScript;
34+
35+
onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
36+
stream,
37+
isolateId,
38+
mainScript,
39+
breakPointId,
40+
body,
41+
);
42+
43+
getObject(instanceId) => service.getObject(isolateId, instanceId);
44+
45+
group('Class |', () {
46+
tearDownAll(provider.dispose);
47+
48+
for (var compilationMode in CompilationMode.values) {
49+
group('$compilationMode |', () {
50+
setUpAll(() async {
51+
setCurrentLogWriter(debug: debug);
52+
await context.setUp(
53+
compilationMode: compilationMode,
54+
enableExpressionEvaluation: true,
55+
verboseCompiler: debug,
56+
);
57+
service = context.debugConnection.vmService;
58+
59+
final vm = await service.getVM();
60+
isolateId = vm.isolates!.first.id!;
61+
final scripts = await service.getScripts(isolateId);
62+
63+
await service.streamListen('Debug');
64+
stream = service.onEvent('Debug');
65+
66+
mainScript = scripts.scripts!
67+
.firstWhere((each) => each.uri!.contains('main.dart'));
68+
});
69+
70+
tearDownAll(() async {
71+
await context.tearDown();
72+
});
73+
74+
setUp(() => setCurrentLogWriter(debug: debug));
75+
tearDown(() => service.resume(isolateId));
76+
77+
group('calling getObject for an existent class', () {
78+
test('returns the correct class representation', () async {
79+
await onBreakPoint('testClass1Case1', (event) async {
80+
// classes|dart:core|Object_Diagnosticable
81+
final result = await getObject(
82+
'classes|org-dartlang-app:///web/main.dart|GreeterClass',
83+
);
84+
final clazz = result as Class?;
85+
expect(clazz!.name, equals('GreeterClass'));
86+
expect(
87+
clazz.fields!.map((field) => field.name),
88+
unorderedEquals([
89+
'greeteeName',
90+
'useFrench',
91+
]),
92+
);
93+
expect(
94+
clazz.functions!.map((fn) => fn.name),
95+
containsAll([
96+
'sayHello',
97+
'greetInEnglish',
98+
'greetInFrench',
99+
]),
100+
);
101+
});
102+
});
103+
});
104+
105+
group('calling getObject for a non-existent class', () {
106+
// TODO(https://github.com/dart-lang/webdev/issues/2297): Ideally we
107+
// should throw an error in this case for the client to catch instead
108+
// of returning an empty class.
109+
test('returns an empty class representation', () async {
110+
await onBreakPoint('testClass1Case1', (event) async {
111+
final result = await getObject(
112+
'classes|dart:core|Object_Diagnosticable',
113+
);
114+
final clazz = result as Class?;
115+
expect(clazz!.name, equals('Object_Diagnosticable'));
116+
expect(clazz.fields, isEmpty);
117+
expect(clazz.functions, isEmpty);
118+
});
119+
});
120+
});
121+
});
122+
}
123+
});
124+
}

Diff for: dwds/test/instances/common/instance_common.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:dwds/src/debugging/inspector.dart';
77
import 'package:test/test.dart';
88
import 'package:test_common/logging.dart';
99
import 'package:test_common/test_sdk_configuration.dart';
10+
import 'package:test_common/utilities.dart';
1011
import 'package:vm_service/vm_service.dart';
1112
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
1213

@@ -73,7 +74,12 @@ void runTypeSystemVerificationTests({
7374
);
7475
expect(
7576
remoteObject.json['className'],
76-
canaryFeatures ? 'dart_rti.Rti.new' : 'Function',
77+
canaryFeatures ||
78+
dartSdkIsAtLeast(
79+
newDdcTypeSystemVersion,
80+
)
81+
? 'dart_rti.Rti.new'
82+
: 'Function',
7783
);
7884
});
7985
});

Diff for: dwds/test/variable_scope_test.dart

+22-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:dwds/src/services/chrome_proxy_service.dart';
99
import 'package:test/test.dart';
1010
import 'package:test_common/logging.dart';
1111
import 'package:test_common/test_sdk_configuration.dart';
12+
import 'package:test_common/utilities.dart';
1213
import 'package:vm_service/vm_service.dart';
1314

1415
import 'fixtures/context.dart';
@@ -203,7 +204,18 @@ void main() {
203204
final variableNames = variables.keys.toList()..sort();
204205
expect(
205206
variableNames,
206-
['closureLocalInsideMethod', 'local', 'parameter', 'this'],
207+
[
208+
// TODO(https://github.com/dart-lang/webdev/issues/2316): Make sure T
209+
// doesn't show up here.
210+
if (dartSdkIsAtLeast(
211+
newDdcTypeSystemVersion,
212+
))
213+
'T',
214+
'closureLocalInsideMethod',
215+
'local',
216+
'parameter',
217+
'this',
218+
],
207219
);
208220
});
209221

@@ -213,7 +225,15 @@ void main() {
213225
await expectDartVariables(variables);
214226

215227
final variableNames = variables.keys.toList()..sort();
216-
expect(variableNames, ['this']);
228+
expect(variableNames, [
229+
// TODO(https://github.com/dart-lang/webdev/issues/2316): Make sure T
230+
// doesn't show up here.
231+
if (dartSdkIsAtLeast(
232+
newDdcTypeSystemVersion,
233+
))
234+
'T',
235+
'this',
236+
]);
217237
});
218238

219239
test('variables in extension method', () async {

Diff for: fixtures/_experimentSound/web/main.dart

+29
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ void main() {
2020
testPattern([3.14, 'b']);
2121
testPattern([0, 1]);
2222
testPattern2();
23+
print('Classes');
24+
testClass();
2325
});
2426

2527
document.body!.appendText('Program is running!');
@@ -55,6 +57,11 @@ void printNestedNamedLocalRecord() {
5557
print(record); // Breakpoint: printNestedNamedLocalRecord
5658
}
5759

60+
void testClass() {
61+
final greeter = GreeterClass(greeteeName: 'Charlie Brown');
62+
greeter.sayHello();
63+
}
64+
5865
String testPattern(Object obj) {
5966
switch (obj) {
6067
case [var a, int n] || [int n, var a] when n == 1 && a is String:
@@ -73,3 +80,25 @@ String testPattern2() {
7380
print(firstCat); // Breakpoint: testPattern2Case2
7481
return '$dog, $firstCat, $secondCat';
7582
}
83+
84+
class GreeterClass {
85+
final String greeteeName;
86+
final bool useFrench;
87+
88+
GreeterClass({
89+
this.greeteeName = 'Snoopy',
90+
this.useFrench = false,
91+
});
92+
93+
void sayHello() {
94+
useFrench ? greetInFrench() : greetInEnglish();
95+
}
96+
97+
void greetInEnglish() {
98+
print('Hello $greeteeName'); // Breakpoint: testClass1Case1
99+
}
100+
101+
void greetInFrench() {
102+
print('Bonjour $greeteeName');
103+
}
104+
}

Diff for: frontend_server_client/test/frontend_sever_client_test.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ String get message => p.join('hello', 'world');
111111

112112
expect(await stdoutLines.next, p.join('goodbye', 'world'));
113113
expect(await process.exitCode, 0);
114-
});
114+
// TODO(https://github.com/dart-lang/webdev/issues/2315): Fix and re-enable.
115+
}, skip: true);
115116

116117
test('can handle compile errors and reload fixes', () async {
117118
var entrypoint = p.join(packageRoot, 'bin', 'main.dart');
@@ -174,7 +175,8 @@ String get message => p.join('hello', 'world');
174175

175176
expect(await stdoutLines.next, p.join('goodbye', 'world'));
176177
expect(await process.exitCode, 0);
177-
});
178+
// TODO(https://github.com/dart-lang/webdev/issues/2315): Fix and re-enable.
179+
}, skip: true);
178180

179181
test('can compile and recompile a dartdevc app', () async {
180182
var entrypoint =

0 commit comments

Comments
 (0)