Skip to content

Commit

Permalink
Ok I don't know what is going on....but........converting idents to m…
Browse files Browse the repository at this point in the history
…ake a copy

of their bytelists eliminates test failures.  I had considered doing this
anyways since it will not carry on an entire source line with it but at the
same time I hoped to not do the copy to save some up front work (e.g. creating
a new array and copying into it).

This is the problem I observed running spec:compiler.  When run as a full suite
then I see some failing tests.  If I look at one failing one I can see source
like:

```ruby
a.foo = 1
```

becomign IR like:

```text
  04:     %v_4 := call_0o(*a, callType: NORMAL, name: foo, potentiallyRefined: false)
  05:     %v_5 := call_1f(%v_4, fix<1>, fixNum: 1, callType: NORMAL, name: ==, potentiallyRefined: false)
```

Notice that is calling 'foo' and not 'foo='????  If I extract this spec into its
own file then I see:

```text
  05:             attr_assign(*a, fix<1>, callType: NORMAL, name: foo=, potentiallyRefined: false)
```
WTF is going on here?  how would not copying and sharing the same backing line
end up causing this but only if run within a larger file?  The best I can figure
is another spec is doing something destructive to the backing array without
realizing it is shared.
enebo committed Jul 11, 2017
1 parent b710cd3 commit c635729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/lexer/LexingCommon.java
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ public void setRubySourceline(int line) {
}

public ByteList createTokenByteList() {
return new ByteList(lexb.unsafeBytes(), lexb.begin() + tokp, lex_p - tokp, getEncoding(), false);
return new ByteList(lexb.unsafeBytes(), lexb.begin() + tokp, lex_p - tokp, getEncoding(), true);
}

public ByteList createTokenByteList(int start) {

0 comments on commit c635729

Please sign in to comment.