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

squiggly heredoc with single quotes indent wrong #4260

Closed
pbl-pw opened this issue Nov 2, 2016 · 6 comments

Comments

@pbl-pw
Copy link

commented Nov 2, 2016

Environment

jruby 9.1.5.0 (2.3.1) 2016-09-23 fffffff Java HotSpot(TM) Client VM 25.51-b03 on 1.8.0_51-b16 +jit [mswin32-x86]

Test Code

obj1 = <<~'VALUE'
line1
line2
	line3
line4
VALUE
puts obj1
obj2 = <<~'VALUE'
	line5
	line6
		line7
	line8
VALUE
puts obj2

Expected Behavior

MRI output:

line1
line2
	line3
line4
line5
line6
	line7
line8

Actual Behavior

jruby output:

line1
line2
	line3
line4
line5
line6
line7
line8
@andyn95

This comment has been minimized.

Copy link

commented Nov 1, 2018

What file is this issue in? Does someone have a link to that file so I can see the code that does this?

@enebo

This comment has been minimized.

Copy link
Member

commented Nov 1, 2018

@andyn95 It RubyLexer.java and LexingCommon.java. The method to look at is heredoc_dedent. Comparison vs C Ruby source may be helpful.

@koic

This comment has been minimized.

Copy link

commented May 8, 2019

The issue is reproduced in JRuby 9.2.7.

% ruby -v
jruby 9.2.7.0 (2.5.3) 2019-04-09 8a269e3 Java HotSpot(TM) 64-Bit Server VM 25.5-b02 on 1.8.0_05-b13 +jit [darwin-x86_64]

I found it when I was working on RuboCop to drop supporting Ruby 2.2.
rubocop-hq/rubocop#7026 (comment)

@koic

This comment has been minimized.

Copy link

commented Jun 25, 2019

Hi, @headius @enebo. Thank you for the maintenance.
I have encountered this issue repeatedly with RuboCop. Do you have a plan to resolve this issue? I hope this issue will be resolved and behaves the same as MRI. I appreciate your activities. Thank you.

@enebo enebo added this to the JRuby 9.2.8.0 milestone Jun 25, 2019

@enebo

This comment has been minimized.

Copy link
Member

commented Jun 25, 2019

@koic I will fix this for 9.2.8.0. I looked briefly and heredoc_indent value is some weird astronomically large value so something is not getting reset or something.

@koic

This comment has been minimized.

Copy link

commented Jun 26, 2019

Thank you very much. I'm looking forward to the release of JRuby 9.2.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.