[Ur] error reporting

Adam Chlipala adamc at impredicative.com
Wed Nov 2 18:49:45 EDT 2011


Gergely Buday wrote:
> having the following simple code I get an error:
>
> [gergoe at homeship sandbox]$ cat problem.ur
> val foo = 2.0 +
> 3
> [gergoe at homeship sandbox]$ urweb problem
> problem.ur:2:0-2:1: Unification failure
> Expression:  3
>    Have con:  Basis.int
>    Need con:  Basis.float
> Incompatible constructors
> Con 1:  Basis.int
> Con 2:  Basis.float
>
> As I see, line numbering starts from 1 and column numbering starts
> from 0. Still, I wonder why a one character literal spans two places,
> according to the compiler. Is this a bug or a feature? The same is
> valid for longer identifiers, the compiler reports a range that is one
> longer than it actually is.
>    

This is the behavior I meant to implement (though I don't have a solid 
story on 0-vs.-1-based numbering for the two dimensions!).  Think of the 
first position as pointing to the first character in question and the 
second position as pointing right _after_ the last character in 
question.  Among other properties, this scheme makes it possible to 
distinguish an empty region from a 1-character region.



More information about the Ur mailing list