Repository: flutter
Issue: segmentation fault with crossed exports
Labels: a: tests,framework,dependency: dart,P2,team-framework,triaged-framework

While working on [exporting public API types from services/*.dart library](https://github.com/flutter/flutter/pull/106316) I faced a crash with segmentation fault related to mixed export. I managed to reduce the diff fo the PR to have a simpler reproduction I pasted below (I failed to reduce it only with dart).

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Checkout flutter main branch (on d4929bc828 for me)
2. Apply the following diff

```diff
diff --git a/packages/flutter/lib/src/services/autofill.dart b/packages/flutter/lib/src/services/autofill.dart
index 22cde8eb0b..e1791c0a3c 100644
--- a/packages/flutter/lib/src/services/autofill.dart
+++ b/packages/flutter/lib/src/services/autofill.dart
@@ -5,6 +5,8 @@
 import 'package:flutter/foundation.dart';
 import 'text_input.dart';
 
+export 'text_input.dart' show TextEditingValue;
+
 /// A collection of commonly used autofill hint strings on different platforms.
 ///
 /// Each hint is pre-defined on at least one supported platform. See their
diff --git a/packages/flutter/lib/src/services/text_editing_delta.dart b/packages/flutter/lib/src/services/text_editing_delta.dart
index 07e57e93c6..80079b3677 100644
--- a/packages/flutter/lib/src/services/text_editing_delta.dart
+++ b/packages/flutter/lib/src/services/text_editing_delta.dart
@@ -7,6 +7,8 @@ import 'package:flutter/foundation.dart';
 import 'text_editing.dart';
 import 'text_input.dart' show TextEditingValue;
 
+export 'text_input.dart' show TextEditingValue;
+
 TextAffinity? _toTextAffinity(String? affinity) {
   switch (affinity) {
     case 'TextAffinity.downstream':
diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart
index 85a3244107..7f98db51db 100644
--- a/packages/flutter/lib/src/services/text_input.dart
+++ b/packages/flutter/lib/src/services/text_input.dart
@@ -25,6 +25,9 @@ import 'text_editing_delta.dart';
 
 export 'dart:ui' show TextAffinity;
 
+export 'autofill.dart' show AutofillConfiguration;
+export 'text_editing_delta.dart' show TextEditingDelta;
+
 /// Indicates how to handle the intelligent replacement of dashes in text input.
 ///
 /// See also:
```
3. Create a new flutter project with `flutter create my_test`
4. Run tests via `flutter test`

**Expected results:** no errors

**Actual results:** 

<details>
<summary>Logs</summary>

```
~/tmp/my_test$ flutter test
00:02 +0: Counter increments smoke test                                            
unhandled error during finalization of test:
/home/xxx/tmp/my_test/test/widget_test.dart
TestDeviceException(Shell subprocess crashed with segmentation fault.)
#0      FlutterTesterTestDevice.finished
(package:flutter_tools/src/test/flutter_tester_device.dart:241:5)
<asynchronous suspension>
#1      FlutterTesterTestDevice.kill
(package:flutter_tools/src/test/flutter_tester_device.dart:223:5)
<asynchronous suspension>
#2      FlutterPlatform._startTest.<anonymous closure>
(package:flutter_tools/src/test/flutter_platform.dart:485:9)
<asynchronous suspension>
#3      FlutterPlatform._startTest
(package:flutter_tools/src/test/flutter_platform.dart:538:11)
<asynchronous suspension>


00:02 +0: Counter increments smoke test - did not complete [E]                     
00:02 +0: Some tests failed.                                                       
No tests were found.
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
~/tmp/my_test$ flutter analyze
Analyzing my_test...                                                    
No issues found! (ran in 2.7s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
~/tmp/my_test$ flutter doctor -v
[✓] Flutter (Channel master, 3.1.0-0.0.pre.1317, on Ubuntu 20.04.4 LTS
    5.4.0-120-generic, locale fr_FR.UTF-8)
    • Flutter version 3.1.0-0.0.pre.1317 on channel master at
      /home/xxx/PERSONNEL/dev/dart/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d4929bc828 (il y a 9 heures), 2022-06-20 20:09:05 -0400
    • Engine revision ceac23d7a9
    • Dart version 2.18.0 (build 2.18.0-190.0.dev)
    • DevTools version 2.14.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/xxx/softwares/android-sdk-linux/
    • Platform android-31, build-tools 30.0.3
    • ANDROID_HOME = /home/xxx/softwares/android-sdk-linux/
    • Java binary at: /home/xxx/softwares/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2020.3)
    • Android Studio at /home/xxx/softwares/android-studio
    • Flutter plugin version 61.0.2
    • Dart plugin version 203.8430
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at /home/xxx/softwares/jetbrains/idea-IC-203.7148.57
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.6912

[✓] VS Code (version 1.68.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS
      5.4.0-120-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.115

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>