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

Mixin declaration in generic does not work #9567

Open
Araq opened this issue Oct 30, 2018 · 2 comments
Open

Mixin declaration in generic does not work #9567

Araq opened this issue Oct 30, 2018 · 2 comments

Comments

@Araq
Copy link
Member

Araq commented Oct 30, 2018

This should compile, but doesn't

proc enumToString*(enums: openArray[enum]): string =
  mixin e
  when e.low.ord >= 0 and e.high.ord < 256:
    result = newStringOfCap(enums.len)
  else:
    result = newStringOfCap(enums.len * 2)
  for e in enums:
    result.add(e.enumToString)
@mratsim
Copy link
Collaborator

mratsim commented Oct 31, 2018

Related to #8677 [Meta] Generics/Static early symbol resolution

@mratsim
Copy link
Collaborator

mratsim commented Nov 4, 2018

Fixing #8603 with f7c0e20 broke Arraymancer tensor concatenation due to the introduction of proc `|`*(a, b: typedesc): typedesc = discard in system.nim.

I fixed it by introducing mixin `|` in a generic proc via mratsim/Arraymancer@a4b79c8 so it actually works.

However the symbol still need to be forward declared (even if in another module) contrary to this example.

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

3 participants