Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit c8e1c02

Browse files
stereotype441stuartmorgan-g
authored andcommitted
Update code in preparation for the fix to dart-lang/language#1785 to roll out.
In short, this bug prevents implicitly typed condition variables from participating in type promotion in some circumstances (see the bug for more details). Since the bug only occurs when the condition variable is implicitly typed, we can ensure a smooth rollout by giving explicit `bool` types to the condition variables affected by this bug. Once the fix has fully rolled out to google3 we will be able to remove these explicit types once again. Tested: Some test failures are present, but the CL author has decided to mail the change anyway PiperOrigin-RevId: 394482159
1 parent 67b2f62 commit c8e1c02

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

charts_common/lib/src/chart/bar/base_bar_renderer.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,11 @@ abstract class BaseBarRenderer<D, R extends BaseBarRendererElement,
398398
final domainValue = domainFn(barIndex);
399399

400400
final measureValue = measureFn(barIndex);
401-
final measureIsNull = measureValue == null;
402-
final measureIsNegative = !measureIsNull && measureValue! < 0;
401+
// TODO: remove this explicit `bool` type when no longer
402+
// needed to work around
403+
// https://github.com/dart-lang/language/issues/1785
404+
final bool measureIsNull = measureValue == null;
405+
final measureIsNegative = !measureIsNull && measureValue < 0;
403406

404407
// Each bar should be stored in barStackMap in a structure that mirrors
405408
// the visual rendering of the bars. Thus, they should be grouped by

charts_common/lib/src/chart/common/behavior/selection/select_nearest.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ class SelectNearest<D> implements ChartBehavior<D> {
245245
final domainFn = series.domainFn;
246246
final domainLowerBoundFn = series.domainLowerBoundFn;
247247
final domainUpperBoundFn = series.domainUpperBoundFn;
248-
final testBounds =
248+
// TODO: remove this explicit `bool` type when no longer
249+
// needed to work around https://github.com/dart-lang/language/issues/1785
250+
final bool testBounds =
249251
domainLowerBoundFn != null && domainUpperBoundFn != null;
250252

251253
for (var i = 0; i < series.data.length; i++) {
@@ -260,8 +262,8 @@ class SelectNearest<D> implements ChartBehavior<D> {
260262
if (domain == nearestDomain) {
261263
data.add(SeriesDatum(series, datum));
262264
} else if (testBounds) {
263-
final domainLowerBound = domainLowerBoundFn!(i);
264-
final domainUpperBound = domainUpperBoundFn!(i);
265+
final domainLowerBound = domainLowerBoundFn(i);
266+
final domainUpperBound = domainUpperBoundFn(i);
265267

266268
var addDatum = false;
267269
if (domainLowerBound != null && domainUpperBound != null) {

0 commit comments

Comments
 (0)