-
-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type_append: Assertion 0
failed
#2867
Comments
I have been able to get around this failed assertion by replacing the partially applied behavior with a call to the behavior on a captured reference of the actor as seen here. The relevant bits: ...
// let pa_muxed: {(C)} val = recover val this~_muxed_sink[C](channel_tag) end
let self: Reactor[E] tag = this
// Build the connector.
let connector = Connector[C, E](
where
channel' = object val is Channel[C]
let _channel_tag: ChannelTag = channel_tag
// let _pa_muxed: {(C)} val = pa_muxed
fun channel_tag(): ChannelTag => _channel_tag
fun shl(ev: C) =>
// _pa_muxed(consume ev)
self.muxed_sink[C](_channel_tag, consume ev)
end,
events' = BuildEvents.emitter[C](),
reactor_state' = reactor_state(),
reservation' = reservation
)
... The two look equivalent to me, but I suppose the cases are handled differently or at different times by the compiler. Hopefully this can provide some insight. A working |
I am still wraping my head around this, trying to create a simplified example and understanding the issue. It seems the typeargs to some function are not completely reified, they still are a Here is the AST for the expression below: let pa_muxed: {(C)} val = recover val this~_muxed_sink[C](channel_tag) end where
|
This sounds right given actor Main is Reactor[None]
...
let conn = open[(ChannelReservation | None)]()
... |
I just wanted to make part of the record a simpler example which was thought to be possibly connected (as discussed on IRC). The insight being that the compiler is reporting type names as the type parameter variables themselves, indicating that something's perhaps not being reified. Here is the playground, and the error:
Edit: This comment since broken out into a separate issue: #2881 |
Chatted about this on the sync call. I think @mfelsche is onto something when it comes to Main being treated specially. In |
Unfortunately i think this issue is not related to special treatment of the |
I was about to mention the same after listening to the sync call. Do you still think the related example is connected in any way? If not I suppose a new issue is in order. For what it's worth, I've worked around the assert presented in this issue, but cannot get around the above problem. Both examples involve object literals and generics. I'm thinking the issue still lies somewhere therein. I am going to have another go at attempting a simpler repro soon. |
I have written code triggering a
pony_assert(0)
found in genname.c type_append:Backtrace
Attempting to compile the code triggering the error (detailed below) inside LLDB reveals the following backtrace (frame # 3 being where
pony_assert
fails):Possibly helpful, as you can see above, probing the frame variable
type
revealsast_id(type)
to be that ofTK_TYPEPARAMREF
.Triggering Code
patternspandemic/pony-reactors@90685be
I could not duplicate the error in a simpler case, and so offer the original code to reproduce it. The commit as linked above is also tagged
type_append
. The above failed assertion can be reproduced by compiling the program found inexamples/basic/
.As much as I understand it, the compiler does not like my use / combination of, or closure over partially applied generic methods as seen here. The method
open
basically packages up a partially applied behavior in aval
object for latter use, by for example..Another line, found here, is an example of when such a method will be called. In fact commenting out this line results in not triggering the assert in question, perhaps because the compiler determined the partially applied method could no longer be reached.
Please let me be of assistance if you have an questions about the provided source. I am sure my intentions are not easy to decipher when they are laid out in generics, partial application, subtyping, and various object literals. I will continue to attempt to find a simpler example reproducing the assert.
pony version:
The text was updated successfully, but these errors were encountered: