Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truffle - Compile Error until when break in case statement #2654

Closed
bjfish opened this issue Mar 6, 2015 · 2 comments
Closed

Truffle - Compile Error until when break in case statement #2654

bjfish opened this issue Mar 6, 2015 · 2 comments

Comments

@bjfish
Copy link
Contributor

bjfish commented Mar 6, 2015

This fails with the following error in Truffle but not in jruby or ruby 2.2

       x = 0
       until x > 5
          test = "test"
          case
          when test == "hello"
             break unless test == "foo"
             puts "hello"
          when test == "te"
            if test == "false"
              raise "foo"
            end
            break
          else
            puts "else"
          end
          x += 1
      end

Error output

jruby: using Default Truffle Runtime
whenbreak.rb:13: Invalid break
whenbreak.rb: compile error (SyntaxError)

Expected output

else
else
else
else
else
else
@chrisseaton chrisseaton changed the title Truffle - Compile Error until when break in case statement Compile Error until when break in case statement Mar 6, 2015
@chrisseaton chrisseaton changed the title Compile Error until when break in case statement Truffle - Compile Error until when break in case statement Mar 6, 2015
@chrisseaton
Copy link
Contributor

I didn't know you could do that!

This is likely an error in the translator, but I'm not sure what off the top of my head. It's strange that it's a syntax error though - as we run the same parser as JRuby and you say it works there.

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

System.err.printf("%s:%d: Invalid break%n", node.getPosition().getFile(), node.getPosition().getLine() + 1);

while works fine

@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants