Skip to content

[Merged by Bors] - doc(Tactic/ToAdditive/Frontend): more helpful error message when a name cannot be tr…#21716

Closed
grunweg wants to merge 6 commits intomasterfrom
MR-toadditive-messages
Closed

[Merged by Bors] - doc(Tactic/ToAdditive/Frontend): more helpful error message when a name cannot be tr…#21716
grunweg wants to merge 6 commits intomasterfrom
MR-toadditive-messages

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented Feb 11, 2025

…ansported

This would have helped me in #21422.


Open in Gitpod

@grunweg grunweg added easy < 20s of review time. See the lifecycle page for guidelines. t-meta Tactics, attributes or user commands labels Feb 11, 2025
@grunweg grunweg changed the title doc(to_additive): more helpful error message when a name cannot be tr… doc(Tactic/ToAdditive/Frontend): more helpful error message when a name cannot be tr… Feb 11, 2025
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Feb 11, 2025

@YaelDillies Would you like to review this error message change?

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 11, 2025

PR summary ff46efcfd3

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ foo

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Comment on lines +1106 to +1109
throwError "to_additive: the generated additivised name equals the original name {src}.\
Usually, this means you need to name your declaration correctly \
(e.g., name instances with a name that can be additivised). \
Sometimes, this means you need to extend to_additive to handle the new names."
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Suggested change
throwError "to_additive: the generated additivised name equals the original name {src}.\
Usually, this means you need to name your declaration correctly \
(e.g., name instances with a name that can be additivised). \
Sometimes, this means you need to extend to_additive to handle the new names."
throwError "to_additive: the generated additivised name equals the original name {src},\
meaning that no part of the name was additivised.\
Check that your declaration name is correct\
(if your declaration is an instance, try name it)\
or provide an additivised name using the 'to_additive my_add_name' syntax."

I'm not sure how relevant the part about instance is. I think something telling you to check the declaration name of an instance will immediately make you think of naming the instance. Otherwise it would be cool to give that part of the error message iff the erroring declaration is in fact an instance (we should be able to access this information here, right?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your suggestion. (I'm adding a test locally, hence tweaking it to make line breaks nice etc.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing if this is part of an instance: this should be possible, to_additive takes a Syntax as input: however, I'd need to thread this all the way into targetName. Are you sure this is really useful?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it would be cool, but not necessarily useful

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let me punt on this in favour of other changes I could make.

Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

maintainer delegate

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@github-actions github-actions bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Feb 11, 2025
@fpvandoorn
Copy link
Copy Markdown
Member

bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Feb 11, 2025

✌️ grunweg can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Feb 11, 2025
grunweg and others added 2 commits February 11, 2025 13:55
Co-authored-by: damiano <adomani@gmail.com>
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Feb 11, 2025

Thanks for the helpful reviews, all three of you!
bors merge

mathlib-bors bot pushed a commit that referenced this pull request Feb 11, 2025
…me cannot be tr… (#21716)

…ansported

This would have helped me in #21422.




Co-authored-by: grunweg <rothgami@math.hu-berlin.de>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Feb 11, 2025

This PR was included in a batch that was canceled, it will be automatically retried

mathlib-bors bot pushed a commit that referenced this pull request Feb 11, 2025
…me cannot be tr… (#21716)

…ansported

This would have helped me in #21422.




Co-authored-by: grunweg <rothgami@math.hu-berlin.de>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Feb 11, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title doc(Tactic/ToAdditive/Frontend): more helpful error message when a name cannot be tr… [Merged by Bors] - doc(Tactic/ToAdditive/Frontend): more helpful error message when a name cannot be tr… Feb 11, 2025
@mathlib-bors mathlib-bors bot closed this Feb 11, 2025
@mathlib-bors mathlib-bors bot deleted the MR-toadditive-messages branch February 11, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). easy < 20s of review time. See the lifecycle page for guidelines. t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants