diff --git a/tests/modular/const_extension_type/def.dart b/tests/modular/const_extension_type/def.dart new file mode 100644 index 00000000000..c6b260186f7 --- /dev/null +++ b/tests/modular/const_extension_type/def.dart @@ -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) {} diff --git a/tests/modular/const_extension_type/main.dart b/tests/modular/const_extension_type/main.dart new file mode 100644 index 00000000000..d5c7f7939ae --- /dev/null +++ b/tests/modular/const_extension_type/main.dart @@ -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()); +} diff --git a/tests/modular/const_extension_type/modules.yaml b/tests/modular/const_extension_type/modules.yaml new file mode 100644 index 00000000000..e1daed834ae --- /dev/null +++ b/tests/modular/const_extension_type/modules.yaml @@ -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 \ No newline at end of file