-
Notifications
You must be signed in to change notification settings - Fork 170
Support passing dict
as return value of functions
#1659
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
Conversation
Hey @certik @Thirumalai-Shaktivel . Can you please help me out a little with this implementation? I am facing issues. If you can point me out a little to some portions. After doing this, it basically says Test case -
Also, I have witnessed that while deep copying - the
I feel that for it should be something of |
I tried your branch by commenting out the last two lines in your example, from lpython import i32
def fun() -> dict[i32, i32]:
return {2: 4, 3: 6}
num : dict[i32, i32]
# num = fun()
# print(num[2]) LLVM code, ; ModuleID = 'LFortran'
source_filename = "LFortran"
%dict = type { i32, %list, %list, i8* }
%list = type { i32, i32, i32* }
@num = global %dict zeroinitializer
define %dict @fun() {
.entry:
%_lpython_return_variable = alloca %dict, align 8
%const_dict = alloca %dict, align 8
%0 = getelementptr %dict, %dict* %const_dict, i32 0, i32 0
store i32 0, i32* %0, align 4
.
.
. You can see P.S. Also read #955 (comment) |
@czgdp1807 I added |
Can you please check @Thirumalai-Shaktivel and @czgdp1807 as to why the build is failing on C Backend? |
You need to support |
Can you please review ? @Thirumalai-Shaktivel @czgdp1807 @certik |
Can you review? @czgdp1807 @certik . CI tests have passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but I would like @czgdp1807 to also review. The history needs polishing or squashing. I rebased on top of the latest master.
Adds to #983 by giving full support of dictionary return type in LLVM and C backend respectively.