Skip to content

Update CHANGELOG.md for 1.23 strong mode changes #29183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,56 @@
characters to the console on Windows. Calls to `Stdout.add*()` behave as
before.

### Strong Mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last few releases has had these under the top ###Language section, with the individual changes then calling out if they are strong mode specific or not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe this is different as these are semantic changes to existing language constructs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that's a fair point! thoughts @leafpetersen ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, I had the same thought.


* Strong mode will prefer the expected type to infer generic types,
functions, and methods
(SDK issue [27586](https://github.com/dart-lang/sdk/issues/27586)).

```dart
main() {
List<Object> foo = /*infers: <Object>*/['hello', 'world'];
var bar = /*infers: <String>*/['hello', 'world'];
}
```

* Strong mode inference error messages are improved
(SDK issue [29108](https://github.com/dart-lang/sdk/issues/29108)).

```dart
import 'dart:math';
test(Iterable/* fix is to add <num> here */ values) {
num n = values.fold(values.first as num, max);
}
```
Now produces the error on the generic function "max":
```
Couldn't infer type parameter 'T'.

Tried to infer 'dynamic' for 'T' which doesn't work:
Function type declared as '<T extends num>(T, T) → T'
used where '(num, dynamic) → num' is required.

Consider passing explicit type argument(s) to the generic.
```

* Strong mode supports overriding fields, `@virtual` is no longer required
(SDK issue [28120](https://github.com/dart-lang/sdk/issues/28120)).

```dart
class C {
int x = 42;
}
class D extends C {
int x = 123;
get y => super.x;
}
main() {
print(new D().x);
print(new D().y);
}
```

### Tool changes

* Analysis
Expand Down