(#22363) Add [] method to PPatternType to create regexp.

The future evaluator makes it possible to reference types and perform
operations on them. This implements an operation that allows a regular
expression to be created from a string. Thus, String interpolation can
be performed when constructing a regular expression.

Example:
  $name = 'Fred'
  $a ~= Pattern["[a-z]*:${name}"]
  $b = Pattern['.*']
(#22363) Extend type system with PHostClassType and PResourceType

This extends the type system with support for host classes and
resources. The primary reason for adding these to the type system is
that the evaluator needs to expose something that represents references
to types. In the 3.x these were simply qualified
references/names/strings that only resolved to a type when passed as
values to certain methods in the runtime.
(#22363) Add type parameter to PType

This adds a type parameter to PType (the type of types). Without this it
is not possible to infer types (everything reduces to PType).

As an example, the evaluator want to assert that an Array only contains
Resources (e.g. when evaluating x -> y). In the language, it is not
possible to directly manipulate instances of resources (they are in the
catalog, only the handles can be passed around and be manipulated).

The idea is that instead of using strings, or qualified references or
stringified 'File[foo]' as references, these are instead represented as
types! This centrailizes the handling of what a "resource reference" is.

This change thus infers(T) to be Type[T]. As an example the array
[PIntegerType, PStringType] is infered to have the type
Array[Type[Literal]].
(#22363) Add abstract type PCatalogEntryType

An abstract type for things that are catalog types (host classes and
resources) is needed to be able to assert things like
Array[CatalogEntry].
(#22363) Remove super type from PHostClassType

It was a bad idea. The super_class has to be resolved at runtime after
having loaded the class. (The same way it is done for Ruby types).

This commit just removes the ability to declare a PHostClass with a
super type.
(#22363) Add [] type operation to subtypes of PCatalogType

The [] operator is defined for PHostClassType and PResourceType to
allow unspecific types to be used as templates for creating specific
type references.

i.e. to support the expressions
File['a'], Class['a']
more naturally by applying [] to the LHS base type.
(#22363) Add test of capability to create array of types using []

This checks the feature that class and resource references support
the shorthand notation X[a,b,c] to produce [X[a], X[b], X[c]].

This applies only to subtypes of PCatalogType. It is not possible to
create an Array of other parameterized types.
(#22454) Fix partial shadowing of match variables.

Scope only performed partial shadowing of match variables. This was
caused by a search of missing numeric variables in outer scopes.

This commit changes that by making the most nested match scope
authoritative wrt numerical variables. It also changes the scope to use
individually stored variables to simply looking them up in the match
data that is used to construct the match scope.

The scope_spec is changed to test for this. Some other tests changes as
a consequence of the internal refactor.
(maint) Remove unused ephemeral?(name) from scope.

The method was only used from scope_spec.rb
(#22363) Add "future evaluator"

This commit contains the initial work on a new evaluator. It operates
on the output of the future parser.
(#22363) Add variables tests and fix evaluation implementation.

This adds testing of variables, assignment and += assignment in various
forms. The + operator has been broken out to a separate method to be
used by both + and +=.

Corrects calls in runtime support (3x must have string variables names).
Corrects problems in the rspec helper w.r.t top/local scope and making
sure there is a topscope (to lookup ::x namespaced variables).
(#22363) Remove defunct testing of type operations

The functionality was moved to streamline the type model. The operations
are now implemented (and tested) as part of AccessExpression (i.e. it is
a language feature to apply [] operator on types, not an intrinsic
capability of a type).
(#22363) Add Integer[from, to, step] feature to produce array

This produces an array with values from, to with step size (default to
1). Supports descending series when from < to and step < 0.
(#22363) Fix typos in test example titles
(#22363) Add evaluation of conditionals test and fixes

This adds tests of conditional epressions; if, unless, and selector.
This commit also includes handing management of 3x scope nested
match scopes (resetting them to no leak to expressions after the
conditional).
(maint) Cleanup Scope impl from unused methods & test specific code

This removes several unused methods and attributes from
Puppet::Parser::Scope. The only places in code using them where tests.

It also removes some "convenience"/"proxy" methods used by only the
Collector (better for it to do this on its own than cluttering
the Scope implementation)

Also refactors creating scopes for the purpose of running tests by
moving that logic from Scope to PuppetSpec::Scope that should be
included in examples to use the no(now renamed) method
#create_test_scope_for_node(node_name).

Useless and tests that test that scope behaves the wrong ! way removed.
(It is always illegal to set match data variables from anything but a
match, but this functionality was tested by spec tests).

It was then much clearer how match scope and local scope should work.
Now a LocalScope always have a nested MatchScope that is transparent
until a match is set, or a nested MatchScope is created for an inner
scope. This enables rewriting the evaluator logic to not leak match
scopes where there is a sequence of matches at top level in a define or
class body.
(#22363) Add examples for match result variable shadowing

There were examples missing that tests evaluation of match operator.
(shadow / no shadow, and if failed match alters match data or not).
(#22363) Add tests of Block, and Array/Hash +, -, and << operators

This also fixes an issue with interpretation of conversion of array
to hash using two different forms [k,v,k,v] vs. [[k,v], [k,v]] - both
are now supported.
(#22363) Add support for -= operator (validate as error in puppet 3).

This adds support for the -= operator (deletes) and adds validation
that it is not supported in puppet 3.
(#22363) Add validation test for -= (UNSUPPORTED_OPERATOR) in Puppet 3