John Plevyak

Results 13 issues of John Plevyak

print(~1) produces: Assert failed: type not set for (unary "~" (int* 1 #:type "int")) [x.py:1:1] Expression: expr->type Source: /home/jplevyak/projects/codon/codon/parser/visitors/typecheck/typecheck.cpp:63 Aborted (core dumped)

``` class A: def __init__(self): self.x = 3 print(A().x) ``` produces x.py:3:5-9: error: 'A' object has no attribute 'x' ╰─ x.py:4:7-12: error: during the realization of __init__(self: A)

``` a = [1, "asdf", 2.0] a[0] = 4 print a[0] ``` Unfortunately sometimes folks use small lists when they really should be using tuples, so the above code doesn't...

``` def f(a, L=[]): L.append(a) return L print(f(1)) print(f(2)) ``` python3 returns [1] [1, 2] codon says: "error: cannot typecheck the program" No only is that not a particularly useful...

``` g = lambda a, L=[] : (L.append(a), L)[1] print(g(1)) ``` python3 returns "[1]" codon says: error: syntax error, unexpected '='

``` class C: pass a = C() a.x = 1 print(a.x) ``` This is doable, I do it in https://github.com/jplevyak/pyc although you might be philosophically against it.

``` print(None or 1) ``` python3 returns "1" codon returns "True" similarly ``` print([] or [1,2,3]) ``` python returns "[1,2,3]" codon: error: cannot typecheck the program

``` class A: x = lambda y: y print(A().x()) ``` python prints "" codon produces: x.py:3:7-14: error: ._lambda_117() missing 1 required positional argument: 'y'