trill-lang / trill

A type safe, compiled language inspired by (and written in) Swift
MIT License
275 stars 15 forks source link

Improve parse errors #46

Closed segiddins closed 7 years ago

segiddins commented 7 years ago

Given the following source:

func main() {
  let f: () -> Void = {
    return
  }
  println(f)
}

Turn the error from

error: unexpected token 'return'
 --> test.tr:2:24
  |
 2|   let f: () -> Void = {
  |                        ^

into

error: unexpected token 'return'
 --> test.tr:3:5
  |
  |  let f: () -> Void = {
 3|     return
  |     ^~~~~~ 
  |  }
harlanhaskins commented 7 years ago

Wait, that snippet should compile as-is...

harlanhaskins commented 7 years ago

LGTM! :shipit: