Description
When we use a function call to create the value of a key, we know the output type that the function call should return thanks to the key value type. This should restrict the functions that are picked when composing the function call.
For example, when we use a function call as the value of the key Z11K2, because the key expects a type of Z6/String, we should only be able to call functions that return Z6/String. However, the lookup searches in all available Functions, even if they don't return the expected type. As shown in the screenshot, the functions selector lookup does not restrict the options to the given type, and is displaying options that return different types (in the image, Z6/String is expected, but some Z40/Boolean emitting functions are also displayed in the dropdown):
Additional details
This information is available in the ZObjectKeyValue parent of the ZReference that renders the ZObjectSelector that's used to pick the function, so it should be simple to propagate this by just adding the right props in ZReference component.
The component ZObjectSelector can restrict searches easily by combining the properties type and returnType. To search for all objects of type Z8/Function just use :type="Z8", but if we want to also restrict the output types of the function (for example, to Z6/String), we should use (edited) :return-type="Z6".
When to restrict returnType when selecting functions?
Only when they are expected to be resolved and a wrong output type would result in an invalid ZObject:
- ZReference component in edit mode
- Expected type is Z8/Function
- The function is part of a function call (key is Z7K1)
How to know what is the expected type??
- The parent ZObjectKeyValue computes this information in the parentExpectedType property
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist

