evhub / coconut

Simple, elegant, Pythonic functional programming.
http://coconut-lang.org
Apache License 2.0
4.04k stars 120 forks source link

`if` + string w/o whitespace creates strange characters #819

Closed kg583 closed 7 months ago

kg583 commented 7 months ago
if "0":print("foo")         # foo

if"0":print("foo")          # SyntaxError: invalid character '▶' (U+25B6)

if"abcdef":print("foo")     # SyntaxError: invalid character '▶' (U+25B6)

if"0":
  print("foo")              # SyntaxError: invalid character '▶' (U+25B6)

if"":print("foo")           # (this one's fine, yielding no output)

The full error for all of those is


File "<string>", line 1
   if ▶0⏹:  #1: if"0":print("foo")
      ^
SyntaxError: invalid character '▶' (U+25B6)```

Notably, the referenced transpiled code is independent of the source string.

evhub commented 7 months ago

Fixed as of coconut-develop>=3.0.4-post_dev13 (pip install -U coconut-develop>=3.0.4-post_dev13 to get the fix).