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

Crash when compiling a-b.nim #720

Closed
iacore opened this issue May 24, 2023 · 4 comments · Fixed by #1354
Closed

Crash when compiling a-b.nim #720

iacore opened this issue May 24, 2023 · 4 comments · Fixed by #1354
Labels
bug Something isn't working compiler General compiler tag good first issue Easy-to-start-with issue with no in-depth knowledge or complex implementation required.

Comments

@iacore
Copy link
Contributor

iacore commented May 24, 2023

The compiler crashes with trying to compile a file with - in it.

❯ touch sol-nimskull.nim

❯ nimskull c sol-nimskull.nim
.......................................................
Error: invalid module name: '<nil tree>' [rsemInvalidModuleName]
modules.nim(114, 16) compiler msg instantiated here [MsgOrigin]
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp $1 <file>'
@saem saem added bug Something isn't working good first issue Easy-to-start-with issue with no in-depth knowledge or complex implementation required. compiler General compiler tag labels May 25, 2023
@disruptek
Copy link
Contributor

Error: invalid module name: '<nil tree>' [rsemInvalidModuleName]
modules.nim(107, 16) compiler msg instantiated here [MsgOrigin]
Nimskull Compiler Version 0.1.0-dev.21252 [linux: amd64]

Source hash: 1854db10bf8b35214222d69dbf90c21d7e8caf5f
Source date: 2024-03-07

active boot switches: -d:release -d:danger⏎

@saem
Copy link
Collaborator

saem commented Mar 8, 2024

At the very least a sensible error message, instead of a crash.


In the case of getting it to work, I'm not really sure how to balance:

The funky ways underscores can/could be inserted/omitted in identifies, and a potentially mandatory unskippable underscore.

@iacore
Copy link
Contributor Author

iacore commented Mar 8, 2024

there is also the Rust way of turning a-b into a_b

zevv added a commit to zevv/nimskull that referenced this issue Mar 8, 2024
  Error: invalid module name: '<nil tree>'

when trying to import a module with invalid name (for example, a module
containing a hyphen in the name).

This fixes issue nim-works#720.
github-merge-queue bot pushed a commit that referenced this issue Jun 19, 2024
## Summary
While the AST form of the error generated by  `modules/modulepaths`  is
handled in  `cli_reporter` , the symbol form was not, creating terrible
error messages such as:

    Error: invalid module name '<nil tree>'

This PR makes cli_reporter aware of the symbol form generated by 
`modules/modules` , fixing the bad error message.

## Details
*  `cli_reporter`  now handles the symbol form of 
`rsemInvalidModuleName`  correctly.
*  `modules/modules`  now raises  `rsemInvalidModuleName`  with line
information, allowing user and tools to know which file the error
originated from.

Fixes #720

---------

Co-authored-by: zerbina <[email protected]>
@zerbina
Copy link
Collaborator

zerbina commented Jun 19, 2024

Fixed by #1354.

@zerbina zerbina closed this as completed Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler General compiler tag good first issue Easy-to-start-with issue with no in-depth knowledge or complex implementation required.
Projects
None yet
4 participants