Skip to content

Inconsistency in error messages ? #673

@faze-geek

Description

@faze-geek
s = "abc"
s = s + 1          # Int type

semantic error: Type mismatch in binary operator; the types must be compatible
 --> try.py:8:9
  |
8 |     s = s + 1
  |         ^   ^ type mismatch (str and i32)


s = "abc"
s = s + 1.0        # Float type

semantic error: Type mismatch in binary operator; the types must be compatible
 --> try.py:8:9
  |
8 |     s = s + 1.0
  |         ^   ^^^ type mismatch (str and f64)


s = "abc"
s = s + complex(1,2)   # Complex type - error message not uniform with the above types

semantic error: Casting str to complex is not Implemented   # How is this str to complex casting anyways ?
 --> try.py:8:9
  |
8 |     s = s + complex(1,2)
  |         ^ 


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