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

Better location information for saw-script type error messages #140

Closed
brianhuffman opened this issue May 27, 2016 · 3 comments
Closed

Better location information for saw-script type error messages #140

brianhuffman opened this issue May 27, 2016 · 3 comments
Assignees
Labels
better-in-python Will be fixed by switching to python frontend topics: error-messages Issues involving the messages SAW produces on error type: enhancement Issues describing an improvement to an existing feature or capability
Milestone

Comments

@brianhuffman
Copy link
Contributor

When the saw-script type checker reports an error message, it only reports the location of the top-level definition in which the error occurred. This is not very helpful, especially if your script consists mainly of one big main function with lots of statements inside. It would be much better if the error message could provide at least the location of the statement containing the error.

Currently pattern variables are the only parts of the saw-script parser AST that have location information (specifically, this includes the x in let x = ... and x <- ...). We need to extend the AST and lexer to save location information for more things, e.g. statements that don't bind a new variable. This would make it possible to report much more accurate locations for errors.

@ntc2
Copy link
Contributor

ntc2 commented Jun 30, 2016

I just got a type error that doesn't even include a top-level location:

$ saw test.saw 
Loading module Cryptol
Loading file "/var/tmp/saw-bug-floating-point/test.saw"
saw: user error (type mismatch: LLVMSetup () -> t.0 and [LLVMMethodSpec] -> LLVMSetup () -> TopLevel LLVMMethodSpec
 at "_" (REPL)
mismatched type constructors: <Block> and ([])

)

where the content of test.saw is

m <- llvm_load_module "test.bc";

let f_spec = do {
  llvm_return {{ 1 : [32] }};
  llvm_sat_branches true;
  llvm_verify_tactic yices;
};

llvm_verify m "f" f_spec;

(The problem of course is that I forgot the overrides; the last line should be llvm_verify m "f" [] f_spec;.)

@brianhuffman brianhuffman self-assigned this Aug 5, 2016
@atomb atomb added the type: enhancement Issues describing an improvement to an existing feature or capability label May 2, 2017
@atomb
Copy link
Contributor

atomb commented Jan 23, 2018

I think this may be fixed by some of the latest work by @david-christiansen .

@atomb atomb added this to the 1.0 milestone Jun 4, 2019
@atomb atomb added the topics: error-messages Issues involving the messages SAW produces on error label Oct 18, 2019
@atomb atomb modified the milestones: 0.5, 0.6 Apr 27, 2020
@brianhuffman brianhuffman added the better-in-python Will be fixed by switching to python frontend label May 18, 2020
@brianhuffman
Copy link
Contributor Author

This is probably not worth the effort at this point, as we are planning to move over to the new python-based saw-script frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better-in-python Will be fixed by switching to python frontend topics: error-messages Issues involving the messages SAW produces on error type: enhancement Issues describing an improvement to an existing feature or capability
Projects
None yet
Development

No branches or pull requests

3 participants