terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.72k stars 201 forks source link

Switch syntax as defined in docs and tests doesn't work on 1.0.0 beta2 #474

Closed noxabellus closed 3 years ago

noxabellus commented 3 years ago

I created a simple script where I was trying to play with the switch statement syntax, and ran into trouble pretty much immediately. The code in the docs and tests doesn't seem to be valid syntax right now. Just to be sure, I went to the actual tests/switch.t and copied out the code there

terra foo(a: int): int
  switch a do
    case 1 then
      return 2
    case 2 then
      return 5
    end
  else
    return 3
  end
end

print(foo:disas())

This gives an error at the first case:

$ terra switch_problem.t
switch_problem.t:3: unexpected symbol near '1'

I haven't been able to find any further discussion of switch after the PR (#416 Feature/switchstat) was merged so here I am

noxabellus commented 3 years ago

Wait, I just saw the date on the switchstat PR :facepalm:

merged the day after beta2 release

Okay well that clears that up, it kind of stinks the docs are not in sync with releases lol but entirely my bad

elliottslaughter commented 3 years ago

We should be able to get a new release out soon. There are some minor details that require changes due to the shutdown of travis-ci.org, but otherwise it should be straightforward.