-
Notifications
You must be signed in to change notification settings - Fork 16
AF-2971 Dart 2 compatibility #137
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
Conversation
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on HipChat: InfoSec Forum. |
@@ -32,8 +32,7 @@ class SampleSpan implements Span { | |||
this.references, | |||
DateTime startTime, | |||
Map<String, dynamic> tags, | |||
}) | |||
: this.startTime = startTime ?? new DateTime.now(), | |||
}) : this.startTime = startTime ?? new DateTime.now(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dart 2 formatter change
@@ -594,7 +594,7 @@ abstract class LifecycleModule extends SimpleModule with Disposable { | |||
]); | |||
} | |||
|
|||
Future pendingTransition; | |||
Future<Null> pendingTransition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to match the type signature of _suspend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is internal and not a public api change
@@ -661,7 +661,7 @@ abstract class LifecycleModule extends SimpleModule with Disposable { | |||
allowedStates: [LifecycleState.suspended, LifecycleState.suspending]); | |||
} | |||
|
|||
Future pendingTransition; | |||
Future<Null> pendingTransition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to match the type signature of _resume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also internal only. no public api change.
@@ -280,6 +282,8 @@ void expectInLifecycleState(LifecycleModule module, LifecycleState state) { | |||
} | |||
|
|||
Future<Null> gotoState(LifecycleModule module, LifecycleState state) async { | |||
// wait for next event loop. fixes sync-async in Dart 2 | |||
await new Future.value(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Workiva/app-frameworks want to take a look at these closely to determine if we're going to have a sync-async problem with lifecycle module or if it's just the tests and mocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, goto state is only used internally in tests, so I'm not too concerned about this one.
Codecov Report
@@ Coverage Diff @@
## master #137 +/- ##
=======================================
Coverage 96.82% 96.82%
=======================================
Files 4 4
Lines 346 346
=======================================
Hits 335 335
Misses 11 11
Continue to review full report at Codecov.
|
@@ -1,43 +1,6 @@ | |||
FROM google/dart:1.24.3 as build | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just let Travis CI run all the tests.
@@ -149,6 +149,7 @@ class TestLifecycleModule extends LifecycleModule { | |||
@override | |||
@protected | |||
Future<Null> onWillUnloadChildModule(LifecycleModule module) async { | |||
await new Future.value(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spot is a little more concerning because this may mean that it's possible for other consumers that are overriding one of these lifecycle methods may get a change in how lifecycle events are ordered due to sync-async. I think we can go ahead with this PR as is, but be aware that there may be a recommended migration step of putting a line like this in each overriden module lifecycle method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this await here .. the order that events are added to the tracking list of events is different than what the tests expect the order to be. This looks like:
00:05 +216 -1: [VM] test/lifecycle_module_test.dart: LifecycleModule with globalTracer with children unload should wait for in-progress child module loads [E]
Expected: [
'onWillLoadChildModule',
'willLoadChildModule',
'onShouldUnload',
'willUnload',
'onDidLoadChildModule',
'didLoadChildModule',
'onWillUnloadChildModule',
'willUnloadChildModule',
'onDidUnloadChildModule',
'didUnloadChildModule',
'onUnload',
'didUnload',
'onDispose'
]
Actual: [
'onWillLoadChildModule',
'willLoadChildModule',
'onShouldUnload',
'willUnload',
'onDidLoadChildModule',
'onWillUnloadChildModule',
'didLoadChildModule',
'willUnloadChildModule',
'onDidUnloadChildModule',
'didUnloadChildModule',
'onUnload',
'didUnload',
'onDispose'
]
Which: was 'onWillUnloadChildModule' instead of 'didLoadChildModule' at location [5]
package:test expect
test/lifecycle_module_test.dart 2236:11 runTests.<fn>.<fn>.<fn>.<fn>
QA +1
@Workiva/release-management-p |
Overview
Updates are needed to use this library under Dart 2
Changes
Testing