summaryrefslogtreecommitdiff
path: root/spec/integration/parser/future_compiler_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-10-16(PUP-3201) Stop using :undef for parameters in 4xAndrew Parker1-0/+36
The :undef symbol was still leaking all over the place internally. This caused type inference to sometimes end up with Runtime[ruby, Symbol]. By using nil instead of :undef, everything can be much more straightforward. Once the code removal for puppet 4 comes into play even more oddities around how resource parameters are handled can be performed.
2014-10-10(PUP-3201) Treat :undef as PNilTypeAndrew Parker1-0/+20
For PUP-2857 :undef was changed from being a PNilType to a PRuntimeType. This stopped the undef literal in the language from being able to be assigned to Optional parameters. However, this only happened when the undef was the default expression for the parameter.
2014-08-27(PUP-2349) Specify mode as an octal string consistently in spec manifest ↵Kylo Ginsberg1-2/+2
snippets In the puppet 4.0 parser, the file resource's mode property will be required to be a string containing an octal (or symbolic) representation of mode. For consistency then, this commit changes all cases where mode was specified as a Numeric to be a string containing an octal representation of mode (always prefaced with a 0, again for clarity and consistency).
2014-08-18(maint) Cleanup commentAndrew Parker1-1/+1
The comment had trailing whitespace and a comma. It makes more sense without either.
2014-08-11(PUP-3001) Revert future parser change removing dynamic scoped defaultsHenrik Lindberg1-2/+2
This reverts the change in PUP-867 by (again) calling the same 3x logic for looking up defaults. The implementation of PUP-867 also added tests, and one of those are now changed to reflect the changed behavior.
2014-08-01(PUP-2898) Add 4x style resource expressionsHenrik Lindberg1-2/+3
This changes the following: * Assignment has lower precedence than resource expressions * Local defaults are supported in resource instantiation expressions * A Resource body may have a new expression AttributesOperation that must evaluate to a hash. * Stricter validation of resource titles * Changes to TreeModelDumper wrt how BlockExpression is rendered (to improve debugging output). As a consequence many tests needed adjustments. * Tests that previously passed have been modified because of stricter validation. This also includes maintenance. Removing dead code/fixing stale comments and documentation.
2014-07-07(PUP-2891) Treat override of class as an error.Henrik Lindberg1-0/+8
This makes an attempt to override a class parameter issue an error from the runtime layer rather than expecting the underlying 3x implementation to do it when the left expression does not result in a resource, or a resource that has 'class' as resource type.
2014-07-07(PUP-2532) Correct lookup of default parametersHenrik Lindberg1-0/+19
The lookup of resource parameters via the type e.g. Notify[id][message] performed the lookup in the calling scope, not the resource's closure scope which resulted in parameter default values were being seen from the perspective of the caller (they may be very different). This corrects the lookup to use the resource's closure scope.
2014-06-19(PUP-2787) Rename Object Type to AnyHenrik Lindberg1-1/+1
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.
2014-06-12(maint) Remove optional_objectAndrew Parker1-1/+1
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.
2014-06-12(maint) Fix typos and remove dead codeAndrew Parker1-2/+2
2014-06-12(PUP-514) Only check lambda args onceAndrew Parker1-1/+9
The previous implementation checked the argument types twice against the signature. This reduces it to a single check. The error for a missing argument is now caught in a place that used to be unreachable and so the error has been converted into an issue, which also provides the information about where the failure occurred.
2014-06-12(PUP-514) Error when required args follow optionalAndrew Parker1-2/+2
This adds a check when the signature for a closure is being calculated to catch invalid parameter specifications where required arguments are placed after optional onces. Allowing that would mean that the argument range information would be incorrect.
2014-06-12(PUP-514) Enforce types on lambda parametersAndrew Parker1-10/+20
This updates Closure code to implement type checking for the parameter values.
2014-06-12(PUP-514) Add tests for lambdasAndrew Parker1-0/+171
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.
2014-06-12(PUP-514) Improve/add tests for typed parameters define/classHenrik Lindberg1-0/+98
2014-06-11Merge pull request #2660 from hlindberg/PUP-121_remove-relative-name-spacingJosh Partlow1-4/+8
(PUP-121) remove relative name spacing
2014-06-11(PUP-121) Change transformation of CatalogEntryType to not be absoluteHenrik Lindberg1-4/+4
The attempt to make all catalogEntryTypes absolute did not work out so great as the lower level APIs in 3x expect non :: prefixed names to be absolute. This changes the transformation made in the evaluator to always use "relative" names.
2014-06-11(PUP-121) Ensure classes are absolute when transforming to ResourceHenrik Lindberg1-4/+8
When the 3x to 4x calls take place, resource references in the form of a PCatalogEntryType are transformed to Puppet::Resource. Depending on where these (reference) Puppet::Resource instances are used they need to either be absolute, or not (yes, 3x is inconsistent). Since future parser in 3.7 (and later 4.0) will not support dynamic name scoping, the PCatalogEntryType's should in general be absolute. This commit changes the transformation to make the created Puppet::Resource (references) absolute (when it is possible). This also adds more tests
2014-06-03Merge remote-tracking branch 'upstream/stable'Andrew Parker1-0/+29
* upstream/stable: (maint) Remove failure for empty generated tags (maint) Update test to use resource matcher (maint) Add sitemoduledir to env env tests (PUP-2689) Make AST Resource check tags against "inherited" tags (maint) Remove unused Puppet::Parser::AST::Tag class
2014-05-30(PUP-2689) Make AST Resource check tags against "inherited" tagsHenrik Lindberg1-0/+29
This overrides the tagged? method in AST Resource to also search for tags in its containing resource. These tags will be set when the resource is finalized (just before serialization on transformation to external format). If this is not done, resources will have a different tag set when a search is made for the node itself (exported or virtual) vs. searching external resources. This also correct minor problems with passing an array (which could result in an array being set as a tag). It was also possible for empty tags to be set if a string tag contained multiple :: in sequence, or if ending with ::. Now an error is raised for these conditions (just like for empty segments generated by using a sequence of commas (which was on a different code path).
2014-05-19(PUP-867) Remove support for dynamic defaults for future parserHenrik Lindberg1-0/+32
WHen future parser is in effect, the lookup of default values will now not look in "parent scopes" (i.e. scopes that *contain* the resource). Instead it now only looks in inherited and enclosing scopes + itself. This removes the confusion that occurs when a class may be included from different locations, and the location that wins manages to impose the defaults from its scope. This removal goes hand in hand with dynamic scoping being removed everywhere else.
2014-04-27(maint) Convert to using have_resource matcherAndrew Parker1-22/+17
Using the have_resource matcher makes the tests a little shorter and more expressive. It also uses the common way of matching so that we can get better error reporting. It turns out that one of the tests was matching against the incorrect class name, so that is now fixed. This also extracts a be_resource matcher so that you can match against an individual resource independent of a catalog.
2014-04-27(maint) Convert to compile_to_catalogAndrew Parker1-135/+68
The tests used various ways to contruct the catalog. However, putting together a catalog isn't always as simple as just calling compile. compile_to_catalog puts all of the steps together in a way that is easy to use in the tests.
2014-04-23(PUP-2302) Fix issue with Resource Defaults for qualified namesHenrik Lindberg1-0/+15
When defaults were set using future evaluator and the resource has a qualified name, the registration of the default was not recognized because scope requires every segment of a qualified name to be upper cased. This adds upper casing of every segment. An integration test checks that the capitalization works.
2014-04-07(PUP-1964) Handle nil class parameter valueHenrik Lindberg1-1/+12
The problem was that nil was not transformed to undef for the result of a parameter default expression and nil was interpreted as value missing by the 3x class/define logic. This adds a transformation in the PopsBridge by introducing a new kind of bridging expression. Likewise, a transformation was needed back again to nil as the value was set in TypeCalculator when performing an inference and symbol :undef can not be used where a String is expected. It was also observed in PUP-1964 that the error that surfaced lacked location information. This was caused by the transformation of unparenthesized call, where the transformed call expression did not get location information set. Tests added for the two different problems. The factory method for recording position now also checks if the end_locateable is void of location information (which can happen in some transformations).
2014-02-28(PUP-1144) Improve handling of underscore in variable namesHenrik Lindberg1-0/+24
The last segment of a qualified variable name is allowed to start with an underscore. Previously this was only allowed for a single segment.
2013-12-06(#22363) Fix problems from changed validation of relationships.Henrik Lindberg1-1/+1
The vaidation was changed from a specific relationship validation to using just R-Value check. This was a mistake since a CollectExpression is a valid operand in a relationship even if not producing an R-Value. Old version resurrected and streamlined to do either R-Value check, or check that operand is a Collector.
2013-12-06(maint) Fix stale comments and remove commented out code.Henrik Lindberg1-8/+2
2013-12-05(maint) Fix failing tests after rebase to latest masterHenrik Lindberg1-2/+2
4 tests were failing because Puppet[:hashed_node_data] was renamed to Puppet[:trusted_node_data]. This commit changes the failing tests to use the renamed setting.
2013-12-05(#22363) Add compiler integration test for future evaluatorHenrik Lindberg1-0/+398
(This was missing in an earlier commit)