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
Incompatibility with Ruby 2.2.0 #72
Comments
Using 2.2.0 with a fresh emacs? or upgrading / switching ruby versions in the same emacs session? Try experimenting with |
Yes, this happens in a fresh Emacs instance. No, |
OK. Cool. It is probably unrelated to the other problem then. Can you provide a snippet to repro with? |
I think I've narrowed it down to a minimal example: 'a'.gsub('a', 'b')
.gsub('b', 'c') # inline comment
.gsub('c', 'a') Using Ruby 2.1 I get no errors. Using Ruby 2.2 I get the earlier backtrace. |
Nice work 😄 Here are outputs of Ripper.lex(src) on your example in Ruby 2.1.4 and 2.2.0. An output of Ripper.lex(src) consists of 16,17c16,19
< [[1, 18], :on_period, "\n"],
< [[2, 0], :on_ident, " .gsub"],
---
> [[1, 18], :on_ignored_nl, "\n"],
> [[2, 0], :on_sp, " "],
> [[2, 2], :on_period, "."],
> [[2, 3], :on_ident, "gsub"],
30c32,34
< [[3, 0], :on_period, " ."],
---
> [[1, 18], :on_ignored_nl, nil],
> [[3, 0], :on_sp, " "],
> [[3, 2], :on_period, "."], In Ruby 2.2.0, This is a quick workaround for it. diff --git a/ruby/erm_buffer.rb b/ruby/erm_buffer.rb
index b4456b4..8bbbf43 100644
--- a/ruby/erm_buffer.rb
+++ b/ruby/erm_buffer.rb
@@ -299,6 +299,12 @@ class ErmBuffer
end
end
+ def on_ignored_nl tok
+ unless tok.nil?
+ on_nl tok
+ end
+ end
+
def on_kw sym # TODO: break up. 61 lines long
sym = sym.to_sym
case @mode
@@ -516,7 +522,6 @@ class ErmBuffer
end
end
- alias on_ignored_nl on_nl
alias on_lbracket on_lparen
alias on_rbracket on_rparen
end |
Awesome. I've applied your patch @vzvu3k6k. Thanks! |
Hello, there. Still having the issue :
Around this code : most_recent_trip = self.trip.class # Trip
.where.not(id: self.trip.id)
.where({ user_id: self.trip.user_id }.merge(hotel_query))
.order(created_at: :desc)
.limit(1)
.first Seems to be the same problem, any idea why ? |
@gabriel-dehan Your version of |
@gabriel-dehan that code works for me under ruby 2.2.2:
seems to reparse fine |
@wasmasa 👍 , thank you |
See also #71 for more context.
I get this error when using this mode with Ruby 2.2.0. Downgrading to Ruby 2.1.5 makes it go away, looks like an incompatible change. The backtrace suggests it's calling
on_nl nil
somewhere and therefore crashes because that should never happen.The text was updated successfully, but these errors were encountered: