Age | Commit message (Collapse) | Author | Files | Lines |
|
The type calculator did not correctly compute assignability
for an Enum when assigning a Variant type. Now, all variants
are checked if they are assignable to the enum type.
|
|
This fix corrects Pattern.assignable?(Variant) which was not
correctly supported in the type calculator. (It gave up if t2
was not a String or an Enum). Now, if t2 is a Variant,
the check recurses to the types described by the enum.
|
|
This adds the ability to have a trailing comma after the last
match in a node expression.
|
|
When a Resource type is stringified it selects the short notation
(e.g. Fee::Foo) over the longer (e.g. Resource[Fee::Foo]), and
when doing so it should output each segment of the FQN with a
capital letter. The current implementation only capitalizes
the initial letter (e.g. Fee::foo::fum).
This fixes the implementation of
TypeCalculator.string_PResourceExpression to capitalize all segments.
|
|
Some types inherited PAbstractType (to indicate they where not
concrete). This just causes confusion when using the Ruby API
to check if a Type is PAnyType.
This makes all types inherit from PAnyType (which is the only
type inheriting from PAbstractType).
|
|
|
|
This updates the Gemfile to use RGen 0.7.0 (optionally).
In RGen 0.7.0 containment now works as specified, if something is
contained more than once, it moves to the last container that contains
it (by removing it as contained from all other containers). This caused
problems in the Function API where the block default Callable type was
reused for all signatures (and thus moved). There were also problems in
tests where the same type instances was contained in multiple locations.
This fixes these to use distinct instances.
|
|
hlindberg/PUP-2663_allow-unary-plus-minus-string-numeric-conversion
(PUP-2663) Allow unary plus/minus string numeric conversion
|
|
\s includes newline when ^$ is used.
^$ skips leading and trailing optional matches
\A\z does not skip as they force matching of strings start/end
|
|
(PUP-2703) Make 'tag' be a statement function
|
|
The log functions in 3x outputs th name of the containing scope
(for notice etc.). The reimplemented methods for the 4x function API
did not include this behavior.
Now, the calling scope is passed to the Logging utility to be output
the same way as for 3x.
|
|
|
|
|
|
(PUP-2787) Rename Object Type to Any
|
|
This renames the top most type in the type system to Any from
the name Object. This is done because the word Object carries
connotations of "Object Oriented Programming" that simply adds confusion
about how puppet works.
This commit is basically a rename refactoring.
|
|
(PUP-2758) Add micro (and other) benchmarks for future parser/evaluator
|
|
Loading the same function multiple times from modules caused
an error because of a typo in NamedEntry. This adds tests for the
helper classes basic functionality, and adds tests that loaders indeed
can load a function more than once.
This also corrects error handling (yet another typo) when a function was
redefined (the wrong method was called).
|
|
Puppet allows keywords as attribute names in defines and
parameterized classes. This was missing for the added keywords:
* FUNCTION
* ATTR
* PRIVATE
* TYPE
Which caused a clash with existing types.
This commit adds the new keywords to the list of accepted words
in the grammar.
|
|
* pr/2765:
(PUP-2755) Mark function stubs as rvalue
(PUP-2791) Update docs for EPP syntax
(maint) Fix stylistic issues from review of PUP-2755
(PUP-2755) Remove special handling of iterative functions / cleanup
(maint) Fix stylistic issues from review
(maint) Remove dead test code
(maint) Add 3x function doc stub for 4x function with
(maint) Update function 'with's documentation with an example
(maint) Add 3x function doc stub for 4x function slice
(maint) Add 3x function doc stub for 4x function reduce
(maint) Add 3x function doc stub for 4x function match
(maint) Add 3x doc function stub for 4x function map
(maint) Add 3x function doc stub for 4x function filter
(maint) Add 3x function doc stub for 4x function each
(maint) Add doc stub for 4x function assert_type
(PUP-2755) Fix issues after changes from PUP-514
(maint) Add leaky local scope tests
(PUP-2755) Move iterative functions to the new API
(PUP-1057) Remove the function stubs for collect and select
|
|
|
|
Work on PUP-2650 missed that the future parser has a separate method of
handling deprecation warnings. This changes IssueReporter to muzzle
deprecations when 'deprecations' is in Puppet[:disable_warnings]. It
also adjusts the max_warnings/deprecations counts to be one-based, so a
setting of Puppet[:max_warnings] = 4 emits at most 4 warnings per
manifest from future parser. A setting of 0 blocks the warnings
altogether.
Adds specs for the current behavior.
|
|
This adds tests that local and match scope handling is corrent
and does not leak variable bindings.
|
|
This moves all the iterative functions to the 4x function API.
Functions are now simpler to read. A shared utility module
was created for repeated asserts.
While testing it was clear that it is difficult to use
Puppet.lookup(:loaders), and the evaluator was changed to get the
loaders via the compiler instead.
The evaluator tests are changed to make use of the simplified
handling of the loaders.
The tests for the functions that have moved, were also moved, but
are unchanged in what they test.
|
|
Object is now the top class and so there is no need to use
Optional[Object] everywhere. This removes the type factory method
optional_object and replaces all occurrances with just object. It also
updates all of the uses of Optional[Object] to use just Object.
|
|
|
|
The tests for define and class rejecting `*` parameters put another
parameter after the one specified with `*`. This created an ambiguity in
the test for why it is failing, since `*` is not allowed before any
other parameters. Since the assertion is that define and class simply
cannot have `*` parameters, the better test is to have a single
parameter with a `*`.
|
|
The work so far has not been able to deal with type checking lambdas.
This adds tests for the conditions that will need to be handled for
lambdas to properly type check their arguments. Currently none of these
new tests pass.
|
|
The assignability logic didn't consider an empty Tuple (Tuple) to be assignable
to a Tuple of min size 0 (Tuple[Object, 0, default]). This prevented the
case of a Callable that represented with only varargs from being called
with no arguments (Callable[Object, 0, default], Tuple).
The mistake was that after the check that the sizes of the tuples were
compatible, it then used the *max* of the two tuple's type parameters to
determine if the two are compatible. However, only the list of types in
the right hand side tuple matter in determining assignability.
|
|
This improves testing of typed parameters, and the ivolved
tests in general. One test moved from being an evaluation test
(it only tested parsing).
Iterative function testing changed to use better matchers.
|
|
|
|
|
|
This makes define and class parameters support optionally typed
parameters when using the future parser. The type expressions
are evaluated by the Pops Bridge when parameters are transformed t 3x.
The 3x parameters are not aware of type information (they are encoded as
arrays), and changes to all the logic that deals with parameters turned
on to not be a good design. The resource type and resource is instead
made aware of the opt-in types via a separate param-name to type map
that it applies in the validation step that was already performed.
|
|
|
|
This validates that only functions may have captures-last, and
that it may only be placed last amon the parameters.
|
|
This updates the tree dumper to dump parsed type information
for parameters.
|
|
The calculation of string length was done wrong for dingle
quoted string resulting in negative lengths.
|
|
(PUP-2514) Remove ability to search for String type in String.
|
|
(PUP-1807) empty string is the truth
|
|
Tag function should not require parentheses.
|
|
This makes it possible to use an unary +/- in a string. The sign
of the converted value abides by the unary string sign. White space is
allowed around the sign, and at the end of the string.
'+ 2' + '- 2' == 0
This is of value when dealing with original data in string form
that needs to be converted. Without this it is especially difficult to
pass a negative value around in string form.
|
|
(PUP-2314)(PUP-2632) Fix assert_type's API
|
|
While philosophically true, a String consists of a number of
substrings, it is not very meaningful to support only the ability to
assert that. In order to be useful it would need to answer a much wider
variety is Enum[red, blue, green] in "it was blue, orange, and red", is
there a String of 1-5 characters in length inside the string "1234" etc.
This commit removes the naive support for String/Data-type search
in String as it is more confusing than helpful. If we later find it to
be of value, a more elaborate implementation is needed.
|
|
This makes the selector expression in the future evaluator have
the same semantics as the 3.6.1 current evaluator. The future evauator
did not process default out of band, and did not raise an error when
there was no match.
This fixes both problems.
|
|
Without this change, a reference to "any" must be written
Optional[Variant[Type, Object]] which is quite horrible.
There is no harm in making Type an Object since that is the most
abstract type as seen from the Puppet Programming Language.
|
|
This adds checks that future evaluator treats '' != undef.
(It already did this, but tests were missing).
|
|
An empty string is now interpreted as a "true" value. It used to
represent a false value.
This representation is only in the future evaluator. Values are still
transformed when calling the 3x function API (it expect undef to be
encoded as empty string). This also takes place when transforming to the
3x catalog.
|
|
* upstream/stable:
(PUP-2568) Remove unnecessary calls
(maint) Reorder code to increase clarity
(PUP-2581) Make illegal names interchangeable to legal variable work
(PUP-2568) Downcase class name before validating
Conflicts:
lib/puppet/pops/parser/eparser.rb
Rebuilt eparser.
|
|
hlindberg/pup-2581_interpolating-expression-of-bad-name
(PUP-2581) Make illegal names interchangeable to legal variable in interpolation
|
|
In interpolation when using expression mode ${} and having an illegal
name (e.g. _x) that resulted in a syntax error as the _x got translated
to a STRING token (a bare word not being a name). The interpolation
logic could then not transform it into a (valid) variable expression
(i.e. $_x).
The change is to let the lexer emit a WORD token for the illegal NAME.
The interpolation then changes that to a VARIBLE if it is the only
expression. If the WORD token escapes into the grammar, it is equivalent
to having used a quoted string in the source text.
Note that WORD only accepts unqualified input, anything with a : that is
not a valid NAME is still flagged as an error. Thus _x::y, x::_y are
both illegal NAME.
|
|
Previously the check for a valid name was done against the raw input,
however it later downcased the name and used that form. This order
caused Class['A'] to be an error, which isn't desired (at least not
until PUP-1810 is taken care of). By just changing the order of
operations capital letters are once again allowed.
|