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

Compiler crash, no traceback, concepts #796

Open
juancarlospaco opened this issue Aug 4, 2021 · 0 comments
Open

Compiler crash, no traceback, concepts #796

juancarlospaco opened this issue Aug 4, 2021 · 0 comments
Labels
bug Something isn't working compiler js

Comments

@juancarlospaco
Copy link
Collaborator

type Iterable[T] = concept x
  for value in x:
    value is T

func ani[T](iter: Iterable[T]): bool =
  result = false
  for element in iter:
    if bool(element):
      return true

discard ani([true, false])
$ nim c file.nim
58758 lines; 1.440s; 76.566MiB peakmem; proj: file.nim; out: file [SuccessX]

$ nim cpp file.nim
26606 lines; 0.397s; 32.035MiB peakmem; proj: file.nim; out: file [SuccessX]

$ nim js file.nim
internal error: expr(nkBracketExpr, tyUserTypeClassInst)
No stack traceback available

$

Reduced from a library that mimics some Python-like constructs,
works for C/CPP, but compiler crashes for JS targets.

@juancarlospaco juancarlospaco added bug Something isn't working js compiler labels Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler js
Projects
None yet
Development

No branches or pull requests

1 participant