Types in dynamically typed languages

Niko Sams niko.sams at gmail.com
Mon Jun 30 21:47:17 UTC 2008


> Yes I think you have exactly the right idea, that's what I thought to. You
> need an expression visitor that can evaluate the possible types returned by
> expressions, and you've got to assign those types either to the assigned
> value, or to the function if it's a "return" statement. There's some
> complexity problems though, because to be correct you would actually need to
> follow every possible path, and you need to model somehow the dependency of
> return-types from argument-types.
I just commited a first version, what works for now:

function foo() { return new A(); }
function bar() { $i = new A(); return $i; }
$j = foo();

(see also php/duchain/tests/duchaintest the testReturnTypeClass test)

At this stage we are allready better than ZendStudio and PHPEclipse :D

could you take a look at the code...

niko




More information about the KDevelop-devel mailing list