nim-works / nimskull

An in development statically typed systems programming language; with sustainability at its core. We, the community of users, maintain it.

Home Page:https://nim-works.github.io/nimskull/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CT exceptions are swallowed in typed macro argument

alaviss opened this issue · comments

Example

import macros

macro bar(x: typed): untyped =
  x

bar:
  static:
    raise newException(CatchableError, "hi")

Actual Output

This is the only error in the chain, a higher errorMax did not unveil any other errors.

test.nim(6, 1) Error: type mismatch: got <void>
but expected one of:
macro bar(x: typed): untyped
  first type mismatch at position: 1
  required type for x: typed
  but expression '
static :
  raise
    (ref CatchableError)(name: "CatchableError", msg: "hi", parent: nil)' is of type:

expression: bar do:
  static :
    raise
      (ref CatchableError)(name: "CatchableError", msg: "hi", parent: nil)

Expected Output

We want to see the exception to aid with debugging

stack trace: (most recent call last)
test.nim(8, 5) test
test.nim(8, 5) Error: unhandled exception: hi [CatchableError]

I tried to reproduce this locally, but wasn't able to anymore -- I believe #1124 also fixed this.

I tried to reproduce this locally, but wasn't able to anymore -- I believe #1124 also fixed this.

Rude of #1124, if you ask me. ;)

Let's close this for now and if @alaviss finds another reproduction then it can be reopened with that.