From d221cd14d219eaf77bb2d91cb4aa7956d518f3ca Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 15 May 2016 19:49:25 +0200 Subject: [PATCH] painless: Also remove boxing for reads and method calls --- .../main/java/org/elasticsearch/painless/node/EChain.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java index 4cfb35e48a8..463c9a5a4ff 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java @@ -242,6 +242,11 @@ public final class EChain extends AExpression { private void analyzeRead() { final ALink last = links.get(links.size() - 1); + // If the load node is a DEF node, we adapt its after type to use _this_ expected output type: + if (last instanceof ADefLink && this.expected != null) { + last.after = this.expected; + } + constant = last.string; statement = last.statement; actual = last.after;