Unclear red tildes indicated syntax errors by using block local variables in arrow style lambda.

Answered

 Hello. I am using RubyMine 2016.3.

 I wrote following codes in the source file test.rb

ary = []

f = ->(n; i) {
i = 0
n.times {
ary << i
i += 2
}
}

f.call 7

p ary

 When I ran test.rb by ruby2.3.3, it worked with no syntax errors and displayed the next line as expected.

[0, 2, 4, 6, 8, 10, 12] 

 But source codes in the editor area of RubyMine included 4 red tildes as next image.


 Why are these red tildes displayed ? And if I should check some configurations for the editor, please point out them.

 Additionally, when I changed the lambda from arrow style ->(n; i) to  lambda {|n; i| , red tildes disappeared as next image.



Sincerely,
Junichi Yokota
  

2 comments
Comment actions Permalink

Hello,

it appears to be a known problem, could you please take a look and vote for it in case you find it related:

https://youtrack.jetbrains.com/issue/RUBY-16914

 

0
Comment actions Permalink

Thank you for your answer. About the present status of this problem, I get it.

0

Please sign in to leave a comment.