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
Closed

squiggly heredoc with single quotes indent wrong #4260

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

Comments

@pbl-pw
Copy link

@pbl-pw pbl-pw 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
Copy link

@andyn95 andyn95 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?

Loading

@enebo
Copy link
Member

@enebo enebo 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.

Loading

@koic
Copy link

@koic koic 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/rubocop#7026 (comment)

Loading

@koic
Copy link

@koic koic 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.

Loading

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

@enebo enebo 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.

Loading

@koic
Copy link

@koic koic commented Jun 26, 2019

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

Loading

@enebo enebo closed this Jun 26, 2019
koic added a commit to koic/rubocop that referenced this issue Aug 21, 2019
jruby/jruby#4260 has been resolved and
JRuby 9.2.8.0  is available on CircleCI.
https://hub.docker.com/r/circleci/jruby/tags

```console
% docker run --rm -it circleci/jruby:9.2
Unable to find image 'circleci/jruby:9.2' locally
9.2: Pulling from circleci/jruby
9cc2ad81d40d: Pull complete
e6cb98e32a52: Pull complete
ae1b8d879bad: Pull complete
2383fa4462e7: Pull complete
7ac3ce9f2067: Pull complete
ce9a16d8ddcb: Pull complete
b250e79d9c7f: Pull complete
ce3b7f0ecca6: Pull complete
2405779516de: Pull complete
902dc7b355a1: Pull complete
432a6994cb77: Pull complete
66a081bddadb: Pull complete
1576af617cb5: Pull complete
4233b310ce28: Pull complete
51c0ac4a73c0: Pull complete
c43fdb6f1fe8: Pull complete
909d5a0f7f69: Pull complete
940e076596c5: Pull complete
c6abd11f682b: Pull complete
678a31b2fb39: Pull complete
Digest:
sha256:ee43918172710e4871054ce450da6e5f6d66cdeb1fe8397d356742bf142f20a2
Status: Downloaded newer image for circleci/jruby:9.2
$ ruby -v
jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff OpenJDK 64-Bit Server VM
25.222-b10 on 1.8.0_222-b10 +jit [linux-x86_64]
```

This PR aims to solve the following issues solved by JRuby.

- rubocop#7026 (comment)
- rubocop#7173 (comment)
- rubocop#7229 (comment)
- rubocop#7228 (comment)

It also removes unnecessary `strip_indent`.
bbatsov added a commit to rubocop/rubocop that referenced this issue Aug 21, 2019
jruby/jruby#4260 has been resolved and
JRuby 9.2.8.0  is available on CircleCI.
https://hub.docker.com/r/circleci/jruby/tags

```console
% docker run --rm -it circleci/jruby:9.2
Unable to find image 'circleci/jruby:9.2' locally
9.2: Pulling from circleci/jruby
9cc2ad81d40d: Pull complete
e6cb98e32a52: Pull complete
ae1b8d879bad: Pull complete
2383fa4462e7: Pull complete
7ac3ce9f2067: Pull complete
ce9a16d8ddcb: Pull complete
b250e79d9c7f: Pull complete
ce3b7f0ecca6: Pull complete
2405779516de: Pull complete
902dc7b355a1: Pull complete
432a6994cb77: Pull complete
66a081bddadb: Pull complete
1576af617cb5: Pull complete
4233b310ce28: Pull complete
51c0ac4a73c0: Pull complete
c43fdb6f1fe8: Pull complete
909d5a0f7f69: Pull complete
940e076596c5: Pull complete
c6abd11f682b: Pull complete
678a31b2fb39: Pull complete
Digest:
sha256:ee43918172710e4871054ce450da6e5f6d66cdeb1fe8397d356742bf142f20a2
Status: Downloaded newer image for circleci/jruby:9.2
$ ruby -v
jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff OpenJDK 64-Bit Server VM
25.222-b10 on 1.8.0_222-b10 +jit [linux-x86_64]
```

This PR aims to solve the following issues solved by JRuby.

- #7026 (comment)
- #7173 (comment)
- #7229 (comment)
- #7228 (comment)

It also removes unnecessary `strip_indent`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants