Skip to content

Commit

Permalink
Fixed issue lcompilers#1993 to improve readability of semantic error …
Browse files Browse the repository at this point in the history
…thrown
  • Loading branch information
tanay-man committed Feb 8, 2024
1 parent 6285062 commit 4d5c412
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
);
throw SemanticAbort();
} else {
throw SemanticError("Unsupported type annotation: " + var_annotation, loc);
throw SemanticError("The type '" + var_annotation+"' is undeclared.", loc);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_annassign_01-2f18669.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_annassign_01-2f18669.stderr",
"stderr_hash": "f3609cdad6bdb1be4a138587d5d36d0a28b71e4e51bb1304c2d2a01f",
"stderr_hash": "28c68e6612db1644548768280ac3d35d3735a13cd32c04da44cec570",
"returncode": 2
}
2 changes: 1 addition & 1 deletion tests/reference/asr-test_annassign_01-2f18669.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
semantic error: Unsupported type annotation: Optional
semantic error: The type 'Optional' is undeclared.
--> tests/errors/test_annassign_01.py:2:8
|
2 | a: Optional[i32] = 5
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_annassign_02-accf6db.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_annassign_02-accf6db.stderr",
"stderr_hash": "3a426fad190cfcadc94dd971acc709446147d8a63658953bfbb94771",
"stderr_hash": "1183fbf06e8412166eb5ca96b5b07cec67382752789a96c7c04c1950",
"returncode": 2
}
2 changes: 1 addition & 1 deletion tests/reference/asr-test_annassign_02-accf6db.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
semantic error: Unsupported type annotation: Pattern
semantic error: The type 'Pattern' is undeclared.
--> tests/errors/test_annassign_02.py:2:15
|
2 | hex_pat : Pattern[str] = r'-?0[xX]+'
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-test_unsupported_type-0d813dd.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_unsupported_type-0d813dd.stderr",
"stderr_hash": "1675de57db132a5a4a589070d7c54ff23a57532bd967ccb416ff8c2a",
"stderr_hash": "df2464bbcb9d52d4dbe40236762e965b1b771406f16ef90cf53b8611",
"returncode": 2
}
2 changes: 1 addition & 1 deletion tests/reference/asr-test_unsupported_type-0d813dd.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
semantic error: Unsupported type annotation: i128
semantic error: The type 'i128' is undeclared.
--> tests/errors/test_unsupported_type.py:2:8
|
2 | i: i128
Expand Down

0 comments on commit 4d5c412

Please sign in to comment.