-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2180 from Shaikh-Ubaid/fix_inner_struct_pass_to_func
Fix inner struct passed as an argument to a function
- Loading branch information
Showing
3 changed files
with
54 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from lpython import packed, dataclass, ccallable, i32, ccallback | ||
|
||
@ccallable | ||
@packed | ||
@dataclass | ||
class struct_0: | ||
val_0 : i32 = 613 | ||
|
||
@ccallable | ||
@packed | ||
@dataclass | ||
class struct_1: | ||
val_1 : struct_0 = struct_0() | ||
|
||
def print_val_0_in_struct_0(struct_0_instance : struct_0) -> i32: | ||
print(struct_0_instance.val_0) | ||
return 0 | ||
|
||
@ccallback | ||
def entry_point() -> i32: | ||
struct_1_instance : struct_1 = struct_1() | ||
return print_val_0_in_struct_0(struct_1_instance.val_1) | ||
|
||
assert entry_point() == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters