From 2b838d1ea63b04674bde6a26c71de03e5647d0b3 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Tue, 6 Oct 2020 15:58:23 -0700 Subject: [PATCH] fix expression type for null safe operator (#63367) An invalid void expression type from a null safe operator caused ClassFormatError for the script Map x= ['0': 0]; x?.0 > 1. This change sets and propagates the correct expression type for the null safe operator to be written out. --- .../painless/phase/DefaultUserTreeToIRTreePhase.java | 3 ++- .../src/test/java/org/elasticsearch/painless/ElvisTests.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultUserTreeToIRTreePhase.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultUserTreeToIRTreePhase.java index 254faccb326..abecf1ac88e 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultUserTreeToIRTreePhase.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultUserTreeToIRTreePhase.java @@ -436,15 +436,16 @@ public class DefaultUserTreeToIRTreePhase implements UserTreeVisitor 5.0")); + assertEquals(false, exec("List x = [0]; x?.0 > 5.0")); assertEquals(1, exec("return params.a?.b ?: 1")); assertEquals(1, exec("return params.a?.b ?: 2", singletonMap("a", singletonMap("b", 1)), true));