Skip to content

Assertion, that a key has to be present to be removed. #972

@marat-gainullin

Description

@marat-gainullin

In the following code snippet, the assertion fails. If out of compile code, GraalVM asserts, that the removed key has to be present.
This is strange, as the remove is usually idempotent. Besides, for the compiled code it works as expected.

        try (Engine engine = Engine.newBuilder(JavaScriptLanguage.ID).build()) {
            try (var context = Context
                    .newBuilder(JavaScriptLanguage.ID)
                    .engine(engine)
                    .allowHostAccess(HostAccess.ALL)
                    .allowIO(IOAccess.ALL)
                    .allowValueSharing(true)
                    .build()
            ) {
                final Value jsSample = context.eval(Source
                        .newBuilder(JS, """
                                    const sample = {p1: 23, foo: 'bar'}
                                    sample
                                    """, "obj-source.js")
                        .build()
                );
                jsSample.removeMember("notExistent1"); //  <- Hier the exception is thrown if out of compiled code
                jsSample.removeMember("notExistent2");
            }
        }

Can you please investigate the problem and help with this?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions