Skip to content

Allow SomeSignedInt and SomeUnsignedInt as literal operand - #154

Open
jangko wants to merge 1 commit into
masterfrom
uint-lit
Open

jangko wants to merge 1 commit into
masterfrom
uint-lit

Conversation

@jangko

@jangko jangko commented Jun 12, 2024

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread stint/literals_stint.nim

result.add quote do:
proc `op`*[bits: static[int]](a: StUint[bits], b: `intLit`): `ResultTy` {.inline.}=
proc `op`*[bits: static[int]](a: StUint[bits], b: `uintLit`): `ResultTy` {.inline.}=

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if it's out of range for the type? it should Defect (runtime) or error (compile-time) just like nim integers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, will add more tests to this.

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 this pull request may close these issues.

2 participants