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

Another variation of "Error: internal error: expr(skModule); unknown symbol" #23399

Closed
kraptor opened this issue Mar 13, 2024 · 0 comments · Fixed by #23400
Closed

Another variation of "Error: internal error: expr(skModule); unknown symbol" #23399

kraptor opened this issue Mar 13, 2024 · 0 comments · Fixed by #23400

Comments

@kraptor
Copy link
Contributor

kraptor commented Mar 13, 2024

Description

I found another way to trigger a compiler crash with the output:
Error: internal error: expr(skModule); unknown symbol

Example:

when isMainModule:
  import std/sequtils
  sequtils

Nim Version

Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-03-13
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 78c834d
active boot switches: -d:release

Current Output

$ nim r program.nim                                                                                                                
Hint: used config file '/home/kraptor/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
Hint: used config file '/home/kraptor/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]
.........................................................................
/home/kraptor/program.nim(3, 3) Error: internal error: expr(skModule); unknown symbol
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp r <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

Expected Output

The same error when when isMainModule: is not used (or any other useful error):

Error: expression has no type: 
import
  sequtils

sequtils

Possible Solution

No response

Additional Information

Related bugs:

metagn added a commit to metagn/Nim that referenced this issue Mar 13, 2024
Araq pushed a commit that referenced this issue Mar 14, 2024
fixes #23399

The new case introduced in #21657 is triggered by `efWantStmt` but the
`when` statement doesn't normally propagate this flag, so propagate it
when the `semCheck` param in `semWhen` is true which happens when the
`when` statement is `efWhenStmt` anyway.
narimiran pushed a commit that referenced this issue Apr 22, 2024
fixes #23399

The new case introduced in #21657 is triggered by `efWantStmt` but the
`when` statement doesn't normally propagate this flag, so propagate it
when the `semCheck` param in `semWhen` is true which happens when the
`when` statement is `efWhenStmt` anyway.

(cherry picked from commit fb6c805)
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

Successfully merging a pull request may close this issue.

1 participant