Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Summary
If i try to create a class that derives from listenable(t)
, i can not override the Subscribe
function.
Steps to Reproduce
Copy paste this into a verse file:
# Base implementation for events on `creative_device`s.
device_event(t:type)<computes> := class<abstract>(listenable(t)):
EventName<public>:[]char
# Partial implementation of `device_event(:type)` with no return payload.
device_event()<computes> := device_event(tuple())
# Implementation of `device_event(:type)` with required `agent` payload.
device_event_agent := class(device_event(agent)):
# Subscribes Callback to this event. That same Callback will only be triggered once per event even if it is called with Subscribe more than once.
Subscribe<override>(Callback:type {__(:agent):void})<transacts>:cancelable = Err()
Await<override>()<suspends>:agent = Err()
The Subscribe override will show this error:
Using a value of type type{_(:agent->void)<transacts>:cancelable} as a value of type type{_(:any->void)<transacts>:cancelable} is not yet implemented.(3502)
However this is clearly supposed to work. It also works in the VerseDevices.Digest.verse file, where we have this:
# Base implementation for events on `creative_device`s.
device_event<native><epic_internal>(t:type)<computes> := class<abstract>(listenable(t)):
EventName<native><public>:[]char
# Partial implementation of `device_event(:type)` with no return payload.
device_event<epic_internal>()<computes> := device_event(tuple())
# Implementation of `device_event(:type)` with no payload.
device_event_void<native><epic_internal> := class(device_event(tuple())):
# Subscribes Callback to this event. That same Callback will only be triggered once per event even if it is called with Subscribe more than once.
Subscribe<native><override>(Callback:type {__():void})<transacts>:cancelable
Await<native><override>()<suspends>:tuple()
# Implementation of `device_event(:type)` with required `agent` payload.
device_event_agent<native><epic_internal> := class(device_event(agent)):
# Subscribes Callback to this event. That same Callback will only be triggered once per event even if it is called with Subscribe more than once.
Subscribe<native><override>(Callback:type {__(:agent):void})<transacts>:cancelable
Await<native><override>()<suspends>:agent
Expected Result
It should work without error.
Observed Result
It errors.
Platform(s)
All