When a collection function invocation is invoked, the mapping is optimized by replacing the collection function with the corresponding underlying sequence function. A reference to this sequence function is obtained from the root namespace cache, and the reference is then mapped to the opaque behavior implementing the library function. However, the logic for mapping the sequence function uses getElement() to get the mapped element, which does not trigger actual mapping if it has not already happened. If the mapping for the needed sequence has not been otherwise been triggered, then the returned element will be null, resulting in a mapping error.
When a collection function invocation is invoked, the mapping is optimized by replacing the collection function with the corresponding underlying sequence function. A reference to this sequence function is obtained from the root namespace cache, and the reference is then mapped to the opaque behavior implementing the library function. However, the logic for mapping the sequence function uses getElement() to get the mapped element, which does not trigger actual mapping if it has not already happened. If the mapping for the needed sequence has not been otherwise been triggered, then the returned element will be null, resulting in a mapping error.