mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
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:
@@ -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
|
||||
|
||||
25
testsuite/tests/generic_interfaces/env_spec/foo.lkt
Normal file
25
testsuite/tests/generic_interfaces/env_spec/foo.lkt
Normal 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()
|
||||
}
|
||||
}
|
||||
4
testsuite/tests/generic_interfaces/env_spec/test.out
Normal file
4
testsuite/tests/generic_interfaces/env_spec/test.out
Normal file
@@ -0,0 +1,4 @@
|
||||
== foo.lkt ==
|
||||
Code generation was successful
|
||||
|
||||
lkt_compile: Done
|
||||
1
testsuite/tests/generic_interfaces/env_spec/test.yaml
Normal file
1
testsuite/tests/generic_interfaces/env_spec/test.yaml
Normal file
@@ -0,0 +1 @@
|
||||
driver: lkt_compile
|
||||
Reference in New Issue
Block a user