[cfe] Add test for flutter issue 100888

Add test that show that the compile-time error is correctly emitted.

This issue was fixed by https://dart-review.googlesource.com/c/sdk/+/236540

Change-Id: Ic56fcd584a32d38aa9f73a28ff5237341193b14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253760
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 8dace5e..965a21c 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -16,6 +16,7 @@
 adaptor
 adopted
 advantages
+af
 albeit
 aligns
 allocations
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart b/pkg/front_end/testcases/general/flutter_issue100888.dart
new file mode 100644
index 0000000..d060a50
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+abstract class ChannelA {
+  ChannelB? get channel;
+}
+
+abstract class ChannelB {
+  ActiveFrom? get activeFrom;
+}
+
+abstract class ActiveFrom {
+  DateTime toLocal();
+}
+
+void method(ChannelA channel) {
+  DateTime? af = channel.channel?.activeFrom != null ? DateTime(
+      channel.channel!.activeFrom!.toLocal().year,
+      channel.channel!.activeFrom!.toLocal().month,
+      channel.channel!.activeFrom!.toLocal().day);
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline.expect
new file mode 100644
index 0000000..9eda554
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline.expect
@@ -0,0 +1,13 @@
+abstract class ChannelA {
+  ChannelB? get channel;
+}
+
+abstract class ChannelB {
+  ActiveFrom? get activeFrom;
+}
+
+abstract class ActiveFrom {
+  DateTime toLocal();
+}
+
+void method(ChannelA channel) {}
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..3a41dbe
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.textual_outline_modelled.expect
@@ -0,0 +1,13 @@
+abstract class ActiveFrom {
+  DateTime toLocal();
+}
+
+abstract class ChannelA {
+  ChannelB? get channel;
+}
+
+abstract class ChannelB {
+  ActiveFrom? get activeFrom;
+}
+
+void method(ChannelA channel) {}
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.expect
new file mode 100644
index 0000000..4ad72b5
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.expect
@@ -0,0 +1,39 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'.
+// Try inserting an identifier before ';'.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class ChannelA extends core::Object {
+  synthetic constructor •() → self::ChannelA
+    : super core::Object::•()
+    ;
+  abstract get channel() → self::ChannelB?;
+}
+abstract class ChannelB extends core::Object {
+  synthetic constructor •() → self::ChannelB
+    : super core::Object::•()
+    ;
+  abstract get activeFrom() → self::ActiveFrom?;
+}
+abstract class ActiveFrom extends core::Object {
+  synthetic constructor •() → self::ActiveFrom
+    : super core::Object::•()
+    ;
+  abstract method toLocal() → core::DateTime;
+}
+static method method(self::ChannelA channel) → void {
+  core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed.
+      channel.channel!.activeFrom!.toLocal().day);
+                                                 ^";
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.modular.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.modular.expect
new file mode 100644
index 0000000..4ad72b5
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.modular.expect
@@ -0,0 +1,39 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'.
+// Try inserting an identifier before ';'.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class ChannelA extends core::Object {
+  synthetic constructor •() → self::ChannelA
+    : super core::Object::•()
+    ;
+  abstract get channel() → self::ChannelB?;
+}
+abstract class ChannelB extends core::Object {
+  synthetic constructor •() → self::ChannelB
+    : super core::Object::•()
+    ;
+  abstract get activeFrom() → self::ActiveFrom?;
+}
+abstract class ActiveFrom extends core::Object {
+  synthetic constructor •() → self::ActiveFrom
+    : super core::Object::•()
+    ;
+  abstract method toLocal() → core::DateTime;
+}
+static method method(self::ChannelA channel) → void {
+  core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed.
+      channel.channel!.activeFrom!.toLocal().day);
+                                                 ^";
+}
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.outline.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.outline.expect
new file mode 100644
index 0000000..6888b0f
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.outline.expect
@@ -0,0 +1,21 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+abstract class ChannelA extends core::Object {
+  synthetic constructor •() → self::ChannelA
+    ;
+  abstract get channel() → self::ChannelB?;
+}
+abstract class ChannelB extends core::Object {
+  synthetic constructor •() → self::ChannelB
+    ;
+  abstract get activeFrom() → self::ActiveFrom?;
+}
+abstract class ActiveFrom extends core::Object {
+  synthetic constructor •() → self::ActiveFrom
+    ;
+  abstract method toLocal() → core::DateTime;
+}
+static method method(self::ChannelA channel) → void
+  ;
diff --git a/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.transformed.expect b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.transformed.expect
new file mode 100644
index 0000000..4ad72b5
--- /dev/null
+++ b/pkg/front_end/testcases/general/flutter_issue100888.dart.weak.transformed.expect
@@ -0,0 +1,39 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'.
+// Try inserting an identifier before ';'.
+//       channel.channel!.activeFrom!.toLocal().day);
+//                                                  ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class ChannelA extends core::Object {
+  synthetic constructor •() → self::ChannelA
+    : super core::Object::•()
+    ;
+  abstract get channel() → self::ChannelB?;
+}
+abstract class ChannelB extends core::Object {
+  synthetic constructor •() → self::ChannelB
+    : super core::Object::•()
+    ;
+  abstract get activeFrom() → self::ActiveFrom?;
+}
+abstract class ActiveFrom extends core::Object {
+  synthetic constructor •() → self::ActiveFrom
+    : super core::Object::•()
+    ;
+  abstract method toLocal() → core::DateTime;
+}
+static method method(self::ChannelA channel) → void {
+  core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed.
+      channel.channel!.activeFrom!.toLocal().day);
+                                                 ^";
+}