silver icon indicating copy to clipboard operation
silver copied to clipboard

Add full term to [type] error report

Open viper-admin opened this issue 10 years ago • 3 comments

Created by bitbucket user juhaszu on 2014-11-03 11:14 Last updated on 2017-11-26 14:45

Currently we report a type error using the first character of the offending expression.

This can lead to some confusing messages - e.g.:

p:Perm q:Perm q := p\2

Here we would get two error messages pointing at the same location: "expected Int but got Perm" (for p) "expected Perm but got Int" (p\2)

Currently we can report start and end points, but not the actual text of the offending expression.

I would suggest including in type errors (and maybe others) the full text of the offending expression

viper-admin avatar Nov 03 '14 11:11 viper-admin

@mschwerhoff commented on 2014-11-03 13:16

I contacted Tony Sloane (the guy behind Kiama) and asked him if it is possible to get the original input that gave rise to a parsed node, here is the corresponding mailing list thread. Looks as if it will be possible with the upcoming release.

viper-admin avatar Nov 03 '14 13:11 viper-admin

@mschwerhoff commented on 2017-11-26 14:45

At the time of writing, parsing

method test() {
  var p: Bool
  var q: Bool
  q := p/2
}

yielded the error message Type error in the expression at file.sil@[4.8-4.11].

viper-admin avatar Nov 26 '17 14:11 viper-admin

@mschwerhoff on 2017-11-26 14:45:

  • edited the description
  • changed priority from major to minor
  • changed component from (none) to Parser

viper-admin avatar Nov 26 '17 14:11 viper-admin