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.
Added error tests for un-equal types in do loop
- Loading branch information
Showing
7 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from ltypes import i16 | ||
|
||
def test_increment(): | ||
i: i16 | ||
for i in range(15, i16(-1), i16(-1)): | ||
print(i) | ||
|
||
test_increment() |
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,8 @@ | ||
from ltypes import i16 | ||
|
||
def test_increment(): | ||
i: i16 | ||
for i in range(i16(15), i16(-1), -1): | ||
print(i) | ||
|
||
test_increment() |
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-loop_01-e7aa06a", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/loop_01.py", | ||
"infile_hash": "dfe89b806a2b527a01526e9e55edc1271783e1ab916245222b561dee", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-loop_01-e7aa06a.stderr", | ||
"stderr_hash": "256fe74af3480ca97b87c1b6f770cee10753e5f097d5a2d79135e736", | ||
"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: Type mismatch in loop start and loop end values, the types must be compatible | ||
--> tests/errors/loop_01.py:5:20 | ||
| | ||
5 | for i in range(15, i16(-1), i16(-1)): | ||
| ^^ ^^^^^^^ type mismatch ('i32' and 'i16') |
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-loop_02-5741651", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/loop_02.py", | ||
"infile_hash": "e88f2cac76a9de67c851a22a64cdae4553321d80ae64f5720a424a15", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-loop_02-5741651.stderr", | ||
"stderr_hash": "a8262496250102a77a9e5718d40aaf1067fb21a18fb047885aa643ac", | ||
"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: Type mismatch in loop start and increment values, the types must be compatible | ||
--> tests/errors/loop_02.py:5:20 | ||
| | ||
5 | for i in range(i16(15), i16(-1), -1): | ||
| ^^^^^^^ ^^ type mismatch ('i16' and 'i32') |
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