Skip to content

Commit 50be4c5

Browse files
author
Jennifer Messerly
authored
Update CHANGELOG.md (#29183)
1 parent ec8e9f8 commit 50be4c5

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,56 @@
2525
characters to the console on Windows. Calls to `Stdout.add*()` behave as
2626
before.
2727

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+
2878
### Tool changes
2979
3080
* Analysis

0 commit comments

Comments
 (0)