Files
langkit/testsuite/tests/python_api/array-struct-array/test.lkt
Pierre-Marie de Rodat e1c4fe5804 Introduce the lkt_build_and_run test driver
Transition all relevant testcases to it. In the process, port
docstrings/comments from test.py files to expected_concrete_syntax.lkt
(now test.lkt) sources and fix stylechecks issues there.
2024-10-15 14:13:10 +00:00

27 lines
546 B
Plaintext

# Check that the Python bindings to wrap/unwrap arrays of structs of arrays work
# as expected.
import lexer_example
@with_lexer(foo_lexer)
grammar foo_grammar {
@main_rule main_rule <- Example("example")
}
@abstract
class FooNode implements Node[FooNode] {
}
class Example: FooNode {
@exported
fun example_holders(): Array[ExampleHolder] =
[ExampleHolder(examples=[self])]
@exported
fun identity(a: Array[ExampleHolder]): Array[ExampleHolder] = a
}
struct ExampleHolder {
examples: Array[Entity[Example]]
}