Skip to content

Support for diagnostic notes without file locations #1308

@xermicus

Description

@xermicus

Right now we can not display file notes if the error originates in a builtin. Example:

import "substrate";
contract Foo {
   function chain_extension() public pure {}
}

Results in

thread 'main' panicked at 'internal error: entered unreachable code: note without file position', src/sema/diagnostics.rs:171:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

We could just remove the panic and drop the note:

warning: chain_extension is already defined as a function
  ┌─ /home/glow/code/solang/test.sol:3:13
  │
3 │    function chain_extension() public pure {}
  │             ^^^^^^^^^^^^^^^

However instead of just dropping the note, it would be nice to support notes for code without a source file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions