-
Notifications
You must be signed in to change notification settings - Fork 350
Closed as not planned
Description
The language reference says that a module amending another module inherits from all the members of the amended module. But functions of the amended module seem to be not inherited from as shown in the following example.
File base_template.pkl
persons: Listing<Person>
class Person {
name: String
}
function buildPerson(val: String): Person = new {
name = val
}
File my_template.pkl
amends "base_template.pkl"
persons {
new Person { name = "Me"}
buildPerson("you")
}
Evaluating my_template.pkl produces the following error
–– Pkl Error ––
Cannot find method `buildPerson`.
5 | buildPerson("you")
^^^^^^^^^^^^^^^^^^
at my_template#persons[#2] (file:///.../my_template.pkl, line 5)
3 | persons {
^^^^^^^^^
at my_template#persons (file:///.../my_template.pkl, line 3)
106 | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.base#Module.output.text (https://github.com/apple/pkl/blob/0.25.2/stdlib/base.pkl#L106)
Do I miss something?
Metadata
Metadata
Assignees
Labels
No labels