Skip to content

Can't check if stderr is static #19680

Closed
@PMunch

Description

@PMunch

While working on Futhark I wanted to decide whether or not to put something into a const or a let. Basically it tries to read out macros which can resolve to simple numbers and I want those to be consts, but it can also be other stuff which can't go into a const. I came if with a solution of using when x is static: const y = x else: let y = x which works fine for most identifiers. But certain built-ins like stdout and stderr makes the compiler crash.

Example

when stderr is static:
  echo "whoops"
else:
  echo "works"

Current Output

fatal.nim(53)            sysFatal
Error: unhandled exception: index -1 not in 0 .. 0 [IndexDefect]

Expected Output

works

Possible Solution

Not really sure what a possible solution would be, but building a debug compiler gives a lot more output to work with.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions