Merge branch 'topic/fix_interface_internal' into 'master'

Generic interface: ignore internal properties when looking for implementation.

Closes #909

See merge request eng/libadalang/langkit!1329
This commit is contained in:
Romain Béguet
2025-03-10 12:17:18 +00:00
4 changed files with 32 additions and 1 deletions

View File

@@ -287,7 +287,8 @@ def find_implementations_of_method(
)
for m in class_members:
if (
m.original_name not in implementations
not m.is_internal
and m.original_name not in implementations
and m.implements == method
):
implementations[m.original_name] = m

View File

@@ -0,0 +1,25 @@
# Defining an env spec in a class implementing an interface used to cause a
# compilation error.
import lexer_example
grammar foo_grammar {
@main_rule main_rule <- BarNode("example")
}
@generic_interface()
trait Interface {
fun method(): Bool
}
class FooNode implements Node[FooNode] {
}
class BarNode: FooNode implements Interface {
@exported
fun prop(): Bool implements Interface.method = true
env_spec {
add_env()
}
}

View File

@@ -0,0 +1,4 @@
== foo.lkt ==
Code generation was successful
lkt_compile: Done

View File

@@ -0,0 +1 @@
driver: lkt_compile