Skip to content

Deprecate _ as x patterns #4683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Deprecate _ as x patterns #4683

wants to merge 15 commits into from

Conversation

eutampieri
Copy link

This aims to fix #4664.
I'm new here, so I hope to have done everything right.

@eutampieri eutampieri marked this pull request as draft June 13, 2025 14:04
@giacomocavalieri
Copy link
Member

Looks good so far Eugenio! Could you add some tests for both the formatting and the warning? You can have a look at the format::test and type::tests::warnings modules for that

@eutampieri
Copy link
Author

🌟 Added tests! 🌟

@eutampieri eutampieri marked this pull request as ready for review June 13, 2025 15:51
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Hello! Could you rebase on main please? There's some conflicts. Thank you


type_::Warning::UnusedDiscardPattern { location, name } => Diagnostic {
title: "Unused discard pattern".into(),
text: format!("_ as {name} can be written more concisely as {name}"),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
text: format!("_ as {name} can be written more concisely as {name}"),
text: format!("_ as {name} can be written more concisely as {name}"),
Suggested change
text: format!("_ as {name} can be written more concisely as {name}"),
text: format!("`_ as {name}` can be written more concisely as `{name}`"),

Copy link
Author

Choose a reason for hiding this comment

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

Done!

@eutampieri
Copy link
Author

Thanks @giacomocavalieri and @lpil for your support!

@eutampieri eutampieri requested a review from lpil June 18, 2025 14:50
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Thank you!!

@lpil
Copy link
Member

lpil commented Jun 22, 2025

Oops, tests are failing. Could you rebase to remove the merge commits also please 🙏

@lpil lpil marked this pull request as draft June 22, 2025 14:47
@giacomocavalieri
Copy link
Member

Hello Eugenio, is this ready for review? Remember to un-draft it when it is!

@eutampieri
Copy link
Author

Hi @giacomocavalieri, no, it’s not. It's still failing the tests.

@eutampieri
Copy link
Author

eutampieri commented Jun 28, 2025

We're failing cargo clippy here, though it seems it's failing in some other part of the codebase

@eutampieri
Copy link
Author

eutampieri commented Jun 28, 2025

@lpil I could try cargo clippy --workspace --fix, but I think it would add a lot of noise (here's my CI run)

And here are the changes:

compiler-core/src/config.rs
compiler-core/src/docs.rs
compiler-core/src/error/tests.rs
compiler-core/src/language_server/tests/action.rs
compiler-core/src/language_server/tests/completion.rs
compiler-core/src/language_server/tests/reference.rs
compiler-core/src/type_/tests.rs

@eutampieri eutampieri marked this pull request as ready for review June 28, 2025 06:58
@eutampieri eutampieri requested a review from lpil June 28, 2025 06:58
@GearsDatapacks
Copy link
Member

The latest commit on main should have fixed the clippy lints, unless you introduced more in this PR. If you rebase on main now, they should all pass

@eutampieri
Copy link
Author

@GearsDatapacks @lpil rebased

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Thank you!! Few tiny notes

┌─ /src/warning/wrn.gleam:4:10
4 │ _ as b -> b
│ ^
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
^
^^^^^^

Can we make the arrow point to the whole thing that would be replaced please 🙏

Copy link
Member

Choose a reason for hiding this comment

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

This hasn't been done yet 🙏

},
extra_labels: vec![],
}),
hint: Some(format!("Replace with {name}")),
Copy link
Member

Choose a reason for hiding this comment

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

Let's drop the hint as the text covers it pretty much

Copy link
Member

Choose a reason for hiding this comment

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

This hasn't been done yet!

Copy link
Author

Choose a reason for hiding this comment

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

I know, sorry... I just had a lot of things to do. Will fix this evening

@lpil lpil marked this pull request as draft July 7, 2025 12:55
@eutampieri eutampieri requested a review from lpil July 7, 2025 18:13
@eutampieri eutampieri marked this pull request as ready for review July 7, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate _ as x patterns
4 participants