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

Accessing the wrong variant field in the VM does not trigger the appropriate error message #11727

Closed
mratsim opened this issue Jul 14, 2019 · 0 comments
Labels

Comments

@mratsim
Copy link
Collaborator

mratsim commented Jul 14, 2019

When accessing the wrong variant field in the VM, we get a hint that quit() was called, sometimes with an extra RangeError (and the message is not colored) sometimes without anything.

Test case with the RangeError

type
  MyEnumKind = enum
    meFoo
    meBar

  MyObj = ref object
    case kind: MyEnumKind
    of meFoo:
      foo: int
    of meBar:
      bar: bool

macro triggerQuit(): untyped =

  let x = MyObj(kind: meFoo, foo: 123)
  echo x.bar

triggerQuit()

I'm not sure how to get the quit() without range error with a mini example yet.

Araq added a commit that referenced this issue Nov 28, 2019
@Araq Araq closed this as completed in 0996eb1 Nov 28, 2019
alehander92 pushed a commit to alehander92/Nim that referenced this issue Dec 2, 2019
narimiran pushed a commit to narimiran/Nim that referenced this issue Dec 10, 2019
(cherry picked from commit 0996eb1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant