Skip to content

Compiler crash, no traceback, concepts #796

@juancarlospaco

Description

@juancarlospaco
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions