File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 25
25
characters to the console on Windows. Calls to ` Stdout.add*() ` behave as
26
26
before.
27
27
28
+ ### Strong Mode
29
+
30
+ * Strong mode will prefer the expected type to infer generic types,
31
+ functions, and methods
32
+ (SDK issue [ 27586] ( https://github.com/dart-lang/sdk/issues/27586 ) ).
33
+
34
+ ``` dart
35
+ main() {
36
+ List<Object> foo = /*infers: <Object>*/['hello', 'world'];
37
+ var bar = /*infers: <String>*/['hello', 'world'];
38
+ }
39
+ ```
40
+
41
+ * Strong mode inference error messages are improved
42
+ (SDK issue [ 29108] ( https://github.com/dart-lang/sdk/issues/29108 ) ).
43
+
44
+ ``` dart
45
+ import 'dart:math';
46
+ test(Iterable/* fix is to add <num> here */ values) {
47
+ num n = values.fold(values.first as num, max);
48
+ }
49
+ ```
50
+ Now produces the error on the generic function "max":
51
+ ```
52
+ Couldn't infer type parameter 'T'.
53
+
54
+ Tried to infer 'dynamic' for 'T' which doesn't work:
55
+ Function type declared as '<T extends num>(T, T) → T'
56
+ used where '(num, dynamic) → num' is required.
57
+
58
+ Consider passing explicit type argument(s) to the generic.
59
+ ```
60
+
61
+ * Strong mode supports overriding fields, ` @virtual ` is no longer required
62
+ (SDK issue [ 28120] ( https://github.com/dart-lang/sdk/issues/28120 ) ).
63
+
64
+ ``` dart
65
+ class C {
66
+ int x = 42;
67
+ }
68
+ class D extends C {
69
+ int x = 123;
70
+ get y => super.x;
71
+ }
72
+ main() {
73
+ print(new D().x);
74
+ print(new D().y);
75
+ }
76
+ ```
77
+
28
78
### Tool changes
29
79
30
80
* Analysis
You can’t perform that action at this time.
0 commit comments