We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
static(ObjectWithCaseInit(...))
type MyEnum = enum F, S, T Foo = object case o: MyEnum of F: f: string of S: s: string of T: t: string echo static(Foo(o: F, f: "foo")).f
https://play.nim-lang.org/#ix=2UsR
foo
Generated C
/* section: NIM_merge_TYPES */ struct tyObject_Foo__OxIF3ue9bZBY4jPJ8Gj2BXg { tyEnum_MyEnum__wtIc4D3WdTYB2od8p7ouOw o; union{ struct {NimStringV2 f; } _o_1; struct {NimStringV2 s; } _o_2; struct {NimStringV2 t; } _o_3; }; }; /* section: NIM_merge_DATA */ static const struct { NI cap; NIM_CHAR data[3+1]; } TM__Ixqz4CXXiRZU9bYUmI9cyI2w_2 = { 3 | NIM_STRLIT_FLAG, "foo" }; static const NimStringV2 TM__Ixqz4CXXiRZU9bYUmI9cyI2w_3 = {3, (NimStrPayload*)&TM__Ixqz4CXXiRZU9bYUmI9cyI2w_2}; static const struct { NI cap; NIM_CHAR data[0+1]; } TM__Ixqz4CXXiRZU9bYUmI9cyI2w_4 = { 0 | NIM_STRLIT_FLAG, "" }; static const NimStringV2 TM__Ixqz4CXXiRZU9bYUmI9cyI2w_5 = {0, (NimStrPayload*)&TM__Ixqz4CXXiRZU9bYUmI9cyI2w_4}; static const NimStringV2 TM__Ixqz4CXXiRZU9bYUmI9cyI2w_6 = {0, (NimStrPayload*)&TM__Ixqz4CXXiRZU9bYUmI9cyI2w_4}; /* main */ tyArray__nHXaesL0DJZHyVS07ARPRA T1_; tyObject_Foo__OxIF3ue9bZBY4jPJ8Gj2BXg T2_; nimZeroMem((void*)(&T2_), sizeof(tyObject_Foo__OxIF3ue9bZBY4jPJ8Gj2BXg)); T2_.o = ((tyEnum_MyEnum__wtIc4D3WdTYB2od8p7ouOw) 0); T2_._o_1.f = TM__Ixqz4CXXiRZU9bYUmI9cyI2w_3; T2_._o_2.s = TM__Ixqz4CXXiRZU9bYUmI9cyI2w_5; T2_._o_3.t = TM__Ixqz4CXXiRZU9bYUmI9cyI2w_6; ... T1_[0] = T2_._o_1.f; echoBinSafe(T1_, 1);
$ nim -v Nim Compiler Version 1.4.4 [Windows: amd64] Compiled at 2021-02-23 Copyright (c) 2006-2020 by Andreas Rumpf active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
static(Foo(o: F, f: "foo")) expands to
static(Foo(o: F, f: "foo"))
ObjConstr Empty ExprColonExpr Sym "o" IntLit 0 ExprColonExpr Sym "f" StrLit "foo" ExprColonExpr Sym "s" StrLit "" ExprColonExpr Sym "t" StrLit ""
Sorry, something went wrong.
remove inactive case fields from VM object constructor nodes
1fc3c45
fixes nim-lang#17571
Successfully merging a pull request may close this issue.
Example
https://play.nim-lang.org/#ix=2UsR
Current Output
Expected Output
Additional Information
Generated C
The text was updated successfully, but these errors were encountered: