-
Notifications
You must be signed in to change notification settings - Fork 18
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
some issues with hasCustomPragma/recordFields #12
Comments
But that's what the code is doing now. It first strips the "outer" layer, which is the
|
sorry, you're right.I must be confused with something else |
@zah:
I have just encountered this Is there a way to make |
@jlokier: now nim-confutils already support ignore pragma in status-im/nim-confutils#37, the closest workaround to achieve conditional fields is to use pragma-pragma |
getType(T)[1].getImpl
will not work on ref type including deref version liketype(default(someref)[])
.possible work around. after
getType
, use newowner
API thensymKind
andtypeKind
to check if it has parent type or something else.nim-confutils, nim-serialization, and nim-json-serialization suffer from this problem too.
recordFields
this is clearly wrong, nnkPostFix will appear inside nnkPragmaExpr in the AST. need fix
nnkRecWhen
inrecordFields
can leads to unexpected result. should use semchecked AST ofgetType
instead of raw AST fromgetImpl
.nnkRecWhen
will not appear at final type, only branch evaluated totrue
will appear at final type. if we usennkRecWhen
, bothfalse
branch andtrue
branch will have conflict if they contains fields with same name.false
branch existence also posses it's own problem if we count the field number or enumerate the fields.work around: not known,
getType
and friends return an AST without pragmas. need to patch thegetType
family.related: nim-lang/RFCs#176
The text was updated successfully, but these errors were encountered: