nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.34k stars 1.47k forks source link

Error: Expected a node of kind nnkSym, got nnkBracketExpr #19966

Closed eggplants closed 2 years ago

eggplants commented 2 years ago

An definition of a tuple type raises Expected a node of kind nnkSym, got nnkBracketExpr at the compile time and I cannot finish compiling.

Example

My Repo: https://github.com/eggplants/fushin

Problematic line: https://github.com/eggplants/fushin/blob/a61c50f5bef9d7ec26eb8989a8febb92303d7491/src/fushinpkg/submodule.nim#L22

Current Output

$ nimble run
.....................................................................................................................................
stack trace: (most recent call last)
/home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(205, 10) genUnpackM
/home/eggplants/.choosenim/toolchains/nim-1.6.6/lib/core/macros.nim(640, 24) expectKind
/home/eggplants/prog/fushin/src/fushin.nim(12, 8) template/generic instantiation of `writeToCsv` from here
/home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(354, 13) template/generic instantiation of `writeToCsv` from here
/home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(333, 20) template/generic instantiation of `lines` from here
/home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(295, 25) template/generic instantiation of `genUnpack` from here
/home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(232, 20) template/generic instantiation of `genUnpackM` from here
/home/eggplants/prog/fushin/src/fushinpkg/submodule.nim(22, 16) Error: Expected a node of kind nnkSym, got nnkBracketExpr

Expected Output

(no error)

Possible Solution

nope

Additional Information

I am a real beginner started using Nim 5 hours ago...

$ nim -v
Nim Compiler Version 1.6.6 [Linux: amd64]
Compiled at 2022-05-05Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 0565a70eab02122ce278b98181c7d1170870865cactive boot switches: -d:release

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy
beef331 commented 2 years ago

This is unrelated to Nim it's an issue with the csvtools module you can tell cause the code happens inside csvtools.nim before it errors in your code, the exact line that the issue is from: /home/eggplants/.nimble/pkgs/csvtools-0.2.1/csvtools.nim(232, 20) template/generic instantiation ofgenUnpackMfrom here