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#1320 from czgdp1807/sprint_08
Fixes for ASR and LLVM backend
- Loading branch information
Showing
13 changed files
with
118 additions
and
22 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
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,17 @@ | ||
from ltypes import i32, Const, inline | ||
|
||
@inline | ||
def f(x: i32) -> i32: | ||
offset: Const[i32] = 1 | ||
return x + offset | ||
|
||
def test_f(): | ||
x: i32 = 0 | ||
x = f(x) | ||
print(x) | ||
assert x == 1 | ||
x = f(x) | ||
print(x) | ||
assert x == 2 | ||
|
||
test_f() |
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
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,7 @@ | ||
from ltypes import CPtr, empty_c_void_p | ||
|
||
def f(): | ||
x: CPtr = empty_c_void_p() | ||
print(x[0]) | ||
|
||
f() |
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,10 @@ | ||
from ltypes import i32 | ||
|
||
def f(i: i32): | ||
print(i) | ||
|
||
def g(i: i32): | ||
print(i + 1) | ||
|
||
def f(i: i32): | ||
print(i + 2) |
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,13 @@ | ||
{ | ||
"basename": "asr-cptr_01-4e660f1", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/cptr_01.py", | ||
"infile_hash": "0c5f0767aac11155e331581cf0158bb7a9b98ef11bb1716877477b00", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-cptr_01-4e660f1.stderr", | ||
"stderr_hash": "0477f93b29ff4932b3471a59731a173fb19d6e44273236829eeaffbe", | ||
"returncode": 2 | ||
} |
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,5 @@ | ||
semantic error: Indexing CPtr typed expressions is not supported yet | ||
--> tests/errors/cptr_01.py:5:11 | ||
| | ||
5 | print(x[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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"basename": "asr-func_01-d87aa4a", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/func_01.py", | ||
"infile_hash": "fe27c8537c6e7447cb8b3ea3b4a9553f6786ff70600c30fdf196b602", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-func_01-d87aa4a.stderr", | ||
"stderr_hash": "2a773033fab41aadd3ddf3732cfb473ba5da6c9649453516286dacf1", | ||
"returncode": 2 | ||
} |
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,9 @@ | ||
semantic error: Function f is already defined | ||
--> tests/errors/func_01.py:9:1 - 10:16 | ||
| | ||
9 | def f(i: i32): | ||
| ^^^^^^^^^^^^^^... | ||
... | ||
| | ||
10 | print(i + 2) | ||
| ...^^^^^^^^^^^^^^^^ |
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