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

Object variants and new runtime #11563

Closed
sinkingsugar opened this issue Jun 22, 2019 · 4 comments

Comments

@sinkingsugar
Copy link
Contributor

commented Jun 22, 2019

I know that you are working on new runtime a lot @Araq , and it is very much appreciated!
I was wondering if Object variants (aka unions) are going to be supported any time soon?

Currently I have this kind of error when trying to use them with --newruntime
Error: internal error: cannot generate C type for: MyType

This current work I'm trying to wrap in around a month or two has big issues with GC and would very much benefit from newruntime.
To be honest anything I do in nim currently is pretty much using newruntime as design.

@sinkingsugar

This comment has been minimized.

Copy link
Contributor Author

commented Jun 22, 2019

I'll add an example cos apparently only few cases cause this issue, closing for now.

@sinkingsugar

This comment has been minimized.

Copy link
Contributor Author

commented Jun 22, 2019

type
  MyTypeType = enum
    Zero, One
  MyType = object
    case kind: MyTypeType
    of Zero:
      s*: seq[MyType]
    of One:
      x*: int
var t: MyType

So yes it seems that the issue is the nested type in the seq, changing it to int works.
This might just be a bug.

@sinkingsugar sinkingsugar reopened this Jun 22, 2019

@Araq Araq added the New runtime label Jun 23, 2019

Araq added a commit that referenced this issue Jun 26, 2019

@Araq Araq closed this in 0f868b5 Jun 26, 2019

@sinkingsugar

This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2019

Beautiful! Thanks!

narimiran added a commit that referenced this issue Jun 27, 2019

fixes #11563 (#11594)
(cherry picked from commit 0f868b5)
@sinkingsugar

This comment has been minimized.

Copy link
Contributor Author

commented Jun 28, 2019

@Araq cpp backend fails with:
cannot convert 'tySequence_uB9b75OUPRENsBAu4AnoePA*' to 'tySequence_uB9b75OUPRENsBAu4AnoePA_Content*' in assignment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.