pulumi/pkg/compiler
joeduffy 5b791aab77 Introduce intrinsic types
This change eliminates the special type mu/extension in favor of extensible
intrinsic types.  This subsumes the previous functionality while also fixing
a number of warts with the old model.

In particular, the old mu/extension approach deferred property binding until
very late in the compiler.  In fact, too late.  The backend provider for an
extension simply received an untyped bag of stuff, which it then had to
deal with.  Unfortunately, some operations in the binder are inaccessible
at this point because doing so would cause a cycle.  Furthermore, some
pertinent information is gone at this point, like the scopes and symtables.

The canonical example where we need this is binding services names to the
services themselves; e.g., the AWS CloudFormation "DependsOn" property should
resolve to the actual service names, not the string values.  In the limit,
this requires full binding information.

There were a few solutions I considered, including ones that've required
less code motion, however this one feels the most elegant.

Now we permit types to be marked as "intrinsic."  Binding to these names
is done exactly as ordinary name binding, unlike the special mu/extension
provider name.  In fact, just about everything except code-generation for
these types is the same as ordinary types.  This is perfect for the use case
at hand, which is binding properties.

After this change, for example, "DependsOn" is expanded to real service
names precisely as we need.

As part of this change, I added support for three new basic schema types:

* ast.StringList ("string[]"): a list of strings.
* ast.StringMap ("map[string]any"): a map of strings to anys.
* ast.ServiceList ("service[]"): a list of service references.

Obviously we need to revisit this and add a more complete set.  This work
is already tracked by marapongo/mu#9.

At the end of the day, it's likely I will replace all hard-coded predefined
types with intrinsic types, for similar reasons to the above.
2016-12-05 13:46:18 -08:00
..
backends Introduce intrinsic types 2016-12-05 13:46:18 -08:00
core Support binding to arbitrary service types 2016-12-03 13:00:08 -08:00
predef Introduce intrinsic types 2016-12-05 13:46:18 -08:00
testdata Introduce intrinsic types 2016-12-05 13:46:18 -08:00
binder.go Introduce intrinsic types 2016-12-05 13:46:18 -08:00
binder_test.go Remember stack property values (including bounds) 2016-12-05 10:13:57 -08:00
common_test.go Add a diag.Sink.Success helper function 2016-11-22 09:40:09 -08:00
compiler.go Move parse-tree analysis into the Parse* functions 2016-12-01 11:39:03 -08:00
compiler_be.go Detect target cloud earlier on 2016-11-29 13:42:39 -08:00
compiler_fe.go Support binding to arbitrary service types 2016-12-03 13:00:08 -08:00
compiler_sema.go Support binding to arbitrary service types 2016-12-03 13:00:08 -08:00
compiler_test.go Clean up workspace file naming 2016-11-29 20:07:27 -08:00
context.go Add some property binding tests 2016-12-02 14:33:22 -08:00
opts.go Permit passing stack properties via the CLI 2016-11-29 15:27:02 -08:00
parser.go Remember stack property values (including bounds) 2016-12-05 10:13:57 -08:00
parsetree.go Remember stack property values (including bounds) 2016-12-05 10:13:57 -08:00
symbols.go Bind properties that refer to types 2016-12-03 11:14:06 -08:00
templates.go Remember parent documents during template expansion 2016-12-03 15:19:45 -08:00