René's URL Explorer Experiment


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

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4595ef6e-8819-898c-433e-db7730efdab2
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB526:3D45D4:9946E16:C6F65D2:6977260C
html-safe-nonce0fb5ee08cf067f38c93d3f399fe93b5ed3bd9e397fbd284e27b53a87947a28fb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTI2OjNENDVENDo5OTQ2RTE2OkM2RjY1RDI6Njk3NzI2MEMiLCJ2aXNpdG9yX2lkIjoiNDk5OTQwNzM0MjM3MDM2Njk4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd9bbe458582463ea1aab6838b763e9aba9448462a10f3041bebe43eab4919070
hovercard-subject-tagpull_request:3055039427
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/lcompilers/lpython/pull/2871/files
twitter:imagehttps://avatars.githubusercontent.com/u/171616930?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/171616930?s=400&v=4
og:image:altThis 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/lcompilers/lpython git https://github.com/lcompilers/lpython.git
octolytics-dimension-user_id96538276
octolytics-dimension-user_loginlcompilers
octolytics-dimension-repository_id442864346
octolytics-dimension-repository_nwolcompilers/lpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id442864346
octolytics-dimension-repository_network_root_nwolcompilers/lpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef752335dbbea672610081196a1998e39aec5e14b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Flcompilers%2Flpython%2Fpull%2F2871%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Flcompilers%2Flpython%2Fpull%2F2871%2Ffiles
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=lcompilers%2Flpython
Reloadhttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Reloadhttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Reloadhttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
lcompilers https://patch-diff.githubusercontent.com/lcompilers
lpythonhttps://patch-diff.githubusercontent.com/lcompilers/lpython
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Flcompilers%2Flpython
Fork 173 https://patch-diff.githubusercontent.com/login?return_to=%2Flcompilers%2Flpython
Star 1.6k https://patch-diff.githubusercontent.com/login?return_to=%2Flcompilers%2Flpython
Code https://patch-diff.githubusercontent.com/lcompilers/lpython
Issues 503 https://patch-diff.githubusercontent.com/lcompilers/lpython/issues
Pull requests 85 https://patch-diff.githubusercontent.com/lcompilers/lpython/pulls
Actions https://patch-diff.githubusercontent.com/lcompilers/lpython/actions
Projects 0 https://patch-diff.githubusercontent.com/lcompilers/lpython/projects
Wiki https://patch-diff.githubusercontent.com/lcompilers/lpython/wiki
Security 0 https://patch-diff.githubusercontent.com/lcompilers/lpython/security
Insights https://patch-diff.githubusercontent.com/lcompilers/lpython/pulse
Code https://patch-diff.githubusercontent.com/lcompilers/lpython
Issues https://patch-diff.githubusercontent.com/lcompilers/lpython/issues
Pull requests https://patch-diff.githubusercontent.com/lcompilers/lpython/pulls
Actions https://patch-diff.githubusercontent.com/lcompilers/lpython/actions
Projects https://patch-diff.githubusercontent.com/lcompilers/lpython/projects
Wiki https://patch-diff.githubusercontent.com/lcompilers/lpython/wiki
Security https://patch-diff.githubusercontent.com/lcompilers/lpython/security
Insights https://patch-diff.githubusercontent.com/lcompilers/lpython/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2Flcompilers%2Flpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2Flcompilers%2Flpython%2Fissues%2Fnew%2Fchoose
amritamishra01https://patch-diff.githubusercontent.com/amritamishra01
lcompilers:mainhttps://patch-diff.githubusercontent.com/lcompilers/lpython/tree/main
amritamishra01:add-semantic-error-testhttps://patch-diff.githubusercontent.com/amritamishra01/lpython/tree/add-semantic-error-test
Conversation 2 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871
Commits 6 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits
Checks 18 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/checks
Files changed https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Please reload this pagehttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Add semantic error test for assignment to literal https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#top
Show all changes 6 commits https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
a3b62cb Add semantic error test for assignment to literal amritamishra01 Nov 28, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/a3b62cba31c428bd7566dd81fc2b86088fb45e3e
8f557cb Fix: prevent assignment to literal (semantic error) amritamishra01 Nov 28, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/8f557cbcfa9bf3dcaede02799b8011ff70304abb
7afdb32 Remove forbidden iostream header amritamishra01 Nov 28, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/7afdb32591dfecee78c03e5b91408a428f73074c
94fabb0 Fix: Use correct AST types for literal assignment check amritamishra01 Nov 28, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/94fabb0765e46b6c213fb9974ef13c3bd8d34414
85d32c6 CI: re-run tests amritamishra01 Nov 29, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/85d32c6fa38cde30e35229903e2058c92faf7ad8
50b2938 Merge branch 'main' into add-semantic-error-test amritamishra01 Dec 11, 2025 https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/commits/50b293854fc314e95dcdbe34b6d83f9012034c9b
Clear filters https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Please reload this pagehttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
Please reload this pagehttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
python_ast_to_asr.cpp https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-147457a9117ab6d023c02f9a359d6060c248c4216cfcb47b1fafd17d885063fe
reproduce_bug_01.out https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-77ec10c8835d4ee42f91ec27cc925cf2696ad5a169c0564b7154322095944439
reproduce_bug_01.py https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-e2cf312bdbc63bd68ad341f1d4615c503c905bec8da8a6d47462d652cab25466
src/lpython/semantics/python_ast_to_asr.cpphttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-147457a9117ab6d023c02f9a359d6060c248c4216cfcb47b1fafd17d885063fe
View file https://patch-diff.githubusercontent.com/lcompilers/lpython/blob/50b293854fc314e95dcdbe34b6d83f9012034c9b/src/lpython/semantics/python_ast_to_asr.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/{{ revealButtonHref }}
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-147457a9117ab6d023c02f9a359d6060c248c4216cfcb47b1fafd17d885063fe
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-147457a9117ab6d023c02f9a359d6060c248c4216cfcb47b1fafd17d885063fe
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-147457a9117ab6d023c02f9a359d6060c248c4216cfcb47b1fafd17d885063fe
tests/errors/reproduce_bug_01.outhttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-77ec10c8835d4ee42f91ec27cc925cf2696ad5a169c0564b7154322095944439
View file https://patch-diff.githubusercontent.com/lcompilers/lpython/blob/50b293854fc314e95dcdbe34b6d83f9012034c9b/tests/errors/reproduce_bug_01.out
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/{{ revealButtonHref }}
tests/errors/reproduce_bug_01.pyhttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files#diff-e2cf312bdbc63bd68ad341f1d4615c503c905bec8da8a6d47462d652cab25466
View file https://patch-diff.githubusercontent.com/lcompilers/lpython/blob/50b293854fc314e95dcdbe34b6d83f9012034c9b/tests/errors/reproduce_bug_01.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/{{ revealButtonHref }}
Please reload this pagehttps://patch-diff.githubusercontent.com/lcompilers/lpython/pull/2871/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.