Skip to content

Commit 373b8f3

Browse files
committed
Updated tests
1 parent 3f793f3 commit 373b8f3

17 files changed

+58
-27
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 1 addition & 1 deletion
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)) {

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: 2 additions & 2 deletions
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",
12-
"returncode": 2
11+
"stderr_hash": "cbe668f9cdaee2e0fcd43c69370956c34f5e5949a1fa3602dd94b253",
12+
"returncode": -6
1313
}
Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
semantic error: Assignment to an input function parameter `this` is not allowed
2-
--> tests/errors/func_07.py:12:5
3-
|
4-
12 | this._len = len(this._buf)
5-
| ^^^^ Use InOut[derived type] to allow assignment
1+
LCOMPILERS_ASSERT failed: $DIR/libasr/src/libasr/../libasr/asr_utils.h
2+
function type_to_str_python_expr(), line number 2199 at
3+
expr != nullptr
4+
ERROR MESSAGE:
5+
`expr` should be non-null for `StructType`
6+
Traceback (most recent call last):
7+
 File "$DIR/lpython.cpp", line 2140
8+
 File "$DIR/lpython.cpp", line 216
9+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 9180
10+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 9112
11+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5197
12+
 File "$DIR/python_ast.h", line 1909
13+
 File "$DIR/python_ast.h", line 1776
14+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5387
15+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5363
16+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5151
17+
 File "$DIR/python_ast.h", line 1909
18+
 File "$DIR/python_ast.h", line 1780
19+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5658
20+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5530
21+
 File "$DIR/semantics/python_ast_to_asr.cpp", line 5514
22+
 File "$DIR/libasr/src/libasr/asr_utils.h", line 2200
23+
struct_sym = ASRUtils::get_struct_sym_from_struct_expr(expr);
24+
 Binary file "/usr/lib/system/libsystem_c.dylib", local address: 0x18037bc5f
25+
 Binary file "/usr/lib/system/libsystem_pthread.dylib", local address: 0x18047288b
26+
 Binary file "/usr/lib/system/libsystem_platform.dylib", local address: 0x1804ac623
27+
Abort: Signal SIGABRT (abort) received
28+

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]]')

tests/reference/asr-test_dict5-c436d37.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_dict5-c436d37.stderr",
11-
"stderr_hash": "85918b86a904812b9f151ec636dac3c770446a33ebac2f5910591ea7",
11+
"stderr_hash": "d05b6a704207c710995f2ba205424a557f9edd5160a6eb86e83efd28",
1212
"returncode": 2
1313
}

0 commit comments

Comments
 (0)