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

genericAssignAux runtime error #16706

Closed
timotheecour opened this issue Jan 13, 2021 · 2 comments
Closed

genericAssignAux runtime error #16706

timotheecour opened this issue Jan 13, 2021 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Jan 13, 2021

reduced a bit from a case mentioned in forum /cc @xflywind

Hi, could anybody help me understand the error here? https://play.nim-lang.org/#ix=2LRt

Example

when true:
  import tables, times
  type
    Shift* = object
      date*: DateTime
  type
    Data* = object
      shifts*: OrderedTable[int, Shift]


  var shifts = initOrderedTable[int, Shift]()
  var data = Data(shifts: shifts)

Current Output

/Users/timothee/git_clone/nim/timn/tests/nim/all/t11694.nim(76) t11694
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(175) genericSeqAssign
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(139) genericAssign
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(100) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(128) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(26) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(22) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(128) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(22) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assign.nim(125) genericAssignAux
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: invalid object assignment [ObjectAssignmentDefect]

Expected Output

works

Additional Information

devel 1.5.1 61fd19c

@ringabout
Copy link
Member

Reduced examples:

import std/times

type
  Data = object
    shifts*: seq[DateTime]

var shifts = newSeq[DateTime](5)
var data = Data(shifts: shifts)

ringabout added a commit to ringabout/Nim that referenced this issue Jan 14, 2021
@Araq Araq closed this as completed in ef9027c Jan 14, 2021
@timotheecour
Copy link
Member Author

timotheecour commented Jan 14, 2021

further reduced without any import:

when true:
  type
    A = object of RootObj
      a0: string
    B = object
      b0: seq[A]
  var c = newSeq[A](2)
  var d = B(b0: c)

=> #16721

ringabout added a commit to ringabout/Nim that referenced this issue Jan 15, 2021
This reverts commit a08d93b.
narimiran pushed a commit that referenced this issue Feb 1, 2021
(cherry picked from commit ef9027c)
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants