Skip to content

jsondoc IndexDefect with auto return type #24744

@ire4ever1190

Description

@ire4ever1190

Nim Version

Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-02-28
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 7e8a650
active boot switches: -d:release

Description

Running jsondoc (but not doc) fails with this example

# Only works with unrestrained types like `ref` and `proc`. Normal generic doesn't fail
proc test*(x: ref): auto = ""

Current Output

nim/compiler/nim.nim(169) nim
nim/compiler/nim.nim(124) handleCmdLine
nim/compiler/main.nim(353) mainCommand
nim/compiler/main.nim(118) commandDoc2
nim/compiler/pipelines.nim(311) compilePipelineProject
nim/compiler/pipelines.nim(231) compilePipelineModule
nim/compiler/pipelines.nim(178) processPipelineModule
nim/compiler/pipelines.nim(42) processPipeline
nim/compiler/docgen2.nim(61) processNodeJson
nim/compiler/docgen.nim(1580) generateJson
nim/compiler/docgen.nim(1210) genJsonItem
nim/compiler/types.nim(792) typeToString
nim/compiler/types.nim(714) typeToString
nim/compiler/ast.nim(1329) 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

Doesn't crash

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions