forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
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 lcompilers#2569 from anutosh491/Fixing_returning_v…
…ariables Fixing issues with freeing variables
- Loading branch information
Showing
4 changed files
with
43 additions
and
17 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,36 @@ | ||
from lpython import S | ||
from sympy import Symbol, log | ||
|
||
def func_01(e: S, x: S) -> S: | ||
print(e) | ||
if e == x: | ||
return x | ||
print(e) | ||
return e | ||
|
||
def test_func_01(): | ||
x: S = Symbol("x") | ||
ans: S = func_01(log(x), x) | ||
print(ans) | ||
|
||
def func_02(e: S, x: S) -> list[S]: | ||
print(e) | ||
if e == x: | ||
list1: list[S] = [x] | ||
return list1 | ||
else: | ||
print(e) | ||
list2: list[S] = func_02(x, x) | ||
return list2 | ||
|
||
def test_func_02(): | ||
x: S = Symbol("x") | ||
ans: list[S] = func_02(log(x), x) | ||
ele: S = ans[0] | ||
print(ele) | ||
|
||
def tests(): | ||
test_func_01() | ||
test_func_02() | ||
|
||
tests() |
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