codon icon indicating copy to clipboard operation
codon copied to clipboard

error: unexpected dedent

Open starbugs-qurong opened this issue 2 years ago • 4 comments

I have run the following python program program10.py by codon.

class ZgM3gNx202 (): q1Z69u23 = 31 def eih319224 ( self ) : u0r65y5c8 = 6960 self.q1Z69u23/=(1if((1if(self.q1Z69u23==0)else(self.q1Z69u23))==0)else((1if(self.q1Z69u23==0)else(self.q1Z69u23)))) ; if name == 'main': po0hER8fZ= ZgM3gNx202(); po0hER8fZ.eih319224() print(po0hER8fZ.q1Z69u23)

And it output error message as follow: codon_program10.py:5:1: error: unexpected dedent

I hava run it by both python3 and pypy3 and output the following content: 1.0

The related files can be found in https://github.com/starbugs-qurong/python-compiler-test/tree/main/codon/python_10

starbugs-qurong avatar Apr 04 '23 10:04 starbugs-qurong

@starbugs-qurong Same as in #322, and you can not change class member type. You have to declare it as float, if you are going to set its value to a float.

class ZgM3gNx202():
    q1Z69u23: float = 31.0

elisbyberi avatar Apr 04 '23 11:04 elisbyberi

Thank you. I have made modifications to the program based on your suggestions, and the error "unexpected dedent" still exist.

The related files can be found in https://github.com/starbugs-qurong/python-compiler-test/tree/main/codon/python_10

starbugs-qurong avatar Apr 11 '23 10:04 starbugs-qurong

@starbugs-qurong Duplicate of #317

elisbyberi avatar Apr 11 '23 17:04 elisbyberi

This is certainly a bug in parser.

inumanag avatar Jul 26 '23 21:07 inumanag