Skip to content

bug: catch invalid assignments and throw a better error message #2808

Open

Description

@kmr-srbh
'a' = 1
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ lpython ./examples/example.py
semantic error: Unsupported type in check_is_assign_to_input_param()
 --> ./examples/example.py:1:1
  |
1 | 'a' = 1
  | ^^^ 


Note: Please report unclear or confusing messages as bugs at
https://github.com/lcompilers/lpython/issues.

I think the invalid assignment above should have been caught earlier and reported with a better error message.

Activity

  1. changed the title [-]bug: catch invalid assignments and throw a beautiful error message[/-] [+]bug: catch invalid assignments and throw a better error message[/+] on Sep 10, 2024
  2. amritamishra01 commented on Nov 24, 2025

    @amritamishra01

    Hi! I'd like to work on this issue.

    I went through the example and reproduced the error. The assignment to a literal ('a' = 1) should indeed be caught earlier in the semantic analysis, and I’d like to improve the error handling to provide a clearer message.

    I’ll start by checking the relevant assignment validation logic and propose a fix.
    Please let me know if there are any specific guidelines or preferences before I begin.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions