On 28 August 2015 at 04:23, Andrey Ayupov <andrey.ayu...@gmail.com> wrote: > Hello, > > Hopefully a very simple question. I am trying out RPython toolchain. pypy > 2.6, python 2.7. I am using the translator shell. > > Here's my simple example: > > python bin/translatorshell.py > > class mtype(): > def __init__(self): > self.x = 0; > > def mmm(x): > z = x.x + 1 > return z > > t = Translation(mmm, [mtype]) > > t.annotate() > > and it gives me the following. if you put mtype class and mmm function > definitions in a separate module, then you can see it complains about this > line: z = x.x + 1. Why can't it infer type for all arguments and the > result here? I know i am missing something basic.
It never saw the creation of an mytpe, so it doesn't know that mtypes have an x attribute, let alone know what type it has. Try a bigger entry point: def entry(x, y): m = mtype() return mmm(m) -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev