-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Macro returning static int in type section: intVal is not accessible for TFullReg #16774
Comments
* Introduce Fr type: finite field over curve order. Need workaround for nim-lang/Nim#16774 * Split curve properties into core and derived * Attach field properties to an instantiated field instead of the curve enum * Workaround nim-lang/Nim#14021, yet another "working with types in macros" is difficult nim-lang/RFCs#44 * Implement finite field over prime order of a curve subgroup * skip OpenSSL tests on windows
Come on, it's a single file with 37 lines. It's also the minimum translation of my data structure and what I attempted to do. Given how distinct, static, symbol resolution/bindsym, generics, {.compileTime.} and types interact with each other and the useless error message, I think that's reasonable minimal reproducing example. |
I tried to minimize this a bit more and obtained the following code: import macros
macro makeIntLit(c: static int): untyped =
result = newLit(c)
type Test*[T: static int] = object
myArray: array[makeIntLit(T), int] It turns out, that the compiler passes the NimNode "T" to I see two ways to solve this:
|
closes nim-lang#4774, closes nim-lang#7385, closes nim-lang#10019, closes nim-lang#12405, closes nim-lang#12732, closes nim-lang#13270, closes nim-lang#13799, closes nim-lang#15247, closes nim-lang#16128, closes nim-lang#16175, closes nim-lang#16774, closes nim-lang#17527, closes nim-lang#20880, closes nim-lang#21346
When using a macro to compute the static int that parametrize a static type in a type section, we get
Test case
The text was updated successfully, but these errors were encountered: