From a43650e7474b7af139ae21402f3ae5e44e9ba1c0 Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Mon, 25 Aug 2025 11:53:58 +0000 Subject: [PATCH] Add test for dot shorthands in constant initializers --- test/dot_shorthands_test.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/dot_shorthands_test.dart b/test/dot_shorthands_test.dart index 5b236cb719..76d3efb29f 100644 --- a/test/dot_shorthands_test.dart +++ b/test/dot_shorthands_test.dart @@ -114,4 +114,18 @@ void m(){} expect(m.hasAnnotations, true); } + + void test_doc_dot_shorthand_const_init_success() async { + // Constant initializers are not linked so this test is just to make sure we + // don't crash. + var library = await bootPackageWithLibrary(''' +enum Color { + red, green +} +const Color favColor = .green; +'''); + var m = library.constants.named('favColor'); + + expect(m.hasDocumentation, false); + } }