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

internal error: Map.!: given key is not an element in the map #501

Open
Caid11 opened this issue Apr 19, 2024 · 2 comments
Open

internal error: Map.!: given key is not an element in the map #501

Caid11 opened this issue Apr 19, 2024 · 2 comments
Labels

Comments

@Caid11
Copy link

Caid11 commented Apr 19, 2024

I found this while trying to reduce my reproducer for #500. It's very similar, and could be related or a duplicate.

When I try to compile my code, I see this error:

parse   : .../bb.kk
check   : bb
bb(1, 1): internal error: Map.!: given key is not an element in the map
CallStack (from HasCallStack):
  error, called at libraries\containers\containers\src\Data\Map\Internal.hs:617:17 in containers-0.6.7:Data.Map.Internal

Failed to compile bb.kk

Similar to #500, passing --rebuild avoids the failure. I found that removing the bleh : duration member of the server struct and updating its constructor calls fixes the issue.

Notes:

  • I'm using Koka v3.1.1 on Windows
  • My C compiler is MSVC 19.34.31937

Failing code is here: https://github.com/Caid11/Functional-Program-Studio/tree/internal-compile-error-map/blockbuilder

@anfelor
Copy link
Collaborator

anfelor commented May 16, 2024

I managed to reproduce this error. It is tricky to minify and often instead runs into the linked #500 instead (eg. not being able to look up world/gameWorld). On linux, you can reproduce this using my stub implementation of socket.kk and raylib.kk.

The bug occurs since modmapRead is passed a module with name nameNil:

bb(1, 1): internal error: modmapRead: empty modname
CallStack (from HasCallStack):
  error, called at src/Compile/Build.hs:218:32 in koka-3.1.2-7SWN83ElxwDEblvTDAD6Nq:Compile.Build
  modmapRead, called at src/Compile/Build.hs:347:25 in koka-3.1.2-7SWN83ElxwDEblvTDAD6Nq:Compile.Build
  moduleWaitForImports, called at src/Compile/Build.hs:307:19 in koka-3.1.2-7SWN83ElxwDEblvTDAD6Nq:Compile.Build
  moduleCodeGen, called at src/Compile/Build.hs:262:18 in koka-3.1.2-7SWN83ElxwDEblvTDAD6Nq:Compile.Build
  moduleCompile, called at src/Compile/Build.hs:107:25 in koka-3.1.2-7SWN83ElxwDEblvTDAD6Nq:Compile.Build

@anfelor
Copy link
Collaborator

anfelor commented May 16, 2024

I added tracing for all modmap(Try)Put and modmapRead operations -- the full log is at https://gist.github.com/anfelor/57e63dc6f2b7933bb40a2753c6b54b71 for a minified version of the code that only imports raylib/raylib, socket/socket, server, ui.

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

No branches or pull requests

3 participants