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

Try to make filenames in error messages relative to the current directory #5641

Closed
asterite opened this issue Jul 30, 2024 · 0 comments · Fixed by #5642
Closed

Try to make filenames in error messages relative to the current directory #5641

asterite opened this issue Jul 30, 2024 · 0 comments · Fixed by #5642
Assignees
Labels
enhancement New feature or request

Comments

@asterite
Copy link
Collaborator

Problem

Right now filenames in error messages are always absolute. This introduces a lot of noise in error messages.

Happy Case

It would be nice to show filenames relative to the current directory if they are relative to the current directory.

For example, this program:

fn main() {
    let _ = 1 + "a";
}

currently gives this error:

error: Types in a binary operation should match, but found Field and str<1>
  ┌─ /Users/asterite/Sandbox/noir_programs/one/src/main.nr:2:13
  │
2 │     let _ = 1 + "a";
  │             -------

This is when running nargo compile inside /Users/asterite/Sandbox/noir_programs/one. It would be nice if the error message were instead:

error: Types in a binary operation should match, but found Field and str<1>
  ┌─ src/main.nr:2:13
  │
2 │     let _ = 1 + "a";
  │             -------

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

Yes

Support Needs

No response

@asterite asterite added the enhancement New feature or request label Jul 30, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jul 30, 2024
@asterite asterite self-assigned this Jul 30, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 30, 2024
…ble (#5642)

# Description

## Problem

Resolves #5641

## Summary

It seems `FileMap`'s `name` function was the one that needed that
change.

To avoid doing a syscall to get the current directory every time a name
is needed, `FileMap` gets it at the beginning of the program. I think
this is fine as the current directory can't change while the compilation
is happening.

## Additional Context

None.

## Documentation

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant