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

Cascading errors in the WebDSL specification #107

Open
maxdekrieger opened this issue Oct 17, 2022 · 0 comments
Open

Cascading errors in the WebDSL specification #107

maxdekrieger opened this issue Oct 17, 2022 · 0 comments

Comments

@maxdekrieger
Copy link

maxdekrieger commented Oct 17, 2022

Short description
A rare case of a cascading error during typechecking of a WebDSL program.

Problem description.
In the following WebDSL snippet, a predicate should contain a boolean result, but a more specific error occurs in the addition (adding int + bool). Statix shows both while in the ideal case it would only show the error of adding an int to a bool.

  predicate foo(i:Int){
    i+false
  }

The error should be caught with the following constraint:

equalType(typeOfExp(s_predicate, exp), bool) | error $[Predicate should contain a Bool expression] @exp.

normalized:
      (typeOfExp(s_predicate, exp, typeOfExp332) | error $[Predicate should contain a Bool expression] @exp,
       equalType(typeOfExp332, bool) | error $[Predicate should contain a Bool expression] @exp),

Describe the solution you'd like
Ideally the error given by the typeOfExp predicate should be the only error shown, namely that adding an int to a bool is untyped.

Describe alternatives you've considered
None

Additional context
Failing test on the WebDSL buildfarm: https://buildfarm.metaborg.org/job/webdsl/job/webdsl-statix/job/master/117/artifact/analysis-results/analysis__1-original-compiler-tests__analysis-fails__ac__predicateboolexp-2__FAILED.

Statix snippet: https://github.com/webdsl/webdsl-statix/blob/584fdf1b29ce2c2a6b094bae0e24b64a1f1efb7d/webdslstatix/trans/static-semantics/webdsl-ac.stx#L188-L199

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