pulumi/pkg/errors/backend.go

13 lines
287 B
Go
Raw Normal View History

// Copyright 2016 Marapongo, Inc. All rights reserved.
package errors
import (
"github.com/marapongo/mu/pkg/diag"
)
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 22:46:18 +01:00
var ErrorUnrecognizedIntrinsic = &diag.Diag{
ID: 1000,
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 22:46:18 +01:00
Message: "Intrinsic '%v' was not recognized; it may be unsupported for the target cloud architecture",
}