-
Notifications
You must be signed in to change notification settings - Fork 171
Add error tests for mismatch in empty dtype #2307
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
Merged
certik
merged 2 commits into
lcompilers:main
from
ubaidsk:test_for_mismatch_in_empty_dtype
Aug 28, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 lpython import i16 | ||
from numpy import empty, int16 | ||
|
||
# checks dim mismatch for local array variable | ||
def main0(): | ||
x: i16[4] = empty([5], dtype=int16) | ||
|
||
main0() |
This file contains hidden or 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 lpython import i16 | ||
from numpy import empty, int32 | ||
|
||
# checks type mismatch for local array variable | ||
def main0(): | ||
x: i16[5] = empty([5], dtype=int32) | ||
|
||
main0() |
This file contains hidden or 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 lpython import i16 | ||
from numpy import empty, int16 | ||
|
||
# checks multi-dim mismatch for local array variable | ||
def main0(): | ||
x: i16[5, 4] = empty([5, 3], dtype=int16) | ||
|
||
main0() |
This file contains hidden or 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 lpython import i16 | ||
from numpy import empty, int32 | ||
|
||
# checks type mismatch for multi-dim local array variable | ||
def main0(): | ||
x: i16[5, 4] = empty([5, 4], dtype=int32) | ||
|
||
main0() |
This file contains hidden or 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 lpython import f32 | ||
from numpy import empty, complex64 | ||
|
||
# checks type mismatch for types apart from integers | ||
def main0(): | ||
x: f32[5, 4] = empty([5, 4], dtype=complex64) | ||
|
||
main0() |
This file contains hidden or 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,11 @@ | ||
from lpython import i32, i64, Const | ||
from numpy import empty, int64 | ||
|
||
# checks multi-dim mismatch when constant variables are used as dimensions | ||
def main0(): | ||
p: Const[i32] = 100 | ||
q: Const[i32] = 120 | ||
r: Const[i32] = 200 | ||
x: i64[p, q, r] = empty([q, p, r], dtype=int64) | ||
|
||
main0() |
This file contains hidden or 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,11 @@ | ||
from lpython import i32, i64 | ||
from numpy import empty, int64 | ||
|
||
# checks using runtime variables as value for multi-dims | ||
def main0(): | ||
p: i32 = 100 | ||
q: i32 = 120 | ||
r: i32 = 200 | ||
x: i64[p, q, r] = empty([q, p, r], dtype=int64) | ||
|
||
main0() |
This file contains hidden or 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,11 @@ | ||
from lpython import i32, i64 | ||
from numpy import empty, int64 | ||
|
||
# checks using runtime variables as value for multi-dims of emtpy() | ||
def main0(): | ||
p: i32 = 100 | ||
q: i32 = 120 | ||
r: i32 = 200 | ||
x: i64[100, 120, 200] = empty([q, p, r], dtype=int64) | ||
|
||
main0() |
This file contains hidden or 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 @@ | ||
from lpython import i16 | ||
from numpy import empty, int16 | ||
|
||
# Checks dim mismatch for global array variables | ||
x: i16[4] = empty([5], dtype=int16) |
This file contains hidden or 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 @@ | ||
from lpython import i16 | ||
from numpy import empty, int32 | ||
|
||
# Checks type mismatch for global array variables | ||
x: i16[5] = empty([5], dtype=int32) |
This file contains hidden or 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 @@ | ||
from lpython import i16 | ||
from numpy import empty, int16 | ||
|
||
# checks dim mismatch for local array variable | ||
# when dim is specified as a constant integer | ||
def main0(): | ||
x: i16[4] = empty(5, dtype=int16) | ||
|
||
main0() |
This file contains hidden or 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 @@ | ||
from lpython import i16 | ||
from numpy import empty, int16 | ||
|
||
# checks dim mismatch for local array variable | ||
# when dim is specified as a tuple | ||
def main0(): | ||
x: i16[4] = empty((5), dtype=int16) | ||
|
||
main0() |
This file contains hidden or 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-arrays_03-de2e952", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_03.py", | ||
"infile_hash": "429c486d84e37401f89fe1e678039ae0e16b2cf5bf13417767160858", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_03-de2e952.stderr", | ||
"stderr_hash": "4c932f31bbb10c9ba8d8d75be226ba9c33553be3bcb367c8112e31af", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_03.py:6:5 | ||
| | ||
6 | x: i16[4] = empty([5], dtype=int16) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') |
This file contains hidden or 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-arrays_04-880407c", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_04.py", | ||
"infile_hash": "9dfe40ad5fd610b75685a45ffd700ff14e263738dd5ba968952d7874", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_04-880407c.stderr", | ||
"stderr_hash": "10ef155b0236096d5de8157e38b3989d99343b016a8153b68a36aa54", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_04.py:6:5 | ||
| | ||
6 | x: i16[5] = empty([5], dtype=int32) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') |
This file contains hidden or 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-arrays_05-ec8fbd5", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_05.py", | ||
"infile_hash": "c525449694f73038495a6bd8fded408301f43d18b1c387765b92b792", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_05-ec8fbd5.stderr", | ||
"stderr_hash": "b92b252106c95d1851599993abbedd755f2b3231f5b551b3af33b67e", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_05.py:6:5 | ||
| | ||
6 | x: i16[5, 4] = empty([5, 3], dtype=int16) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5][4]' and 'i16[5][3]') | ||
This file contains hidden or 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-arrays_06-fbb09a3", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_06.py", | ||
"infile_hash": "670cbcac5e942bae5293cd94090bab65a2039384d71fb8be4c6db5a1", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_06-fbb09a3.stderr", | ||
"stderr_hash": "0cd2825fa152a45c868b7f54832a95d0f457be296143f28ce1909870", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_06.py:6:5 | ||
| | ||
6 | x: i16[5, 4] = empty([5, 4], dtype=int32) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5][4]' and 'i32[5][4]') |
This file contains hidden or 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-arrays_07-de430fd", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_07.py", | ||
"infile_hash": "efe8b3c4a474aca55cb8a537a3ea2cd30eb5d5abf140d8c2c0b9e3f4", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_07-de430fd.stderr", | ||
"stderr_hash": "ea9cadd25ae52d3ff115925e4f8e6feb278ad009410d64c940cf64ff", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_07.py:6:5 | ||
| | ||
6 | x: f32[5, 4] = empty([5, 4], dtype=complex64) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('f32[5][4]' and 'c32[5][4]') |
This file contains hidden or 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-arrays_08-ba317a3", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_08.py", | ||
"infile_hash": "3f7a5a8889301df17222a777f7e92a5667097ffca9ac4d275ccb310f", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_08-ba317a3.stderr", | ||
"stderr_hash": "a6fc0e1c661fab5e3ee0a034abb85d765a1dce515483a2a6191b2aa7", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_08.py:9:5 | ||
| | ||
9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i64[100][120][200]' and 'i64[120][100][200]') |
This file contains hidden or 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-arrays_09-50ee586", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_09.py", | ||
"infile_hash": "e6f2cca7de4ecfddffdc96ee4c278de35c220b608c9e4fe4731fd9b8", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_09-50ee586.stderr", | ||
"stderr_hash": "30bfc87e70c4b4688cf7162eec34dce8e52c959539d20ad8b79cf845", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. | ||
--> tests/errors/arrays_09.py:9:12 | ||
| | ||
9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) | ||
| ^ |
This file contains hidden or 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-arrays_10-bc82d75", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_10.py", | ||
"infile_hash": "05aedf3d1013c61f73afc3de4ddca88ee33f029dcd62fadb66e7ec83", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_10-bc82d75.stderr", | ||
"stderr_hash": "59e8cc91d7dae61bf60ec4d9cd23d62cdcb162e553bd64a3995fad19", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. | ||
--> tests/errors/arrays_10.py:9:36 | ||
| | ||
9 | x: i64[100, 120, 200] = empty([q, p, r], dtype=int64) | ||
| ^ |
This file contains hidden or 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-arrays_11-fc505b4", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_11.py", | ||
"infile_hash": "111b4224a1988a90dc091fda4e0b1ebfd096f25f7b4ccc2f13728c1c", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_11-fc505b4.stderr", | ||
"stderr_hash": "ef5e89392b20ad345ba9bcf862ab71b19e56c85d9838db742be117a1", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_11.py:5:1 | ||
| | ||
5 | x: i16[4] = empty([5], dtype=int16) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') |
This file contains hidden or 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-arrays_12-63d6f25", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_12.py", | ||
"infile_hash": "03cc809a4ee6a2ff47b5a91111d26e501ded647478e7fa03bde5bdf7", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_12-63d6f25.stderr", | ||
"stderr_hash": "b6fa626301868bd5cbbef6d914f5b4f38b1d896b951753122969e74a", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_12.py:5:1 | ||
| | ||
5 | x: i16[5] = empty([5], dtype=int32) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') |
This file contains hidden or 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-arrays_13-b5fcc7e", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_13.py", | ||
"infile_hash": "6aa585e55d5ba97e0c139b1a86268b41104955236fc6f87a11771505", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_13-b5fcc7e.stderr", | ||
"stderr_hash": "6bde2f7fc14d5a461a58d694e44e19dd79ef5bee47c88b4022daf5d6", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_13.py:7:5 | ||
| | ||
7 | x: i16[4] = empty(5, dtype=int16) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') |
This file contains hidden or 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-arrays_14-78be00e", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/arrays_14.py", | ||
"infile_hash": "f724b8a5dfe7bc481f465e6f9105c9a2e6a8b7a5985a63ba52b58db2", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-arrays_14-78be00e.stderr", | ||
"stderr_hash": "267aea8e48708230a9b2bc61c37c849a0b75cb45294ca25ee11fe632", | ||
"returncode": 2 | ||
} |
This file contains hidden or 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 annotation-assignment, the types must be compatible | ||
--> tests/errors/arrays_14.py:7:5 | ||
| | ||
7 | x: i16[4] = empty((5), dtype=int16) | ||
| ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I would write it as
i16[5, 4]
as in the source code, noti16[5][4]
.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.
Do you also suggest to include the
start
value of the dimension? For examplei16[0:5, 0:4]
? I guess it is only helpful for the developers. For users it might confuse as python does not have lower_bounds. (Although it could be helpful in the case for LFortran if we reuse this printing mechanism/function there.)We can also include the
start
value of the dimension later (when we have more experience with error messages or user feedback).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.
For Python I would print it as just
i16[5, 4]
. For LFortran we use a different method to print the type, and there indeed we have an option to print the dimension in the usual Fortran notation --- depending on the context, sometimes the lower dimension matters, sometimes it doesn't.