I've noticed similar compiler issues on several occasions. Example:
class BaseNode { static Element|Doc parent; Element|Doc getParent() { return parent; } // using class names as types works fine in the two lines above... int getDepth() { object(Element)|object(Doc) p; // ...but triggered a parse error if done here return ( p = this->getParent() ) ? ( p->getDepth() + 1 ) : -1; } /* ...more stuff elided */ }
also, soft casts such as [Element]p fail to parse, while [object(Element)]p or even [array(Element|Text)]children work OK.
/ rjb
Previous text:
2003-05-06 18:48: Subject: Re: Implicit class construction, _cast() and `=()
Thus with the current parser it'd be necessary to write
(object(SomeType)) my_object;
But the _cast lfun ought to be extended to get called here too.
/ Martin Stjernholm, Roxen IS