[tests] Add repro for cross module constant

There is an issue with cross module constant extension types that causes
the CFE to crash.

Change-Id: Id6af3a5400e55ecb2534ce71a07c5c1ecb17a46f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335384
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Nicholas Shahan 2023-11-13 22:21:40 +00:00 committed by Commit Queue
parent 690b2ef0ca
commit 47b9e3e6df
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,7 @@
// Copyright (c) 2023, 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.
const val = ExtString('hello');
extension type const ExtString(String s) {}

View file

@ -0,0 +1,15 @@
// Copyright (c) 2023, 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.
import 'package:expect/expect.dart';
import 'def.dart';
main() {
ExtString x = val;
fn(x);
}
void fn(ExtString es) {
Expect.equals('hello', es.toString());
}

View file

@ -0,0 +1,10 @@
# Copyright (c) 2023, 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.
#
# A constant created with an extension type should be assignable to the same
# extension type in a different module.
dependencies:
main: [def, expect]
flags:
- inline-class