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 #8335

Closed
ghost opened this issue Jul 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@ghost
Copy link

commented Jul 16, 2018

Filename-t.nim

import t2

t.t2 = t2

(t2.nim is an empty file)

gives -

Traceback (most recent call last)
nim.nim(133)             nim
nim.nim(97)              handleCmdLine
main.nim(162)            mainCommand
main.nim(73)             commandCompileToC
modules.nim(124)         compileProject
modules.nim(71)          compileModule
passes.nim(194)          processModule
passes.nim(103)          processTopLevelStmt
sem.nim(592)             myProcess
sem.nim(560)             semStmtAndGenerateGenerics
semstmts.nim(1891)       semStmt
semexprs.nim(910)        semExprNoType
semexprs.nim(2514)       semExpr
semexprs.nim(1531)       semAsgn
ast.nim(1410)            skipTypes
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Apart from this, I have a question -
Why is this get compiled and what does the t. do in here?
Filename-t.nim

type
  C = object

var c = C()
t.c = c
echo t.c

echo t fails though with Error: type mismatch: got <void>

@Araq

This comment has been minimized.

Copy link
Member

commented Jul 18, 2018

A module t has the symbol t that refers to itself, this can be used for disambiguation, like strutils.foo vs parseutils.foo.

krux02 added a commit to krux02/Nim that referenced this issue Nov 8, 2018

@Araq Araq closed this in a147166 Nov 8, 2018

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.