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

problem with underspecified seq types in proc definitions of the same name #24449

Open
Graveflo opened this issue Nov 18, 2024 · 1 comment · May be fixed by #24462
Open

problem with underspecified seq types in proc definitions of the same name #24449

Graveflo opened this issue Nov 18, 2024 · 1 comment · May be fixed by #24462

Comments

@Graveflo
Copy link
Contributor

Graveflo commented Nov 18, 2024

Description

This seems to cause a crash:

proc p(x: var seq)= discard
proc p(x: seq)= discard
var s : seq[int]
p(s)

Nim Version

Nim Compiler Version 2.2.1 [Linux: amd64]
Compiled at 2024-11-18
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: cc696f1
active boot switches: -d:release

Current Output

Nim/compiler/nim.nim(169) nim
Nim/compiler/nim.nim(124) handleCmdLine
Nim/compiler/main.nim(307) mainCommand
Nim/compiler/main.nim(274) compileToBackend
Nim/compiler/main.nim(137) commandCompileToC
Nim/compiler/pipelines.nim(311) compilePipelineProject
Nim/compiler/pipelines.nim(231) compilePipelineModule
Nim/compiler/pipelines.nim(177) processPipelineModule
Nim/compiler/sem.nim(837) semWithPContext
Nim/compiler/sem.nim(799) semStmtAndGenerateGenerics
Nim/compiler/semstmts.nim(2900) semStmt
Nim/compiler/semexprs.nim(1287) semExprNoType
Nim/compiler/semexprs.nim(3526) semExpr
Nim/lib/system.nim(936) semStmtList
Nim/compiler/semexprs.nim(3429) semExpr
Nim/compiler/semexprs.nim(1268) semDirectOp
Nim/compiler/semexprs.nim(1072) semOverloadedCallAnalyseEffects
Nim/compiler/semcall.nim(901) semOverloadedCall
Nim/compiler/semcall.nim(580) resolveOverloads
Nim/compiler/semcall.nim(170) pickBestCandidate
Nim/compiler/sigmatch.nim(425) cmpCandidates
Nim/compiler/sigmatch.nim(299) checkGeneric
Nim/compiler/sigmatch.nim(1883) typeRel
Nim/compiler/types.nim(1697) isEmptyContainer
Nim/compiler/ast.nim(1327) elementType
Nim/lib/system/indices.nim(30) []
Nim/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]

Expected Output

No response

Known Workarounds

No response

Additional Information

This type seems to be created. Not sure how or why

{
  "kind": "tySequence",
  "id": 553648133,
  "sons": []
}
@Graveflo
Copy link
Contributor Author

!nim c

proc p(x: var seq)= discard
proc p(x: seq)= discard
var s : seq[int]
p(s)

metagn added a commit to metagn/Nim that referenced this issue Nov 21, 2024
@metagn metagn linked a pull request Nov 21, 2024 that will close this issue
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