Report a compilation error for invalid placeholders [Part I]#216
Merged
yevhenii-nadtochii merged 19 commits intomasterfrom Apr 29, 2025
Merged
Report a compilation error for invalid placeholders [Part I]#216yevhenii-nadtochii merged 19 commits intomasterfrom
yevhenii-nadtochii merged 19 commits intomasterfrom
Conversation
added 13 commits
April 25, 2025 14:56
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #216 +/- ##
============================================
+ Coverage 23.67% 26.14% +2.47%
- Complexity 240 241 +1
============================================
Files 137 137
Lines 3177 3236 +59
Branches 241 247 +6
============================================
+ Hits 752 846 +94
+ Misses 2392 2351 -41
- Partials 33 39 +6 🚀 New features to boost your workflow:
|
Contributor
Author
armiol
requested changes
Apr 29, 2025
Collaborator
armiol
left a comment
There was a problem hiding this comment.
@yevhenii-nadtochii LGMT in general. Please see my comment though.
| */ | ||
| internal fun checkBothApplied( | ||
| companion: GeneratedExtension<*, *>, | ||
| primary: GeneratedExtension<*, *>, |
Collaborator
There was a problem hiding this comment.
Instead of having a function taking two very similar arguments (in which I would have the primary first, BTW), I'd rather have an extension function to GeneratedExtension.
The reason is that the invocations of callFunction(someparameter, someotherparameter) in which both of the arguments are of the same type, are prone to errors with the parameters swapped.
Contributor
Author
|
@armiol PTAL |
armiol
approved these changes
Apr 29, 2025
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.
This PR addresses #213 for boolean options that use a companion option to specify custom error messages.
The following options have received this compilation check:
(distinct),(required),(set_once).Their companion policies now extract and check the error messages on their own. Instead of a single event, the main and companion policies now emit their own events that are accumulated in the view:
RequiredFieldDiscovered→RequiredFieldDiscoveredandIfMissingOptionDiscovered.DistinctFieldDiscovered→DistinctFieldDiscoveredandIfHasDuplicatesOptionDiscovered.SetOnceFieldDiscovered→SetOnceFieldDiscoveredandIfSetAgainOptionDiscovered.Note that we usually emit the following event:
${OptionName}{OptionTarget}Discovered. I kept this convention for the main options, but emitting something likeIfMissingFieldDiscoveredmakes no sense because this is actually an option that affects another, its main option, not the field itself.Having these checks in
:modelrequired the following changes:ErrorPlaceholderenum has been moved to:model.resolveErrorMessage()function is no longer needed. Companion policies now unpack the option and extract the message in a typed manner.CompanionPolicyhas been replaced in favor of thecheckBothApplied()function.As for now, I haven't extracted a common
checkPlaceholders()function to check for placeholders. I'll do in the next PR when the rest of options will be given such a check.Non-related changes
ChoiceViewhas been renamed toChoiceGroupViewto fix naming consistency:${OptionName}{OptionTarget}View.