Repository navigation
v2.12.1: fix 2.12.0 build-time regression (short argOrDefault calls in invokers) - #58
Merged
Merged
Conversation
…2.12.0 build-time regression) The inline `identical(a[i], ConstructorReflection.absentArgument) ? d : a[i] as T` of each omittable invoker argument made dart_style very slow on large constructors: in menu_ici_api, formatting went from ~1s to 64s and a full build from 6s to 69s. Each argument is now `__argOr$<T>(a[i], d)`, a short alias (declared on first use) of the new `ConstructorReflection.argOrDefault<T>`; defaults are still typed in T's context. Build back to 7s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #58 +/- ##
=======================================
Coverage 93.53% 93.54%
=======================================
Files 14 14
Lines 6532 6538 +6
=======================================
+ Hits 6110 6116 +6
Misses 422 422
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
2.12.0's constructor invokers write each omittable argument inline as
identical(a[i], ConstructorReflection.absentArgument) ? default : a[i] as T.dart_styleis very slow on long argument lists of these: in a project with many large entity constructors, a clean build went from 6s (2.11.0) to 69s, 64s of it in formatting (its largest generated file alone: 41s), and its CIensure_buildtest timed out at 120s.Bisected to ef2fef1 (typed defaults in invokers).
Fix
ConstructorReflection.argOrDefault<T>(arg, defaultValue): the default whenargisabsentArgument, elsearg as T.__argOr$, a short alias declared in the generated file on first use (like the__RCDrecord aliases):T's context (0.0fordouble x = 0, aList<String>forconst []).Measured (that project's clean build, local)
ConstructorReflection.argOrDefault<T>__argOr$)That project with this builder:
dart analyzeclean, its entity/module tests pass.Tests
argOrDefaultunit test; build/generated-code tests updated to the new shape (the generated-code test still compiles the invokers under strict analysis and runs them)..g.dart.ReflectionInspectortests fail only when run from a git worktree under.claude/(the inspector skips hidden dirs); they pass in the main checkout.🤖 Generated with Claude Code