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

internal error when assigning a type to a constant of typedesc #9961

Closed
zevv opened this issue Dec 13, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@zevv
Copy link
Contributor

commented Dec 13, 2018

The following crashes the compiler:

import typetraits
import tables

proc test(v: typedesc) =
  echo v.type.name

# This works:
test Table

# This also works:
const a = Table
test a

# But this crashes the compiler
const b: typedesc = Table
test b
internal error: (filename: "semmagic.nim", line: 162, column: 17)
Nim Compiler Version 0.19.0 [Linux: amd64]
Compiled at 2018-09-26
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: f6c5c636bb1a1f4e1301ae0ba5a8afecef439132
active boot switches: -d:release
@krux02

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

Assigning a type to a constant constant of type typedesc. I never tried that. I guess Nim isn't strict enough here. I think neith const a = Table nor const b: typedesc = Table should be legal, since you can already create type aliases with the type declaration: type a = Table.

@krux02 krux02 changed the title internal error: (filename: "semmagic.nim", line: 162, column: 17) internal error when assigning a type to a constant of typedesc Jan 7, 2019

@narimiran narimiran added Crash and removed Crash internal error labels Feb 12, 2019

@narimiran narimiran closed this in 3b73da3 May 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.