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

nested genericParams crash #16600

Open
mratsim opened this issue Jan 5, 2021 · 0 comments
Open

nested genericParams crash #16600

mratsim opened this issue Jan 5, 2021 · 0 comments

Comments

@mratsim
Copy link
Collaborator

mratsim commented Jan 5, 2021

The following crashes the compiler

import std/typetraits

func getBaseType(T: typedesc): typedesc =
  ## Unwrap nested seq/array to get the underlying base type
  when (T is seq|array):
    getBaseType(genericParams(T)[0])
  else:
    T


echo getBaseType(seq[seq[seq[int]]])

Error is

.../build/crash.nim(11, 17) template/generic instantiation of `getBaseType` from here
.../build/crash.nim(6, 30) template/generic instantiation of `genericParams` from here
.../build/crash.nim(11, 17) template/generic instantiation of `getBaseType` from here
.../build/crash.nim(6, 30) template/generic instantiation of `genericParams` from here
Error: internal error: /home/runner/work/nightlies/nightlies/nim/compiler/semtypes.nim(1899, 26)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details
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

1 participant