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

Type redefinition and construction will break nim check #3032

Closed
Wh1teDuke opened this issue Jul 1, 2015 · 1 comment
Closed

Type redefinition and construction will break nim check #3032

Wh1teDuke opened this issue Jul 1, 2015 · 1 comment

Comments

@Wh1teDuke
Copy link
Contributor

type 
  Foo = enum A, B, C
  A = object
    f: Foo

proc bar(f: Foo): A = A(f: f)

Under nim c: test.nim(2, 14) Error: redefinition of 'A'
But, under nim check:

test.nim(2, 14) Error: redefinition of 'A'
test.nim(6, 19) Error: type expected
test.nim(6, 23) Error: type expected
test.nim(6, 24) Error: object constructor needs an object type
Traceback (most recent call last)
nim.nim(97)              nim
nim.nim(61)              handleCmdLine
main.nim(330)            mainCommand
main.nim(46)             commandCheck
modules.nim(206)         compileProject
modules.nim(154)         compileModule
passes.nim(193)          processModule
passes.nim(137)          processTopLevelStmt
sem.nim(455)             myProcess
sem.nim(424)             semStmtAndGenerateGenerics
semstmts.nim(1410)       semStmt
semexprs.nim(906)        semExprNoType
semexprs.nim(2236)       semExpr
semstmts.nim(1199)       semProc
semstmts.nim(1139)       semProcAux
transf.nim(795)          transformBody
sempass2.nim(866)        trackProc
sempass2.nim(773)        track
sempass2.nim(710)        track
sempass2.nim(756)        track
system.nim(2358)         sysFatal
Error: unhandled exception: sym is not accessible [FieldError]

nim -v

Nim Compiler Version 0.11.3 (2015-07-01) [Windows: i386]
Copyright (c) 2006-2015 by Andreas Rumpf

git hash: e1ddf2b17525052cf4840820b0f05343fd5a92b3

nim branch: * devel
command: nim c test.nim and nim check test.nim

@Araq Araq closed this as completed in 1555f41 Jul 1, 2015
@Wh1teDuke
Copy link
Contributor Author

You are faster than light. Great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant