Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept UnaryMinusExpression as class parameter type
Previously, class parameters of the form `Integer[-1] $param` would fail compilation, because the value `-1` was lexed as a UnaryMinusExpression containing a LiteralInteger. And since the LiteralEvaluator didn't implement the `literal_UnaryMinusExpression` method, the visitor called `literal_XXX` for each ancestor class, until reaching `literal_Object`, which always raises. This adds the `literal_UnaryMinusExpression` method and returns -1 times the expression it wraps. This is similar to how the TypeParser interprets UnaryMinusExpressions[1]. [1] https://github.com/puppetlabs/puppet/blob/8.5.0/lib/puppet/pops/types/type_parser.rb#L161
- Loading branch information