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
TypeError: "warn" with subclass of String constructed from heredoc #5935
Comments
This seems to be a precedence problem in the parser. If I add a puts into that before that heredoc case it never prints. Likely this is a one word fix but will it be easy? :) |
derp...this has nothing to do with parser. I just realized locally for me neither case works (I had put my puts between the two). Now for the twist! 9.2.8.0 the first case works???? In both cases these are strings so this is strange. Too strange to ignore for 9.2.9.0 |
Ok it took me longer to write my two comments then to actually figure this out. We were using a type check method which expects an exact match on warn argument being a String versus a kind-of String. Verifying something about protocol conversion before committing a fix. |
Circling back on why the first case stopped working since 9.2.8.0...@kares had recently added some kwargs support to warn and what changed happened to change both into hitting the same incorrect typeconverter type check (I believe it from no newline strings performing a strDup which made first call work but it is enough for me to know I fixed both with my commit). |
Thanks for the quick response! You're right: The important difference between the cases seems to be the trailing newline character, not the heredoc. In 9.2.8.0: warn S.new("foo\n") # TypeError (wrong argument type S (expected String))
warn S.new(<<M.chomp) # works
bar
M |
Follow up of rubocop@418973b. jruby/jruby#5935 has been resolved and JRuby 9.2.9.0 has been released.
Follow up of rubocop@418973b. jruby/jruby#5935 has been resolved and JRuby 9.2.9.0 has been released.
Follow up of rubocop@418973b. jruby/jruby#5935 has been resolved and JRuby 9.2.9.0 has been released.
Environment
Expected Behavior
The script
is expected to output
to stderr.
Actual Behavior
Instead JRuby raises a TypeError for the second warning (heredoc case):
This was originally observed with the
rainbow
gem (https://github.com/sickill/rainbow) here: https://circleci.com/gh/rubocop-hq/rubocop/72166The text was updated successfully, but these errors were encountered: