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/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:7885a1b8-e76a-2efb-a831-39d724505fb0 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | DA00:7E327:1F661AC:2931442:6976DFEB |
| html-safe-nonce | 8825defa00eebe2e3cf9efe8c6aba9f0ca04bf4dcf8fb3aac3634768e0555e1e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTAwOjdFMzI3OjFGNjYxQUM6MjkzMTQ0Mjo2OTc2REZFQiIsInZpc2l0b3JfaWQiOiIzOTY3ODgxNDU2Mjk3MzY5NTc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8b09fed521e9bb9cf8217c3765c9ef387bed54920bd8f79d88972fb879a28c55 |
| hovercard-subject-tag | pull_request:3055039427 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/checks |
| 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-cache |
| 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 full-width-p-0 |
| disable-turbo | false |
| 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