acton icon indicating copy to clipboard operation
acton copied to clipboard

Can I use `isinstance(foo, list[str])`

Open mzagozen opened this issue 11 months ago • 1 comments

Is is possible to use isintance(foo, list[str])?

actonc exited with code 1 / 0
std_err: Building project in /home/mzagozen/foss/orchestron/acton-yang

ERROR: Error when compiling yang.schema module: Syntax error

/home/mzagozen/foss/orchestron/acton-yang/src/yang/schema.act:1357:49:
     |
1357 |                 elif isinstance(attr_value, list[str]):
     |                                                 ^
unexpected '['
expecting '.' or a closing parenthesis

❯ actonc --version
acton 0.24.1.20250122.13.43.16

mzagozen avatar Jan 22 '25 21:01 mzagozen

I have seen this error before (and worked around it)... but always presumed it was a type error. I just noticed this is actually a syntax error and not a type error. If the parser was to be fixed, could we actually support this? @nordlander ?

plajjan avatar Jan 27 '25 08:01 plajjan

No, we cannot, not right now at least...

plajjan avatar Jul 07 '25 13:07 plajjan