JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Raises nested within ternary expressions produce output which is not valid python #365

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Description of Bug

Raises nested within ternary expressions produce output which is not valid python: Discovered while working on #364

How to Reproduce

Python output: return 10 if x > 0 else raise Err("Expected positive number.") Mamba input is identical.

Expected behavior

I want this to still be valid Mamba code. So in such situations it should be converted to a if else and not a ternary expressions. Need to think about how we keep this as generic as possible, put I suppose this is no longer an issue as soon as an expression has become a code block, because that should be dealt with within #364.