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

regression(1.2.6 => devel): VM: const case object field access gives: 'sons' is not accessible #15532

Closed
timotheecour opened this issue Oct 9, 2020 · 0 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Oct 9, 2020

regression(1.2.6 => devel): VM: const case object field access gives: 'sons' is not accessible

Example

block:
  type Kind = enum
    k0, k1

  type Foo = object
    y: int
    case kind: Kind
    of k0: x0: int
    of k1: x1: int

  const j0 = Foo(y: 1, kind: k0, x0: 2)
  const j1 = Foo(y: 1, kind: k1, x1: 2)

  doAssert j0.y == 1
  doAssert j0.kind == k0
  doAssert j1.kind == k1

  doAssert j1.x1 == 2  # 1.2.6: works; devel: Error: unhandled exception: 'sons' is not accessible using discriminant 'kind' of type 'TNode' [FieldDefect]
  # echo j0.x0 # 1.2.6: prints 0 instead of 2 but; nim devel: CT error

Current Output

Error: unhandled exception: 'sons' is not accessible using discriminant 'kind' of type 'TNode'

Expected Output

works

Additional Information

Araq added a commit that referenced this issue Oct 9, 2020
@Araq Araq closed this as completed in d430216 Oct 9, 2020
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant