Skip to content

Commit

Permalink
Merge branch '2.x' into 2.x_wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored Jul 11, 2023
2 parents 1439d21 + bab8cca commit 076f414
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Refactor] StreamIO and OpenSearchException foundation to core library ([#8035](https://github.com/opensearch-project/OpenSearch/pull/8035))
- Move span actions to Scope ([#8411](https://github.com/opensearch-project/OpenSearch/pull/8411))
- Add wrapper tracer implementation ([#8565](https://github.com/opensearch-project/OpenSearch/pull/8565))
- Fix painless casting bug, which crashes the OpenSearch process ([#8315](https://github.com/opensearch-project/OpenSearch/pull/8315))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public static PainlessCast getLegalCast(Location location, Class<?> actual, Clas
}
}

if (actual == def.class
if ((actual == def.class && expected != void.class)
|| (actual != void.class && expected == def.class)
|| expected.isAssignableFrom(actual)
|| (actual.isAssignableFrom(expected) && explicit)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ public void testVoidReturn() {
assertEquals(iae.getMessage(), "not a statement: result not used from addition operation [+]");
}

public void testDefToVoidReturnThrowsException() {
ClassCastException exception = expectScriptThrows(
ClassCastException.class,
() -> getEngine().compile("def_return_in_void", "def x=1;return x;", VoidReturnTestScript.CONTEXT, Collections.emptyMap())
);
assertEquals(exception.getMessage(), "Cannot cast from [def] to [void].");
}

public abstract static class FactoryTestConverterScript {
private final Map<String, Object> params;

Expand Down

0 comments on commit 076f414

Please sign in to comment.