Skip to content
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

ternary expression behaviour differs in debug mode from profile mode or release mode #98967

Closed
Kylin3216 opened this issue Feb 23, 2022 · 11 comments
Assignees
Labels
a: release Challenges faced when attempting to productionize an app c: regression It was better in the past than it is now dependency: dart Dart team may need to help us found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on r: fixed Issue is closed as already fixed in a newer version

Comments

@Kylin3216
Copy link

Kylin3216 commented Feb 23, 2022

Bug Description

the value of the '_selectedIndex != null ? _selectedIndex == index : false' is same with '_selectedIndex==index' in debug mode but different in profile or release mode.

Flutter Version

Flutter 2.10.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 097d3313d8 (4 days ago) • 2022-02-18 19:33:08 -0600
Engine • revision a83ed0e5e3
Tools • Dart 2.16.1 • DevTools 2.9.2

Steps to Reproduce

  • flutter run
    the expr _selectedIndex != null ? _selectedIndex == index : false is equal to _selectedIndex==index
  • flutter run --profile or flutter run --release
    the expr _selectedIndex != null ? _selectedIndex == index : false is always false
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int? _selectedIndex;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Bug Test")),
      body: Column(
        children: [
          const Padding(
              padding: EdgeInsets.all(20),
              child: Text(
                "the value of the '_selectedIndex != null ? _selectedIndex == index : false'   is same with '_selectedIndex==index' in debug mode but different in profile or release mode",
                style: TextStyle(fontSize: 16),
              )),
          Expanded(
              child: ListView.builder(
                  itemCount: 2,
                  itemBuilder: (context, index) {
                    return ListTile(
                      onTap: () {
                        setState(() => _selectedIndex = index);
                      },
                      //_selectedIndex != null ? _selectedIndex == index : false
                      title: Text(
                          "selected:${_selectedIndex != null ? _selectedIndex == index : false}"),
                      //_selectedIndex == index
                      subtitle: Text("selected:${_selectedIndex == index}"),
                    );
                  }))        ],
      ),
    );
  }
}
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Feb 23, 2022
@danagbemava-nc
Copy link
Member

Hi @Kylin3216, thanks for reporting this.

What platforms did you experience this issue with?

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 23, 2022
@ToniHeiss
Copy link

ToniHeiss commented Feb 23, 2022

@Kylin3216

"selected:${_selectedIndex != null ? _selectedIndex **!** == index : false}"
Added a '!' after _selectedIndex, seems to work. Maybe that helps in debugging the problem for the Flutter-Team.

Platform was Android for me.

@ToniHeiss
Copy link

Code sample
import 'dart:developer';
import 'dart:math';

import 'package:flutter/material.dart';

class MyAppTernary extends StatelessWidget {
  const MyAppTernary({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePageTernary(),
    );
  }
}

class MyHomePageTernary extends StatefulWidget {
  const MyHomePageTernary({Key? key}) : super(key: key);

  @override
  State<MyHomePageTernary> createState() => _MyHomePageTernaryState();
}

