-
Notifications
You must be signed in to change notification settings - Fork 14
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
Missing spaces/punctuation in SyntaxError message. #225
Comments
schneems
added a commit
that referenced
this issue
Nov 15, 2024
In #225 it was reported that the output looks incorrect: ``` $ cat /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb def x.y.z end $ ruby /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb: --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parametersunexpected '.', ignoring it > 1 def x.y.z > 2 end ``` Specifically: ``` expected a delimiter to close the parametersunexpected '.', ignoring it ``` However this does not show up when executing the debug executable: ``` $ bin/bundle exec exe/syntax_suggest /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parameters unexpected '.', ignoring it > 1 def x.y.z > 2 end ``` This is because `exe/syntax_suggest` uses STDOUT.puts while calling `ruby` with the filename uses a fake IO object represented by MiniStringIO. This class was incorrectly not adding a newline to the end of the print. The fix was to move the class to it's own file where it can be tested and then fix the behavior. close #225 Co-authored-by: Andy Yong <andyywz@gmail.com>
schneems
added a commit
that referenced
this issue
Nov 15, 2024
In #225 it was reported that the output looks incorrect: ``` $ cat /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb def x.y.z end $ ruby /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb: --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parametersunexpected '.', ignoring it > 1 def x.y.z > 2 end ``` Specifically: ``` expected a delimiter to close the parametersunexpected '.', ignoring it ``` However this does not show up when executing the debug executable: ``` $ bin/bundle exec exe/syntax_suggest /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parameters unexpected '.', ignoring it > 1 def x.y.z > 2 end ``` This is because `exe/syntax_suggest` uses STDOUT.puts while calling `ruby` with the filename uses a fake IO object represented by MiniStringIO. This class was incorrectly not adding a newline to the end of the print. The fix was to move the class to it's own file where it can be tested and then fix the behavior. close #225 Co-authored-by: Andy Yong <andyywz@gmail.com>
matzbot
pushed a commit
to ruby/ruby
that referenced
this issue
Nov 15, 2024
In #225 it was reported that the output looks incorrect: ``` $ cat /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb def x.y.z end $ ruby /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb: --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parametersunexpected '.', ignoring it > 1 def x.y.z > 2 end ``` Specifically: ``` expected a delimiter to close the parametersunexpected '.', ignoring it ``` However this does not show up when executing the debug executable: ``` $ bin/bundle exec exe/syntax_suggest /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parameters unexpected '.', ignoring it > 1 def x.y.z > 2 end ``` This is because `exe/syntax_suggest` uses STDOUT.puts while calling `ruby` with the filename uses a fake IO object represented by MiniStringIO. This class was incorrectly not adding a newline to the end of the print. The fix was to move the class to it's own file where it can be tested and then fix the behavior. close ruby/syntax_suggest#225 ruby/syntax_suggest@d2ecd94a3b Co-authored-by: Andy Yong <andyywz@gmail.com>
Thanks for the report. This is fixed in 2.0.2 |
Thank you for the fix! |
Now this is causing rspec-core side test failure, not sure which side should fix: rspec/rspec-core#3125 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all,
with the following simple snippet of Ruby code:
the interpreter raises a
SyntaxError
, whose message is made up of two sentences with no spaces or punctuation in between (see line no. 2 of the output):This happens on Ruby master with the sentences reported above, but also on 3.3.5 with the sentences:
expected a delimiter to close the parameterscannot parse the expression
.In both cases,
gem list
returnssyntax_suggest (default: 2.0.0)
.Unfortunately I can't tell if the same glitch occurs with other error messages.
Thanks!
The text was updated successfully, but these errors were encountered: