Inconsistent Behavior with WhereStep with labels

I'm getting some weird behavior when using labels on an anonymous traversal within the WhereStep. Below are some code examples - excuse the fact that they're kind of silly they're just meant to demonstrate the issue

final var tinkerg = TinkerFactory.createModern();
tinkerg.traversal().V().drop().iterate();
var g = tinkerg.traversal();
g.addV("v1").iterate();
g.addV("v2").iterate();
g.addE("test").from(v1).to(v2).iterate();
g.V().hasLabel("v1").as("testLabel")
                    .coalesce(
                            __.outE().where(__.inV()),
                            __.addE("edge").from(v1).to(v2)
                    ).iterate();
// The above does not add a second edge (as expected)
g.V().hasLabel("v1").as("testLabel")
                    .coalesce(
                            __.outE().where(__.inV().as("testLabel"),
                            __.addE("edge").from(v1).to(v2)
                    ).iterate();
// The above does add a second edge when it shouldn't (?)


What makes this even more interesting, is that on a more complex traversal with coalesce, the label doesn't seem to cause any problems...
Was this page helpful?