Skip to content

Commit 2cf997a

Browse files
committed
Updated tests
1 parent 3f793f3 commit 2cf997a

18 files changed

+32
-24
lines changed

src/bin/lpython.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ int get_errors (const std::string &infile,
659659
std::vector<LCompilers::error_highlight> diag_lists;
660660
LCompilers::error_highlight h;
661661
for (auto &d : diagnostics.diagnostics) {
662-
if (compiler_options.no_warnings && d.level != LCompilers::diag::Level::Error) {
662+
if (!compiler_options.show_warnings && d.level != LCompilers::diag::Level::Error) {
663663
continue;
664664
}
665665
h.message = d.message;

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,7 +2900,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
29002900
if (ASR::is_a<ASR::StructType_t>(*type)) {
29012901
//`s` must be initialized with an instance of S
29022902
throw SemanticError("`" + var_name + "` must be initialized with an instance of " +
2903-
ASRUtils::type_to_str_python_expr(type, nullptr), x.base.base.loc);
2903+
ASRUtils::type_to_str_python_expr(type, assign_asr_target), x.base.base.loc);
29042904
}
29052905
}
29062906
if (tmp && ASR::is_a<ASR::expr_t>(*tmp)) {
@@ -5511,7 +5511,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
55115511
if (v->m_intent == ASR::intentType::In) {
55125512
std::string msg = "Hint: create a new local variable with a different name";
55135513
if (ASRUtils::is_aggregate_type(v->m_type)) {
5514-
msg = "Use InOut[" + ASRUtils::type_to_str_python_expr(v->m_type, nullptr) + "] to allow assignment";
5514+
msg = "Use InOut[" + ASRUtils::type_to_str_python_symbol(v->m_type, v->m_type_declaration) + "] to allow assignment";
55155515
}
55165516
diag.add(diag::Diagnostic(
55175517
"Assignment to an input function parameter `"

tests/reference/asr-dictionary1-a105a36.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-dictionary1-a105a36.stdout",
9-
"stdout_hash": "3bfc95f517560d352cad35658bfb515ca32197c2fad9bd9866fc3138",
9+
"stdout_hash": "59f88e41b95e6a766048de2e8e914ccfc82d5c247c42ee011529b600",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-dictionary1-a105a36.stdout

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@
227227
(IntegerConstant -2 (Integer 4) Decimal)
228228
)]
229229
(Dict
230-
(String 1 (IntegerConstant 1 (Integer 4) Decimal) ExpressionLength DescriptorString)
230+
(Allocatable
231+
(String 1 () DeferredLength DescriptorString)
232+
)
231233
(Integer 4)
232234
)
233235
)
@@ -389,7 +391,9 @@
389391
(IntegerConstant -2 (Integer 4) Decimal)
390392
)]
391393
(Dict
392-
(String 1 (IntegerConstant 1 (Integer 4) Decimal) ExpressionLength DescriptorString)
394+
(Allocatable
395+
(String 1 () DeferredLength DescriptorString)
396+
)
393397
(Integer 4)
394398
)
395399
)
@@ -518,7 +522,9 @@
518522
(IntegerConstant -2 (Integer 4) Decimal)
519523
)]
520524
(Dict
521-
(String 1 (IntegerConstant 1 (Integer 4) Decimal) ExpressionLength DescriptorString)
525+
(Allocatable
526+
(String 1 () DeferredLength DescriptorString)
527+
)
522528
(Integer 4)
523529
)
524530
)
@@ -642,7 +648,9 @@
642648
[(IntegerConstant 1 (Integer 4) Decimal)
643649
(IntegerConstant 2 (Integer 4) Decimal)]
644650
(Dict
645-
(String 1 (IntegerConstant 1 (Integer 4) Decimal) ExpressionLength DescriptorString)
651+
(Allocatable
652+
(String 1 () DeferredLength DescriptorString)
653+
)
646654
(Integer 4)
647655
)
648656
)

tests/reference/asr-func_07-4a8c076.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-func_07-4a8c076.stderr",
11-
"stderr_hash": "85464139a429cd047e5b1532b256935643e929412c3632b8b9d10228",
11+
"stderr_hash": "f318e29b96f7730e9ed5fd89ae43e851f22bf50a5c3b2bde415e24e2",
1212
"returncode": 2
1313
}

tests/reference/asr-func_07-4a8c076.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ semantic error: Assignment to an input function parameter `this` is not allowed
22
--> tests/errors/func_07.py:12:5
33
|
44
12 | this._len = len(this._buf)
5-
| ^^^^ Use InOut[derived type] to allow assignment
5+
| ^^^^ Use InOut[StringIO] to allow assignment

tests/reference/asr-structs_02-f95782c.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-structs_02-f95782c.stderr",
11-
"stderr_hash": "3db272632a14e032f99113f657971836ce7c7ce11f70c44b7582baec",
11+
"stderr_hash": "e77891a7762fcd30afe98c91c7ffeae4342b646a0d44eebd2cb08f1b",
1212
"returncode": 2
1313
}

tests/reference/asr-structs_02-f95782c.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
semantic error: `s` must be initialized with an instance of derived type
1+
semantic error: `s` must be initialized with an instance of S
22
--> tests/errors/structs_02.py:8:5
33
|
44
8 | s: S

tests/reference/asr-test_dict4-39489fa.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_dict4-39489fa.stderr",
11-
"stderr_hash": "fee0e93265feaf634ae62eded08ec63f6c37530369217731b552de61",
11+
"stderr_hash": "568dff6be48680b191c4fe69e3fddb6bd66dad88645820b11b489f4d",
1212
"returncode": 2
1313
}

tests/reference/asr-test_dict4-39489fa.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ semantic error: Type mismatch in annotation-assignment, the types must be compat
22
--> tests/errors/test_dict4.py:2:5
33
|
44
2 | d: dict[i32, i32] = {1: "a", 2: "b"}
5-
| ^ ^^^^^^^^^^^^^^^^ type mismatch ('dict[i32, i32]' and 'dict[i32, str]')
5+
| ^ ^^^^^^^^^^^^^^^^ type mismatch ('dict[i32, i32]' and 'dict[i32, Allocatable[str]]')

0 commit comments

Comments
 (0)