ceylon / ceylon.ast

Apache License 2.0
18 stars 3 forks source link

Negated exists and nonempty conditions #76

Closed lucaswerkmeister closed 9 years ago

lucaswerkmeister commented 9 years ago

if (!exists x) and if (!nonempty x) are now allowed, in conjunction with destructuring (#75) but logically separate from it. I musn’t forget to support this too. See ceylon/ceylon-spec#817 and ceylon/ceylon-spec@d024d99a7dd8f02751443dc236f5476ff94784ea.

gavinking commented 9 years ago

Well actually negated conditions can't have patterns. It wouldn't make sense...

lucaswerkmeister commented 9 years ago

Ah, good point. But it can be a pattern variable plus specifier expression (if (!exists nil = null of Anything)), which I’m representing as SpecifiedPattern (not yet committed, WIP), so that will have to be an assertion.

lucaswerkmeister commented 9 years ago

In fact, I don’t think this belongs into ceylon.ast at all – it’s not a syntactical restriction.