puppetlabs/puppet — pull request #1710 by hlindberg (2013-06-14 23:25:04+00:00)
Title: (#21252) Fix problems with false/nil args and returns in lambda

The issue 21252 was triggered by a documentation error but should
have produced a different result than the error that was presented.

This was caused by a series of problems. It was not possible to
pass `false` as a parameter value as this was taken as missing parameter
value.

Also, it was not possible to return the value `false` as this was
translated to `nil` due to defective work around for missing initialized
variable on return.

The fix changes the handling of making sure that the variable that is
returned exists (by setting value explicelty to `nil` before the start
of the exception handling block.

This commit also modifies how a lambda call matches arguments to
parameters and checks what is missing (now with `false` as a valid value
in mind).

A test is added to `collect` that checks that a value of `false` can
both be passed and returned.