Skip to content
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

Update line number start to 0 #4082

Merged
merged 7 commits into from
Mar 19, 2022
Merged

Update line number start to 0 #4082

merged 7 commits into from
Mar 19, 2022

Conversation

edwincoronado
Copy link
Contributor

@edwincoronado edwincoronado commented Mar 18, 2022

Description:
This fixes issue #4081 by starting line number at 0 instead of 1 since Miette increments the line.

Related issue (if exists):
Closes #4081

@CLAassistant
Copy link

CLAassistant commented Mar 18, 2022

CLA assistant check
All committers have signed the CLA.

@kdy1 kdy1 modified the milestones: v2.0.0-alpha.1, v1.2.159 Mar 19, 2022
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

This is wrong place to fix

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

You should modify miette adapter instead

@kdy1 kdy1 removed this from the v1.2.159 milestone Mar 19, 2022
@edwincoronado edwincoronado requested a review from kdy1 March 19, 2022 06:04
@edwincoronado
Copy link
Contributor Author

Updating failing tests.

@edwincoronado
Copy link
Contributor Author

@kdy1 do you know if there is a way of generating the *.stderr files programmatically? After running this in root directory:

find . -name '*stderr' | wc -l

I see that there's a total of 1084 files. Would be very time consuming to fix all manually.

@kdy1
Copy link
Member

kdy1 commented Mar 19, 2022 via email

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

If you want, I can update test references for you

@@ -109,7 +109,7 @@ impl SourceCode for MietteSourceCode<'_> {
_cm: self.0,
data: src,
span: convert_span(span),
line: loc.line,
line: loc.line - 1,
Copy link
Member

Choose a reason for hiding this comment

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

Can you use saturating_sub instead?

Copy link
Member

Choose a reason for hiding this comment

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

I'll update/merge this PR as this is required for other PRs

@kdy1 kdy1 added this to the v1.2.160 milestone Mar 19, 2022
kdy1
kdy1 previously approved these changes Mar 19, 2022
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

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

swc-bump:

  • swc_error_reporters

@kdy1 kdy1 enabled auto-merge (squash) March 19, 2022 14:35
kdy1
kdy1 previously approved these changes Mar 19, 2022
@kdy1 kdy1 disabled auto-merge March 19, 2022 14:55
@kdy1 kdy1 merged commit 57802cf into swc-project:main Mar 19, 2022
@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

New miette-based error reporter reporting wrong line
3 participants