Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit b528ff4

Browse files
committed
Fix the remaining strong mode warnings.
These ones require explicit casts to work around limitations in some SDK methods and expectAsync() in test. Ideally, we will change those APIs to be more soundly typed. Until then, this gets the package clean. [email protected] Review URL: https://codereview.chromium.org//1871763002 .
1 parent d507b84 commit b528ff4

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.5
2+
3+
* Really fix strong mode warnings.
4+
15
## 1.6.4
26

37
* Fix a syntax error introduced in 1.6.3.

lib/src/chain.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class Chain implements StackTrace {
7878
};
7979
}
8080

81-
return runZoned(callback, onError: newOnError);
81+
// TODO(rnystrom): Remove this cast if runZoned() gets a generic type.
82+
return runZoned(callback, onError: newOnError) as dynamic/*=T*/;
8283
}
8384

8485
var spec = new StackZoneSpecification(onError);
@@ -91,7 +92,8 @@ class Chain implements StackTrace {
9192
}
9293
}, zoneSpecification: spec.toSpec(), zoneValues: {
9394
#stack_trace.stack_zone.spec: spec
94-
});
95+
}) as dynamic/*=T*/;
96+
// TODO(rnystrom): Remove this cast if runZoned() gets a generic type.
9597
}
9698

9799
/// Returns [futureOrStream] unmodified.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: stack_trace
77
#
88
# When the major version is upgraded, you *must* update that version constraint
99
# in pub to stay in sync with this.
10-
version: 1.6.4
10+
version: 1.6.5
1111
author: "Dart Team <[email protected]>"
1212
homepage: http://github.com/dart-lang/stack_trace
1313
description: >

test/chain/chain_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import 'package:test/test.dart';
1010

1111
import 'utils.dart';
1212

13+
typedef void ChainErrorCallback(stack, Chain chain);
14+
1315
void main() {
1416
group('Chain.parse()', () {
1517
test('parses a real Chain', () {
@@ -48,7 +50,8 @@ void main() {
4850
}, onError: expectAsync((error, chain) {
4951
expect(error, equals("oh no"));
5052
expect(chain, new isInstanceOf<Chain>());
51-
}), when: false);
53+
}) as ChainErrorCallback, when: false);
54+
// TODO(rnystrom): Remove this cast if expectAsync() gets a better type.
5255
});
5356
});
5457

test/chain/utils.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ Future<Chain> chainForTrace(asyncFn(callback()), callback()) {
7373
new Future.value().then((_) => callback())
7474
.catchError(completer.completeError);
7575
});
76+
77+
// TODO(rnystrom): Remove this cast if catchError() gets a better type.
7678
return completer.future
77-
.catchError((_, stackTrace) => new Chain.forTrace(stackTrace));
79+
.catchError((_, stackTrace) => new Chain.forTrace(stackTrace))
80+
as Future<Chain>;
7881
}
7982

8083
/// Runs [callback] in a [Chain.capture] zone and returns a Future that

0 commit comments

Comments
 (0)