-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added semantic error for float declaration. (#2529)
* Add semantic error for float declaration & added tests for the same.
- Loading branch information
Showing
5 changed files
with
40 additions
and
1 deletion.
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,8 @@ | ||
from lpython import f64 | ||
|
||
def main0(): | ||
pi: float = 3.14 | ||
radi: f64 = 2.0 | ||
print("Area of Circle is", pi*radi**2) | ||
|
||
main0() |
13 changes: 13 additions & 0 deletions
13
tests/reference/asr-test_float_semantic_error-58c0c90.json
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-test_float_semantic_error-58c0c90", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/test_float_semantic_error.py", | ||
"infile_hash": "10929e3991a4aee1a2de473fc5f8caa48b6dcf4a35e2329a15ea5f1f", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-test_float_semantic_error-58c0c90.stderr", | ||
"stderr_hash": "c11166fb86be513e74796a51f5c9e84653c2eb894ed95d502ed8af57", | ||
"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: float type is not supported yet. | ||
--> tests/errors/test_float_semantic_error.py:4:9 | ||
| | ||
4 | pi: float = 3.14 | ||
| ^^^^^ Hint: Use f32 or f64 for now. |
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