Skip to content
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

generic sendable error #3570

Closed
EEVV opened this issue May 26, 2020 · 6 comments · Fixed by #3589
Closed

generic sendable error #3570

EEVV opened this issue May 26, 2020 · 6 comments · Fixed by #3589
Labels
help wanted Extra attention is needed

Comments

@EEVV
Copy link

EEVV commented May 26, 2020

https://playground.ponylang.io/?gist=cabc4cf1bc725250d8a688af896da229

class A[T: (T #send & T)]

it is one liner: I tried to have a generic sendable type, messing around with how I should actually do it and ended up with segmentation fault.

0.33.2 [release]
compiled with: llvm 9.0.1 -- cc (GCC) 9.2.0
Defaults: pic=true
Building builtin -> /usr/lib/pony/0.33.2/packages/builtin
Building . -> /home/eevv/offgit/reserver
Building debug -> /usr/lib/pony/0.33.2/packages/debug
Building collections -> /usr/lib/pony/0.33.2/packages/collections
Building ponytest -> /usr/lib/pony/0.33.2/packages/ponytest
Building time -> /usr/lib/pony/0.33.2/packages/time
Building random -> /usr/lib/pony/0.33.2/packages/random
Building net -> /usr/lib/pony/0.33.2/packages/net
Building files -> /usr/lib/pony/0.33.2/packages/files
Building buffered -> /usr/lib/pony/0.33.2/packages/buffered
Building term -> /usr/lib/pony/0.33.2/packages/term
Building promises -> /usr/lib/pony/0.33.2/packages/promises
Building strings -> /usr/lib/pony/0.33.2/packages/strings
Building signals -> /usr/lib/pony/0.33.2/packages/signals
Building capsicum -> /usr/lib/pony/0.33.2/packages/capsicum
Segmentation fault
@SeanTAllen SeanTAllen added bug help wanted Extra attention is needed needs investigation This needs to be looked into before its "ready for work" labels May 26, 2020
@teggotic
Copy link
Contributor

teggotic commented Jul 8, 2020

I'm a new to compiler architecture. Despite this, I tried to investigate this issue and got to this state.
With this diff
image
I get 100% tests passed and no seg fault here.
This is the output here
image
I don't mean in any way that my solution is OK. This is just what I've got to, playing around this issue

The issue is about the TK_TYPEPARAMREF. When we use T in our example then it's parsed as TK_TYPEPARAMREF instead of TK_NOMINAL. In such a case

cap_from_constraint(typeparam_constraint(type));

typeparam_constraint returns parent of the TK_TYPEPARAMREF and it starts recursively process itself. Here we get the seg fault

@SeanTAllen
Copy link
Member

@jemc thoughts?

@SeanTAllen
Copy link
Member

@EEVV thanks for opening this. I've pinged @jemc who knows this part of the compiler much better than me.

@jemc
Copy link
Member

jemc commented Jul 10, 2020

@teggotic's fix looks like the correct one. Nice work!

@jemc jemc removed the needs investigation This needs to be looked into before its "ready for work" label Jul 10, 2020
@SeanTAllen
Copy link
Member

@teggotic do you want to open a PR for this?

@teggotic
Copy link
Contributor

@teggotic do you want to open a PR for this?

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants