From 0003c3864173be1fdf0467205678d28349cf241b Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Tue, 21 Jul 2026 14:39:54 -0500 Subject: [PATCH] Store the key in error for later inspection If this is not stored, the error later on does not think this is key-related, and raises the wrong error. See jruby/jruby#9546 --- src/main/java/org/jruby/prism/builder/IRBuilderPrism.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jruby/prism/builder/IRBuilderPrism.java b/src/main/java/org/jruby/prism/builder/IRBuilderPrism.java index 8adeb2f..d30a92f 100644 --- a/src/main/java/org/jruby/prism/builder/IRBuilderPrism.java +++ b/src/main/java/org/jruby/prism/builder/IRBuilderPrism.java @@ -2532,6 +2532,7 @@ protected void buildAssocs(Label testEnd, Operand original, Variable result, Has // FIXME: only build literals (which are guaranteed to build without raising). Operand key = build(assoc.key); call(result, d, "key?", key); + copy(errorString, key); // Sets to symbol which will not be nil or a regular string. cond_ne_true(testEnd, result); String method = hasRest ? "delete" : "[]";