Skip to content

Commit 229961c

Browse files
committed
Register error for readonly attribute
1 parent e1c4177 commit 229961c

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

tests/errors/test_assign8.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def f():
2+
c: c32
3+
c = complex(3, 4)
4+
c.real = 5.0
5+
6+
f()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_assign8-4b26e63",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_assign8.py",
5+
"infile_hash": "c88b84b8d7d21aec489288c9064cc9d5a46387b5e6528d30a947ff5c",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_assign8-4b26e63.stderr",
11+
"stderr_hash": "d3f4498398b59be4a1f83de67135842aa5a9a0921e1aa188dc743ca8",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: readonly attribute
2+
--> tests/errors/test_assign8.py:4:5
3+
|
4+
4 | c.real = 5.0
5+
| ^^^^^^^^^^^^

tests/tests.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,10 @@ asr = true
638638
filename = "errors/test_assign7.py"
639639
asr = true
640640

641+
[[test]]
642+
filename = "errors/test_assign8.py"
643+
asr = true
644+
641645
[[test]]
642646
filename = "errors/test_binop1.py"
643647
asr = true

0 commit comments

Comments
 (0)