Skip to content

Feature proposal: Allow specifying out as list #96

Open
@antonagestam

Description

@antonagestam

I think the current format for output could be iterated on, and be made a little friendlier to work with. Instead of today's format using multiline strings:

out: |
  main:7: error: Argument 1 has incompatible type "int"; expected "str"  [arg-type]
  main:9: note: Revealed type is "builtins.bool*"

We could allow specifying out as a list of objects with properties:

out:
  - error: 'Argument 1 has incompatible type "int"; expected "str"  [arg-type]'
    line: 7
  - note: 'Revealed type is "builtins.bool"'
    line: 9

This would unlock a few different things we could then implement at a higher level of abstraction. There are probably more that will make sense, these are just the ones I can think of for now.

Special support for error-codes

out:
  - error: 'Argument 1 has incompatible type "int"; expected "str"'
    code: "arg-type"
    line: 7

Special support for revealed type

out:
  - revealed_type: "builtins.bool"
    line: 9

Allow mixing regex with non-regex

out:
  - error: 'Argument 1 has incompatible type "int\*?"; expected "str\*?"'
    line: 7
    regex: true

Omitting line numbers

This probably requires more knowledge of the internals than I currently have, but I think it might make sense to allow omitting line numbers. I'm proposing that this example would match if there's revealed type on line nine, followed by an error message on any line after that (strictly greater than line 9).

out:
  - note: 'Revealed type is "builtins.bool"'
    line: 9
  - error: 'Argument 1 has incompatible type "int"; expected "str"'
    code: "arg-type"

What do you think? 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions