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

Borrow . doesn't work with distinct generic object #22069

Closed
jangko opened this issue Jun 11, 2023 · 0 comments · Fixed by #22072
Closed

Borrow . doesn't work with distinct generic object #22069

jangko opened this issue Jun 11, 2023 · 0 comments · Fixed by #22072

Comments

@jangko
Copy link
Contributor

jangko commented Jun 11, 2023

Description

type
  Vehicle[C: static[int]] = object
    color: array[C, int]
    
    
  Car[C: static[int]] {.borrow: `.`.} = distinct Vehicle[C]
  
  
  MuscleCar = Car[128]

The manual says {.borrow: ..} can works with distinct object, but apparently not with distinct generic object.

Nim Version

Nim Compiler Version 1.6.12 [Windows: amd64]
Compiled at 2023-06-04
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 1aa9273
active boot switches: -d:release


Nim Compiler Version 1.9.3 [Windows: amd64]
Compiled at 2023-06-04
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 25fe412
active boot switches: -d:release

Current Output

$> Error: only a 'distinct' type can borrow `.`

Expected Output

no error

Possible Solution

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant