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

astId is ignored when used as location for message #74

Open
MeAmAnUsername opened this issue Sep 13, 2021 · 0 comments
Open

astId is ignored when used as location for message #74

MeAmAnUsername opened this issue Sep 13, 2021 · 0 comments

Comments

@MeAmAnUsername
Copy link
Contributor

Bug description
A message with an astId as location will not be shown on that astId but will be treated as if it didn't have an explicit location (i.e. goes up the stacktrace and uses the first ast node it finds)

Versions
Eclipse: org.eclipse.platform.ide 4.16.0.I20200604-0540
Spoofax: org.metaborg.spoofax.eclipse 2.6.0.20210903-091634-master
System: Mac OS X x86_64 10.14.6
Statix setup: single file

Steps to reproduce the behavior
stx test files do not show the node the error appears on, so you get a full Spoofax project instead.
The full project is attached as statixbugastidmessagelocation.zip, relevant parts are shown here:
Syntax:

context-free syntax
  
  Start.Elems = [[Elem], [Elem]]
  Elem.Elem = [[INT]]

Statix:

module statics

// see README.md for details on how to switch to multi-file analysis

rules // single-file entry point

  programOk : Start

  programOk(Elems(e1, e2)) :-
    check(e1, astId(e1)),
    check(e1, astId(e2)).

  check : Elem * astId
  check(elem, node) :- false | error $[elem [elem], astId([node])] @node.

signature

  sorts Start constructors
    Elems : Elem * Elem -> Start
  
  sorts Elem constructors
    Elem : Elem

Example file (example/test.sta)

1, 2

Observed behavior
There are two errors on 1. This always happens.

Expected behavior
One error on 1, one error on 2.

Additional context
Slack threads:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants