hold a function type's parameters by value on the interface

A record a pub function type took or returned by value was declared
only, so an importer could neither define a callback for it nor call
one.
This commit is contained in:
2026-10-15 14:44:34 +03:00
parent 1599832ece
commit 4ac386f373
2 changed files with 14 additions and 2 deletions

View File

@@ -527,6 +527,15 @@ ahead of its pub forms."
"held by value"))
(test-assert "returned"
(interface-reports? "(record cell ((v int))) (pub fn f () cell)" "held by value"))
(test-assert "or taken by a function a pub one takes"
(interface-reports? "(record cell ((v int))) (pub fn take ((cb (fn ((c cell)) void))) void)"
"held by value"))
(test-assert "or returned by one"
(interface-reports? "(record cell ((v int))) (pub fn take ((cb (fn () cell))) void)"
"held by value"))
(test "but a pointer there is still a pointer"
'((record cell))
(interface-of "(record cell ((v int))) (pub fn take ((cb (fn ((c (* cell))) void))) void)"))
(test-assert "or taken by a pub method"
(interface-reports? "(record cell ((v int))) (ops cell (pub fn get ((self cell)) int))"
"held by value"))