Title: Add semantic error test for assignment to literal by amritamishra01 · Pull Request #2871 · lcompilers/lpython · GitHub
Open Graph Title: Add semantic error test for assignment to literal by amritamishra01 · Pull Request #2871 · lcompilers/lpython
X Title: Add semantic error test for assignment to literal by amritamishra01 · Pull Request #2871 · lcompilers/lpython
Description: This Pull Request adds a new semantic error test to ensure LPython correctly rejects assignments to literal values. ✔ What this PR does Adds a new test: tests/errors/reproduce_bug_01.py The test checks that assigning to a literal (e.g., 'a' = 1) raises the expected SyntaxError: cannot assign to literal. Adds the corresponding .out file with the correct error output. Updates python_ast_to_asr.cpp by adding a semantic check: Detects assignment targets that are literals (Constant, Set, Dict) Throws a SemanticError with a clear and correct message. ✔ Why this is important Python does not allow assignment to literal values. This PR ensures LPython’s semantic analysis matches Python’s behavior and provides a clear error message. ✔ How it was tested Ran the single test using: python3 run_tests.py -t tests/errors/reproduce_bug_01.py Test passes successfully.
Open Graph Description: This Pull Request adds a new semantic error test to ensure LPython correctly rejects assignments to literal values. ✔ What this PR does Adds a new test: tests/errors/reproduce_bug_01.py The test ch...
X Description: This Pull Request adds a new semantic error test to ensure LPython correctly rejects assignments to literal values. ✔ What this PR does Adds a new test: tests/errors/reproduce_bug_01.py The test ch...
Opengraph URL: https://github.com/lcompilers/lpython/pull/2871
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4595ef6e-8819-898c-433e-db7730efdab2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B526:3D45D4:9946E16:C6F65D2:6977260C |
| html-safe-nonce | 0fb5ee08cf067f38c93d3f399fe93b5ed3bd9e397fbd284e27b53a87947a28fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTI2OjNENDVENDo5OTQ2RTE2OkM2RjY1RDI6Njk3NzI2MEMiLCJ2aXNpdG9yX2lkIjoiNDk5OTQwNzM0MjM3MDM2Njk4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d9bbe458582463ea1aab6838b763e9aba9448462a10f3041bebe43eab4919070 |
| hovercard-subject-tag | pull_request:3055039427 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/lcompilers/lpython/pull/2871/files |
| twitter:image | https://avatars.githubusercontent.com/u/171616930?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/171616930?s=400&v=4 |
| og:image:alt | This Pull Request adds a new semantic error test to ensure LPython correctly rejects assignments to literal values. ✔ What this PR does Adds a new test: tests/errors/reproduce_bug_01.py The test ch... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/lcompilers/lpython git https://github.com/lcompilers/lpython.git |
| octolytics-dimension-user_id | 96538276 |
| octolytics-dimension-user_login | lcompilers |
| octolytics-dimension-repository_id | 442864346 |
| octolytics-dimension-repository_nwo | lcompilers/lpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 442864346 |
| octolytics-dimension-repository_network_root_nwo | lcompilers/lpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f752335dbbea672610081196a1998e39aec5e14b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width