Skip to content

Using err as error variable name causes compiler to want an identifier #62

@emizzle

Description

@emizzle

nim v1.6.20
macos

This was not compiling until err was changed to error:

without digest =? Poseidon2Hash.spongeDigest(bytes.toOpenArray(start, finish - 1), 2), err:
  return failure err

Source:
https://github.com/codex-storage/nim-codex/pull/975/files#diff-d4fdc8964c53f8772ad04bad070e544f52451bc37dc5c801eef2ab21664703c2R54-R55

But a few lines down, err is used and it does compile:
https://github.com/codex-storage/nim-codex/blob/8aaff32b4669366ca468ef7eaf04e730412ab95d/codex/utils/poseidon2digest.nim#L68-L69

The compilation error:

/Users/egonat/repos/codex-storage/nim-codex/codex/utils/poseidon2digest.nim(54, 92) Error: expected an identifier, got 
err(typeof(result))
stack trace: (most recent call last)
nimscript.nim(429, 18)
build.nims(30, 15)       codexTask
build.nims(23, 7)        buildBinary
nimscript.nim(273, 7)    exec
/Users/egonat/repos/codex-storage/nim-codex/vendor/nimbus-build-system/vendor/Nim/lib/system/nimscript.nim(273, 7) Error: unhandled exception: FAILED: nim c --out:build/codex -d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE --verbosity:0 --hints:off -d:release ./codex.nim [OSError]
make: *** [all] Error 1

Bizarrely, it seems that this does compile on Windows and Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions