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

ARC/nimSeqsV2 breaks seq at compile-time (macro) #16847

Closed
codehz opened this issue Jan 27, 2021 · 1 comment
Closed

ARC/nimSeqsV2 breaks seq at compile-time (macro) #16847

codehz opened this issue Jan 27, 2021 · 1 comment

Comments

@codehz
Copy link
Contributor

codehz commented Jan 27, 2021

Example

macro Bug() =
  let a = @[123]
  discard @[456] & a
  let c = @[789] & a
  assert c[1] == 123

Bug()

command line: nim check --gc:arc a.nim

Current Output

Hint: used config file 'C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\config\config.nims' [Conf]
....
stack trace: (most recent call last)
D:\Temp\nimbug\b.nim(5, 11) Bug
C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\lib\system\assertions.nim(30, 26) failedAssertImpl
C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\lib\system\assertions.nim(23, 11) raiseAssert
C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\lib\system\fatal.nim(49, 5) sysFatal
D:\Temp\nimbug\b.nim(7, 4) template/generic instantiation of `Bug` from here
C:\Users\CodeHz\.choosenim\toolchains\nim-1.4.2\lib\system\fatal.nim(49, 5) Error: unhandled exception: D:\Temp\nimbug\b.nim(5, 10) `c[1] == 123`  [AssertionDefect]

Expected Output

should no error at compile-time

Possible Solution

replace seq with another user-defined list

Additional Information

$ nim -v
Nim Compiler Version 1.4.2 [Linux: amd64]
Compiled at 2020-12-20
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release -d:danger
@codehz codehz changed the title ARC/nimSeqsV2 breaks compile-time evaluation (macro) ARC/nimSeqsV2 breaks seq at compile-time (macro) Jan 28, 2021
@ghost
Copy link

ghost commented Feb 28, 2021

Superseded by #16847 (same issue, but a bit more explanation)

This issue was closed.
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