Skip to content

Commit afac4fe

Browse files
authored
Remove superseded sound problems page (#6484)
Still relevant docs have been moved to other pages, including [The Dart type system](https://dart.dev/language/type-system), [Diagnostic messages](https://dart.dev/tools/diagnostic-messages), [Fixing type promotion failures](https://dart.dev/tools/non-promotion-reasons), and the [Glossary](https://dart.dev/resources/glossary). This PR removes the page now that the important topics are covered elsewhere and redirects links to the page to the type system page, which we plan to continue to expand and improve (#4745). Resolves #6265 Resolves #2579 _(by making it obsolete)_ Resolves #4393
1 parent 1ce099c commit afac4fe

File tree

9 files changed

+11
-728
lines changed

9 files changed

+11
-728
lines changed

examples/type_system/analyzer-results-beta.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ Analyzing type_system...
1717
error - lib/strong_analysis.dart:109:23 - A value of type 'String' can't be assigned to a variable of type 'double'. Try changing the type of the variable, or casting the right-hand type to 'double'. - invalid_assignment
1818
error - lib/strong_analysis.dart:121:19 - A value of type 'Cat' can't be assigned to a variable of type 'MaineCoon'. Try changing the type of the variable, or casting the right-hand type to 'MaineCoon'. - invalid_assignment
1919
error - lib/strong_analysis.dart:148:24 - A value of type 'List<Animal>' can't be assigned to a variable of type 'List<Cat>'. Try changing the type of the variable, or casting the right-hand type to 'List<Cat>'. - invalid_assignment
20-
error - test/strong_test.dart:120:26 - A value of type 'dynamic' can't be assigned to a variable of type 'List<String>'. Try changing the type of the variable, or casting the right-hand type to 'List<String>'. - invalid_assignment
2120

22-
16 issues found.
21+
15 issues found.

examples/type_system/analyzer-results-dev.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ Analyzing type_system...
1717
error - lib/strong_analysis.dart:109:23 - A value of type 'String' can't be assigned to a variable of type 'double'. Try changing the type of the variable, or casting the right-hand type to 'double'. - invalid_assignment
1818
error - lib/strong_analysis.dart:121:19 - A value of type 'Cat' can't be assigned to a variable of type 'MaineCoon'. Try changing the type of the variable, or casting the right-hand type to 'MaineCoon'. - invalid_assignment
1919
error - lib/strong_analysis.dart:148:24 - A value of type 'List<Animal>' can't be assigned to a variable of type 'List<Cat>'. Try changing the type of the variable, or casting the right-hand type to 'List<Cat>'. - invalid_assignment
20-
error - test/strong_test.dart:120:26 - A value of type 'dynamic' can't be assigned to a variable of type 'List<String>'. Try changing the type of the variable, or casting the right-hand type to 'List<String>'. - invalid_assignment
2120

22-
16 issues found.
21+
15 issues found.

examples/type_system/analyzer-results-stable.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ Analyzing type_system...
1717
error - lib/strong_analysis.dart:109:23 - A value of type 'String' can't be assigned to a variable of type 'double'. Try changing the type of the variable, or casting the right-hand type to 'double'. - invalid_assignment
1818
error - lib/strong_analysis.dart:121:19 - A value of type 'Cat' can't be assigned to a variable of type 'MaineCoon'. Try changing the type of the variable, or casting the right-hand type to 'MaineCoon'. - invalid_assignment
1919
error - lib/strong_analysis.dart:148:24 - A value of type 'List<Animal>' can't be assigned to a variable of type 'List<Cat>'. Try changing the type of the variable, or casting the right-hand type to 'List<Cat>'. - invalid_assignment
20-
error - test/strong_test.dart:120:26 - A value of type 'dynamic' can't be assigned to a variable of type 'List<String>'. Try changing the type of the variable, or casting the right-hand type to 'List<String>'. - invalid_assignment
2120

22-
16 issues found.
21+
15 issues found.
+1-89
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// ignore_for_file: unused_local_variable, strict_raw_type
1+
// ignore_for_file: unused_local_variable
22
import 'package:test/test.dart';
33

44
import 'package:type_system_examples/animal.dart';
5-
import 'package:type_system_examples/bounded/my_collection.dart';
65

76
Matcher _throwsA<T>(String msg) => throwsA(
87
allOf(TypeMatcher<T>(), predicate((e) => e.toString().contains(msg))),
@@ -36,92 +35,5 @@ void main() {
3635
const msg = "type 'List<Dog>' is not a subtype of type 'List<Cat>'";
3736
expect(main, _throwsA<TypeError>(msg));
3837
});
39-
40-
test('downcast check fails', () {
41-
void downcastCheck() {
42-
// #docregion fail-downcast-check
43-
assumeStrings(<int>[1, 2, 3]);
44-
// #enddocregion fail-downcast-check
45-
}
46-
47-
// #docregion downcast-check-msg
48-
const msg = "type 'List<int>' is not a subtype of type 'List<String>'";
49-
// #enddocregion downcast-check-msg
50-
expect(downcastCheck, _throwsA<TypeError>(msg));
51-
});
52-
53-
final expectedOutput = 'a string\n';
54-
55-
test('downcast check ok for <String>[]', () {
56-
void downcastCheck() {
57-
// #docregion typed-list-lit
58-
var list = <String>[];
59-
list.add('a string');
60-
list.add('another');
61-
assumeStrings(list);
62-
// #enddocregion typed-list-lit
63-
}
64-
65-
expect(downcastCheck, prints(expectedOutput));
66-
});
67-
68-
test('downcast check ok for List<String>', () {
69-
void downcastCheck() {
70-
// #docregion typed-list
71-
List<String> list = [];
72-
list.add('a string');
73-
list.add('another');
74-
assumeStrings(list);
75-
// #enddocregion typed-list
76-
}
77-
78-
expect(downcastCheck, prints(expectedOutput));
79-
});
80-
81-
Map<String, dynamic> fetchFromExternalSource() => {
82-
'names': ['a string'],
83-
};
84-
85-
test('downcast check ok: use cast()', () {
86-
void downcastCheck() {
87-
// #docregion cast
88-
Map<String, dynamic> json = fetchFromExternalSource();
89-
var names = json['names'] as List;
90-
assumeStrings(names.cast<String>());
91-
// #enddocregion cast
92-
}
93-
94-
expect(downcastCheck, prints(expectedOutput));
95-
});
96-
97-
test('instantiate-to-bound sanity', () {
98-
final b = B();
99-
expect(b.typeOfS, 'int');
100-
expect(b.typeOfT, 'dynamic');
101-
});
102-
103-
test('instantiate-to-bound fix: add type arg', () {
104-
// #docregion add-type-arg
105-
var c = C<List>([]).collection;
106-
c.add(2);
107-
// #enddocregion add-type-arg
108-
expect(c, [2]);
109-
});
11038
});
11139
}
112-
113-
// #docregion downcast-check
114-
void assumeStrings(dynamic objects) {
115-
// ignore: stable, beta, dev, invalid_assignment
116-
List<String> strings = objects; // Runtime downcast check
117-
String string = strings[0]; // Expect a String value
118-
// #enddocregion downcast-check
119-
print(string);
120-
// #docregion downcast-check
121-
}
122-
// #enddocregion downcast-check
123-
124-
class B<S extends int, T> {
125-
String get typeOfS => '$S';
126-
String get typeOfT => '$T';
127-
}

