-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[duplicate] Generic casting doesn't work in VM #9423
Labels
Comments
when defined case3a:
type Foo[T] = object
x: int
type Foo1 = Foo[int]
type Foo2 = distinct Foo1
template fn() =
var a = Foo2(Foo1(x: 1))
a.Foo1.x = 2
echo a.Foo1
fn()
static: fn() when defined case3:
type Foo = seq[int]
type Foo2 = distinct Foo
template fn() =
var a = Foo2(@[1])
a.Foo.add 2
echo a.Foo
fn()
static: fn() case3a works
=> it fails with seq and string and works with object including generic object |
timotheecour
changed the title
Generic casting doesn't work in VM
[duplicate] Generic casting doesn't work in VM
Dec 8, 2020
timotheecour
added a commit
to timotheecour/Nim
that referenced
this issue
Mar 31, 2021
timotheecour
added a commit
to timotheecour/Nim
that referenced
this issue
Mar 31, 2021
Araq
pushed a commit
that referenced
this issue
May 10, 2023
* fix #9423 distinct generics now work in vm * fixes cpp tests --------- Co-authored-by: Timothee Cour <[email protected]>
capocasa
pushed a commit
to capocasa/Nim
that referenced
this issue
May 15, 2023
… in VM (nim-lang#21816) * fix nim-lang#9423 distinct generics now work in vm * fixes cpp tests --------- Co-authored-by: Timothee Cour <[email protected]>
capocasa
pushed a commit
to capocasa/Nim
that referenced
this issue
May 16, 2023
… in VM (nim-lang#21816) * fix nim-lang#9423 distinct generics now work in vm * fixes cpp tests --------- Co-authored-by: Timothee Cour <[email protected]>
narimiran
pushed a commit
that referenced
this issue
Jun 19, 2023
bung87
pushed a commit
to bung87/Nim
that referenced
this issue
Jul 29, 2023
… in VM (nim-lang#21816) * fix nim-lang#9423 distinct generics now work in vm * fixes cpp tests --------- Co-authored-by: Timothee Cour <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following the deficiencies I found with the
deques
module I tried to implement my own stack data structure (which is what I was using adeque
for). It however also ran into trouble when run under a VM. It appears like the conversion back from aStack[T]
type to aseq[T]
makes the VM copy the object while compiled Nim allows this like you would expect. I tried the same with a distinct string instead of a sequence but that didn't seem to trigger the issue so I'm guessing it has to do with the generics.The text was updated successfully, but these errors were encountered: