From 06b4ead193b25ea03c4130729ad62be13a532eb0 Mon Sep 17 00:00:00 2001 From: Robert Nystrom Date: Fri, 12 May 2023 17:57:46 +0000 Subject: [PATCH] [stable] Roll latest dart_style into the SDK. The fixes are: 1. Comments in switch expressions would force the next line to split: ``` // Before: return switch (level) { 0 => a, // Comment. 1 when flag => b, }; // After: return switch (level) { 0 => a, // Comment. 1 when flag => b, }; ``` 2. Method calls on split record literals split before the ".": ``` // Before: final a = ( element, element, ) .getter; // After: final a = ( element, element, ).getter; ``` 3. Change how parameter metadata is formatted: ``` // Before: function( @required int n, @deprecated('Some long deprecation string.') String s) { ... } // After: function( @required int n, @deprecated('Some long deprecation string.') String s) { ... } ``` This change also significantly improves performance in rare cases where a function has many parameters. Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/302500 Change-Id: I56cd6ceb81ad9c98ca7f5d34eea05ef5d29228fb Fixes: https://github.com/dart-lang/sdk/issues/52346 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302451 Reviewed-by: Alexander Thomas Commit-Queue: Bob Nystrom --- CHANGELOG.md | 10 ++++++++++ DEPS | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72a14f979aec..b2ab31cccacd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 3.0.1 + +### Tools + +#### Formatter + +- Don't indent parameters with metadata annotations. +- Don't split before `.` following a record literal. +- Don't split unnecessarily in switch expression cases following comments. + ## 3.0.0 - 2023-05-10 ### Language diff --git a/DEPS b/DEPS index 72306d036008..3e1235f10c2e 100644 --- a/DEPS +++ b/DEPS @@ -133,7 +133,7 @@ vars = { # and land the review. # # For more details, see https://github.com/dart-lang/sdk/issues/30164. - "dart_style_rev": "6c9bc10cf2dc6496b2ce863c8d614aa0781abf90", # disable rev_sdk_deps.dart + "dart_style_rev": "156f5c8c3bfe4e3b8e7adc95f7cf24d9500f11c6", # disable rev_sdk_deps.dart "dartdoc_rev": "1a7952b13858ed307185a28f9b4ea861c0abb1c5", "ffi_rev": "04fa38ab45cb2957f9059e03031b53906c2c4385", "file_rev": "72a67c33f90bfb7e10057e286e06d2fe3baa4d98",