firebase.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
{ "source": "/dart-vm{,/**}", "destination": "/server", "type": 301 },
117117
{ "source": "/dart2js-reflection", "destination": "https://github.com/dart-lang/sdk/issues/21654", "type": 301 },
118118
{ "source": "/dartium{,/**}", "destination": "/tools#editors", "type": 301 },
119+
{ "source": "/deprecated/sound-problems", "destination": "/language/type-system", "type": 301 },
119120
{ "source": "/devices", "destination": "/overview#platform", "type": 301 },
120121
{ "source": "/dev{,/**}", "destination": "https://api.dart.dev/dev", "type": 301 },
121122
{ "source": "/diagnostics", "destination": "/tools/diagnostic-messages", "type": 301 },
@@ -217,7 +218,7 @@
217218
{ "source": "/guides/language/cheatsheet", "destination": "/language", "type": 301 },
218219
{ "source": "/guides/language/coming-from/js-to-dart", "destination": "/resources/coming-from/js-to-dart", "type": 301 },
219220
{ "source": "/guides/language/coming-from/swift-to-dart", "destination": "/resources/coming-from/swift-to-dart", "type": 301 },
220-
{ "source": "/guides/language/common-prob", "destination": "/deprecated/sound-problems", "type": 301 },
221+
{ "source": "/guides/language/common-prob", "destination": "/language/type-system", "type": 301 },
221222
{ "source": "/guides/language/concurrency", "destination": "/language/concurrency", "type": 301 },
222223
{ "source": "/guides/language/effective-dart", "destination": "/effective-dart", "type": 301 },
223224
{ "source": "/guides/language/effective-dart/:page*", "destination": "/effective-dart/:page*", "type": 301 },
@@ -229,7 +230,7 @@
229230
{ "source": "/guides/language/numbers", "destination": "/resources/language/number-representation", "type": 301 },
230231
{ "source": "/guides/language/sound-dart", "destination": "/language/type-system", "type": 301 },
231232
{ "source": "/guides/language/sound-faq", "destination": "/language/type-system", "type": 301 },
232-
{ "source": "/guides/language/sound-problems", "destination": "/deprecated/sound-problems", "type": 301 },
233+
{ "source": "/guides/language/sound-problems", "destination": "/language/type-system", "type": 301 },
233234
{ "source": "/guides/language/spec", "destination": "/resources/language/spec", "type": 301 },
234235
{ "source": "/guides/language/specifications", "destination": "/resources/language/spec", "type": 301 },
235236
{ "source": "/guides/language/specifications/:page*", "destination": "/resources/language/spec/versions/:page*", "type": 301 },

src/_data/sidenav.yml

-2
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@
317317
children:
318318
- title: Customizing static analysis
319319
permalink: /tools/analysis
320-
- title: Fixing common type problems
321-
permalink: /deprecated/sound-problems
322320
- title: Fixing type promotion failures
323321
permalink: /tools/non-promotion-reasons
324322
- title: Linter rules

0 commit comments

Comments
 (0)