# HG changeset patch # User Paul Boddie # Date 1473371994 -7200 # Node ID 8f8e85368db9dcce702f580794e582009562c011 # Parent 95ebcba817be652de60bc1d23b6f4f10279bd49d During inspection, define "self" in methods in terms of the parent class. diff -r 95ebcba817be -r 8f8e85368db9 inspector.py --- a/inspector.py Thu Sep 08 23:34:23 2016 +0200 +++ b/inspector.py Thu Sep 08 23:59:54 2016 +0200 @@ -568,7 +568,16 @@ locals = self.function_locals[function_name] = {} - for argname in argnames: + # Define "self" in terms of the class if in a method. + # This does not diminish the need for type-narrowing in the deducer. + + if argnames: + if self.in_class and argnames[0] == "self": + locals[argnames[0]] = Reference("", self.in_class) + else: + locals[argnames[0]] = Reference("") + + for argname in argnames[1:]: locals[argname] = Reference("") globals = self.scope_globals[function_name] = set()