class _MyHomePageTernaryState extends State<MyHomePageTernary> {
  int? _selectedIndex;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Bug Test")),
      body: Column(
        children: [
          const Padding(
              padding: EdgeInsets.all(20),
              child: Text(
                "the value of the '_selectedIndex != null ? _selectedIndex == index : false'   is same with '_selectedIndex==index' in debug mode but different in profile or release mode",
                style: TextStyle(fontSize: 16),
              )),
          Expanded(
            child: ListView.builder(
              itemCount: 2,
              itemBuilder: (context, index) {
                String sText;

                if (_selectedIndex != null) {
                  // Comment in anything and the bug goes away.
                  //print("");
                  //int x = 1 + Random().nextInt(10);
                  sText = "selected:${_selectedIndex == index}";
                } else {
                  sText = "selected:false";
                }

                return ListTile(
                  onTap: () {
                    setState(() => _selectedIndex = index);
                  },
                  //_selectedIndex != null ? _selectedIndex == index : false
                  title: Text(sText),
                  //_selectedIndex == index
                  subtitle: Text("selected:${_selectedIndex == index}"),
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}

This produces the same bug. So it does not depend on it beeing a ternary expression.

@jason-simmons
Copy link
Member

Confirmed that this is reproducible on the current Flutter master branch.

It looks like this is not a recent regression.

@mraleph

@jason-simmons jason-simmons added the dependency: dart Dart team may need to help us label Feb 24, 2022
@Kylin3216
Copy link
Author

@danagbemava-nc
i test it on ios and android, both have this bug.
when i downgrade flutter to version 2.8.1 ,the bug disapear.
so this bug belongs to flutter version since 2.10.1

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 24, 2022
@Kylin3216
Copy link
Author

@ToniHeiss
that's it,maybe it is caused by the update of nullsafety in dart 2.16,
because this code works well on flutter 2.8.1

@mraleph
Copy link
Member

mraleph commented Feb 24, 2022

It's a bug in compiling comparisons, more specifically when optimising null aware comparison to null unaware. We make this decision in the canonicalisation pass but don't take into account that this can change input representation requirements from tagged to unboxed. If such canonicalisation happens late in the compilation (after SelectRepresentation has already been run) then we will fail to insert appropriate conversions.

This happens to work almost okay on 64-bit platforms because most values are Smis and 64-bit values fit into 1 register. But on 32-bit ARM this generates the code which almost always returns wrong result.

Dart standalone repro
import 'package:expect/expect.dart';

class C {
  int? val;

  @pragma('vm:never-inline')
  void testImpl(bool Function(int) compare) {
    for (var i = 0; i < 2; i++) {
      Expect.equals(false, compare(i));
      val = i;
      Expect.equals(true, compare(i));
    }

    final mint0 = int.parse("7fffffffffffffff", radix: 16);
    final mint1 = int.parse("7fffffffffffffff", radix: 16);
    if (mint0 != mint1) throw 'This is the same mint value';

    Expect.equals(false, compare(mint0));
    val = mint0;
    Expect.equals(true, compare(mint0));
    Expect.equals(true, compare(mint1),
        'expected two different mints with the same value compare equal');
  }

  @pragma('vm:never-inline')
  static void blackhole(void Function() f) {
    f();
  }

  void test() {
    return testImpl((v) {
      // Note: need multiple context levels in the chain to delay
      // optimizer forwarding load of [val] and subsequently
      // clearing null_aware flag on the equality comparison.
      // Hence the closure capturing [v] below.
      final result = val != null ? val == v : false;
      blackhole(() => v);
      return result;
    });
  }
}

void main() {
  C().test();
}

@alexmarkov could you take a look at this?

@alexmarkov alexmarkov self-assigned this Feb 24, 2022
@alexmarkov
Copy link
Contributor

Thank you for the repro!

This bug is similar to dart-lang/sdk#45384 which stopped reproducing at some point.
The fix is on the way: https://dart-review.googlesource.com/c/sdk/+/234324.

@danagbemava-nc
Copy link
Member

Reproducible on stable 2.10.2 and master.
In my tests, this only reproduced on android and iOS.

I was not able to reproduce this on either macOS or chrome.
In my testing, on stable 2.8.1 it didn't reproduce in iOS but it did on android

videos
macOS web android ios(2.10.2+) ios(2.8.1)
Screen.Recording.2022-02-25.at.06.54.15.mov
Screen.Recording.2022-02-25.at.06.55.49.mov
Screen.Recording.2022-02-25.at.07.12.32.mov
RPReplay_Final1645772665.MP4
RPReplay_Final1645772804.MP4
flutter doctor -v
[✓] Flutter (Channel unknown, 2.8.1, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.8.1 at /Users/nexus/dev/sdks/flutter_rc/flutter
    • Upstream repository unknown
    • Framework revision 77d935af4d (2 months ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1428:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1863:10)
      #15     runZonedGuarded (dart:async/zone.dart:1851:12)
      #16     runZoned (dart:async/zone.dart:1782:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1290:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (5 available)
    • M2007J20CG (mobile)         • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 12 (API 31) (emulator)
    • Nexus (mobile)              • 00008020-001875E83A38002E • ios            • iOS 15.3 19D50
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 98.0.4758.109

! Doctor found issues in 1 category.
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.10.2 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (6 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:205:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:309:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (5 available)
    • M2007J20CG (mobile)         • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 12 (API 31) (emulator)
    • Nexus (mobile)              • 00008020-001875E83A38002E • ios            • iOS 15.3 19D50
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 98.0.4758.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.11.0-0.0.pre.681, on macOS 12.2 21D49 darwin-arm, locale en-GB)
    • Flutter version 2.11.0-0.0.pre.681 at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a288bd5e3f (2 hours ago), 2022-02-24 23:06:19 -0600
    • Engine revision 1012ac4b5a
    • Dart version 2.17.0 (build 2.17.0-141.0.dev)
    • DevTools version 2.11.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 213.5744.122

[✓] VS Code (version 1.64.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (5 available)
    • M2007J20CG (mobile)         • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 12 (API 31) (emulator)
    • Nexus (mobile)              • 00008020-001875E83A38002E • ios            • iOS 15.3 19D50
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 98.0.4758.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@danagbemava-nc danagbemava-nc added a: release Challenges faced when attempting to productionize an app found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on c: regression It was better in the past than it is now and removed in triage Presently being triaged by the triage team labels Feb 25, 2022
@danagbemava-nc danagbemava-nc changed the title ternary expression behaviors different in debug mode with profile mode or release mode ternary expression behaviour differs in debug mode from profile mode or release mode Feb 25, 2022
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Feb 25, 2022
…presentations pass

Before this fix, Canonicalize pass could change representation
of inputs of EqualityCompare after the last SelectRepresentations
pass. This results in unmatched representations and invalid code
generated.

The fix is to disallow canonicalization of EqualityCompare
from null-aware to non-null-aware after the last SelectRepresentations.

TEST=vm/dart/regress_flutter98967_test
Fixes flutter/flutter#98967

Change-Id: I05359737fe322fbb2a0fe6025e3716ba5d04ebbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234324
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
@alexmarkov
Copy link
Contributor

The fix was rolled into Flutter in 38455c5.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
@danagbemava-nc danagbemava-nc added the r: fixed Issue is closed as already fixed in a newer version label Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: release Challenges faced when attempting to productionize an app c: regression It was better in the past than it is now dependency: dart Dart team may need to help us found in release: 2.10 Found to occur in 2.10 found in release: 2.11 Found to occur in 2.11 has reproducible steps The issue has been confirmed reproducible and is ready to work on r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

No branches or pull requests

6 participants