evincarofautumn / kitten

A statically typed concatenative systems programming language.
http://kittenlang.org/
Other
1.09k stars 39 forks source link

Fix source locations for multi-locals #64

Closed evincarofautumn closed 7 years ago

evincarofautumn commented 11 years ago

When declaring multiple locals with ->{ x y z }, they all have the same source location (that of ->).

strager commented 11 years ago

Here's a test case for a related issue:

// Type error on second parameter occurs at this column:
//    v
def f(Int Int -> +IO):
  ->{x y}
  x sayInt
  y say

// Prelude_IO.ktn:65:10: note: [Char] is from here
// Prelude_IO.ktn:65:10: note: Char is from here
// :1:1: type error: cannot solve scalar type constraint Int = [Char]
// :3:7: note: Int is from here
strager commented 11 years ago

And this reproduces the reported problem:

def f(Int Int ->):
  ->{x y}
// ^ Type error on second parameter occurs here.
  y@

// :1:1: type error: cannot solve scalar type constraint Int = t3298 -> t3299 + t3300
// :1:7: note: Int is from here
// :4:4: note: t3298 -> t3299 + t3300 is from here
// :4:4: note: t3298 is from here
// :4:4: note: t3299 is from here
// :4:4: note: t3300 is from here
evincarofautumn commented 7 years ago

Fixed in new compiler.