Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public static IntegerMathInstr decode(IRReaderDecoder d) {
@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
e.encode(getOperand1());
e.encode(getOperand2());
e.encode(op.ordinal());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public static TemporaryLocalVariable decode(IRReaderDecoder d) {
case CURRENT_MODULE: return TemporaryCurrentModuleVariable.decode(d);
case FLOAT: return TemporaryFloatVariable.decode(d);
case FIXNUM: return TemporaryFixnumVariable.decode(d);
case INT: return TemporaryIntVariable.decode(d);
case BOOLEAN: return TemporaryBooleanVariable.decode(d);
case LOCAL: return d.getCurrentScope().getManager().newTemporaryLocalVariable(d.decodeInt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,10 @@ public Instr decodeInstr() {
case ALIAS: return AliasInstr.decode(this);
case ARRAY_DEREF: return ArrayDerefInstr.decode(this);
case ATTR_ASSIGN: return AttrAssignInstr.decode(this);
case AS_FIXNUM: return AsFixnumInstr.decode(this);
case AS_STRING: return AsStringInstr.decode(this);
case B_FALSE: return BFalseInstr.decode(this);
case B_INT: return BIntInstr.decode(this);
case B_NIL: return BNilInstr.decode(this);
case B_SWITCH: return BSwitchInstr.decode(this);
case B_TRUE: return BTrueInstr.decode(this);
Expand Down Expand Up @@ -301,6 +303,7 @@ public Instr decodeInstr() {
case GVAR_ALIAS: return GVarAliasInstr.decode(this);
case INHERITANCE_SEARCH_CONST: return InheritanceSearchConstInstr.decode(this);
case INSTANCE_SUPER: return InstanceSuperInstr.decode(this);
case INT_MATH: return IntegerMathInstr.decode(this);
case JUMP: return JumpInstr.decode(this);
case LABEL: return LabelInstr.decode(this);
case LAMBDA: return BuildLambdaInstr.decode(this);
Expand Down
7 changes: 7 additions & 0 deletions spec/compiler/general_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,13 @@
run("def foo; case 0; when 1; return 2 if self.nil?; end; return 3; end; foo") {|result| expect(result).to eq 3 }
end

# See https://github.com/jruby/jruby/issues/9834
it "compiles array patterns" do
run('[([1] in [1]), ([1, 2] in [_, 2]), ([1, 2, 3] in [1, *r]) && r, (case [3]; in [x] then x; end)]') do |x|
expect(x).to eq [true, true, [2, 3], 3]
end
end

it "assigns named groups in regular expressions to local variables" do
# named groups with capture
run("
Expand Down Expand Up @@ -1262,9 +1269,9 @@

it "handles nested [], loops, and break" do
run('def foo
while 1

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal in condition

Check warning on line 1272 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal in condition
"x"[0]
while 1

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal in condition

Check warning on line 1274 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal in condition
raise "ok"
break
end
Expand Down Expand Up @@ -1502,8 +1509,8 @@
end

it "calls struct field methods" do
run('StructTest1 = Struct.new(:foo); st1 = StructTest1.new; st1.foo = 1; st1.foo') {|x| expect(x).to eq(1)}

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

already initialized constant StructTest1

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

already initialized constant StructTest1

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

already initialized constant StructTest1

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

already initialized constant StructTest1

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

already initialized constant StructTest1

Check warning on line 1512 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

already initialized constant StructTest1
run('StructTest2 = Struct.new(:foo); class StructTest2; def do_foo; self.foo = 1; foo; end; end; StructTest2.new.do_foo') {|x| expect(x).to eq(1)}

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

already initialized constant StructTest2

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

already initialized constant StructTest2

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

already initialized constant StructTest2

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

already initialized constant StructTest2

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

already initialized constant StructTest2

Check warning on line 1513 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

already initialized constant StructTest2
end

it "calls aref with string key" do
Expand Down Expand Up @@ -1602,7 +1609,7 @@
it "compiles debug chilled strings that can be modified without impacting other strings" do
JRuby.runtime.instance_config.debugging_frozen_string_literal = true
run(<<~CHILLED) {|val| expect(val).to eq("")}
str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 21 -indy)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 25 -indy)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal string will be frozen in the future, the string was created here: str = ""

Check warning on line 1612 in spec/compiler/general_spec.rb

View workflow job for this annotation

GitHub Actions / rake spec:compiler (Java 27 -indy)

literal string will be frozen in the future, the string was created here: /home/runner/work/jruby/jruby/spec/compiler/general_spec.rb:1612
str << "hello"
""
CHILLED
Expand Down
Loading