Skip to content

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

@asterite

Description

@asterite

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions