litvis icon indicating copy to clipboard operation
litvis copied to clipboard

Triple hat call in child document doesn't recognise function in parent document

Open jwoLondon opened this issue 6 years ago • 0 comments

Suppose we have a function defined in a document:

parent.md

```elm{l=hidden}
myFunction : String
myFunction =
    "Hello from parent"
```

And if a child document that follows it makes a call to the parent via a triple hat expression:

child.md

---
follows: parent
---

^^^elm {r=myFunction}^^^

This results in the error I cannot find a 'myFunction' variable

However if some other function is declared in the child document, the function in the parent is called correctly:

---
follows: parent
---

^^^elm {r=myFunction}^^^

```elm {l=hidden}
anotherFunction : Int
anotherFunction =
    7
```

It would appear that there must be at lest one declared function within a document before a triple hat expression can reference a function in parent (or grandparent etc.) document. This will prevent 'clean' documents from being created that have no code but reference functions from other documents in the hierarchy.

jwoLondon avatar Jun 19 '19 12:06 jwoLondon