Fix an assert and a message

This change makes node optional in the lookupBasicType function, which is
necessary in cases where diagnostics information isn't available (such as
with configuration application).  This eliminates an assert when you fat-
finger a configuration key.  The associated message was missing apostrophes.
This commit is contained in:
joeduffy 2017-03-30 15:06:55 -07:00
parent 35f46dcdf7
commit 2451005b7c
2 changed files with 1 additions and 2 deletions

View file

@ -305,7 +305,6 @@ func (ctx *Context) LookupFunctionType(node ast.Function) *symbols.FunctionType
// lookupBasicType handles decorated types (pointers, arrays, maps, functions) and primitives.
func (ctx *Context) lookupBasicType(node diag.Diagable, tok tokens.Type, require bool) symbols.Type {
contract.Require(node != nil, "node")
contract.Requiref(tok.Primitive() || tok.Decorated(), "tok", "Primitive() || Decorated()")
// If a pointer, parse it, bind the element type, and create a new pointer type.

View file

@ -13,7 +13,7 @@ var (
ErrorDuplicateURNNames = newError(2006, "Duplicate objects with the same URN: %v")
ErrorInvalidEnvName = newError(2007, "Environment '%v' could not be found in the current workspace")
ErrorIllegalConfigToken = newError(2008,
"Configs may only target module properties and class static properties; %v is neither")
"Configs may only target module properties and class static properties; '%v' is neither")
ErrorConfigApplyFailure = newError(2009, "One or more errors occurred while applying '%v's configuration")
ErrorResourcePropertyValueInvalid = newError(2010, "Resource '%v's property '%v' has a problem: %v")
ErrorAnalyzeFailure = newError(2011, "Analyzer '%v' reported an error: %v")