Skip to content

CFE produces the following error in flutter code when constant_update_2018 flag is turned on #36564

@a-siva

Description

@a-siva

Turning on constant_update_2018 flag and running flutter tests produces the following error:

Compiler message:
file:///usr/local/google/home/asiva/workspace/flutter-roll/flutter/packages/flut
ter/lib/src/painting/flutter_logo.dart:56:26: Error: Binary operator '=='
requires receiver constant 'FlutterLogoStyle {index: 0, #lib1::_name:
"FlutterLogoStyle.markOnly"}' of type 'Null', 'bool', 'int', 'double', or
'String', but was of type 'FlutterLogoStyle'.
 - 'FlutterLogoStyle' is from 'package:flutter/src/painting/flutter_logo.dart'
 ('file:///usr/local/google/home/asiva/workspace/flutter-roll/flutter/packages/f
 lutter/lib/src/painting/flutter_logo.dart').
       _position = style == FlutterLogoStyle.markOnly ? 0.0 : style ==
       FlutterLogoStyle.horizontal ? 1.0 : -1.0, // ignore:
       CONST_EVAL_TYPE_BOOL_NUM_STRING

The relevant code is as follows:

import 'dart:math' as math;
import 'dart:typed_data';
import 'dart:ui' as ui show Gradient, TextBox, lerpDouble;

import 'package:flutter/foundation.dart';

import 'alignment.dart';
import 'basic_types.dart';
import 'box_fit.dart';
import 'decoration.dart';
import 'edge_insets.dart';
import 'image_provider.dart';
import 'text_painter.dart';
import 'text_span.dart';
import 'text_style.dart';

/// Possible ways to draw Flutter's logo.
enum FlutterLogoStyle {
  /// Show only Flutter's logo, not the "Flutter" label.
  ///
  /// This is the default behavior for [FlutterLogoDecoration] objects.
  markOnly,

  /// Show Flutter's logo on the left, and the "Flutter" label to its right.
  horizontal,

  /// Show Flutter's logo above the "Flutter" label.
  stacked,
}

/// An immutable description of how to paint Flutter's logo.
class FlutterLogoDecoration extends Decoration {
  /// Creates a decoration that knows how to paint Flutter's logo.
  ///
  /// The [lightColor] and [darkColor] are used to fill the logo. The [style]
  /// controls whether and where to draw the "Flutter" label. If one is shown,
  /// the [textColor] controls the color of the label.
  ///
  /// The [lightColor], [darkColor], [textColor], [style], and [margin]
  /// arguments must not be null.
  const FlutterLogoDecoration({
    this.lightColor = const Color(0xFF42A5F5), // Colors.blue[400]
    this.darkColor = const Color(0xFF0D47A1), // Colors.blue[900]
    this.textColor = const Color(0xFF616161),
    this.style = FlutterLogoStyle.markOnly,
    this.margin = EdgeInsets.zero,
  }) : assert(lightColor != null),
       assert(darkColor != null),
       assert(textColor != null),
       assert(style != null),
       assert(margin != null),
       _position = style == FlutterLogoStyle.markOnly ? 0.0 : style == FlutterLo
goStyle.horizontal ? 1.0 : -1.0, // ignore: CONST_EVAL_TYPE_BOOL_NUM_STRING
       // (see https://github.com/dart-lang/sdk/issues/26980 for details about t
hat ignore statement)
       _opacity = 1.0;

  const FlutterLogoDecoration._(this.lightColor, this.darkColor, this.textColor,
 this.style, this.margin, this._position, this._opacity);
 ................
 ................
   /// Whether and where to draw the "Flutter" text. By default, only the logo
  /// itself is drawn.
  // This property isn't actually used when painting. It's only really used to
  // set the internal _position property.
  final FlutterLogoStyle style;
  ..................
  ..................
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1A high priority bug; for example, a single project is unusable or has many test failureslegacy-area-front-endLegacy: Use area-dart-model instead.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions