-
Notifications
You must be signed in to change notification settings - Fork 20
Description
getType(T)[1].getImplwill not work on ref type including deref version liketype(default(someref)[]).
possible work around. after getType, use new owner API then symKind and typeKind to check if it has parent type or something else.
nim-confutils, nim-serialization, and nim-json-serialization suffer from this problem too.
- nnkPragma and nnkPosfix in
recordFields
if field.name.kind == nnkPragmaExpr:
field.pragmas = field.name[1]
field.name = field.name[0]
if field.name.kind == nnkPostfix:
field.isPublic = true
field.name = field.name[1]this is clearly wrong, nnkPostFix will appear inside nnkPragmaExpr in the AST. need fix
- using
nnkRecWheninrecordFieldscan leads to unexpected result. should use semchecked AST ofgetTypeinstead of raw AST fromgetImpl.
nnkRecWhen will not appear at final type, only branch evaluated to true will appear at final type. if we use nnkRecWhen, both false branch and true 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 the getType family.
related: nim-lang/RFCs#176