diff --git a/pkg/visitor/nsresolver/namespace_resolver.go b/pkg/visitor/nsresolver/namespace_resolver.go index fb11efb..7c0d750 100644 --- a/pkg/visitor/nsresolver/namespace_resolver.go +++ b/pkg/visitor/nsresolver/namespace_resolver.go @@ -374,6 +374,8 @@ func (ns *Namespace) ResolveName(nameNode ast.Vertex, aliasType string) (string, case "mixed": // 8.0 fallthrough case "never": // 8.1 + fallthrough + case "true", "false", "null": // 8.2 return part, nil } } diff --git a/pkg/visitor/nsresolver/namespace_resolver_test.go b/pkg/visitor/nsresolver/namespace_resolver_test.go index 4347898..982cef5 100644 --- a/pkg/visitor/nsresolver/namespace_resolver_test.go +++ b/pkg/visitor/nsresolver/namespace_resolver_test.go @@ -867,6 +867,24 @@ func TestDoNotResolveReservedNames(t *testing.T) { }, } + nameTrue := &ast.Name{ + Parts: []ast.Vertex{ + &ast.NamePart{Value: []byte("true")}, + }, + } + + nameFalse := &ast.Name{ + Parts: []ast.Vertex{ + &ast.NamePart{Value: []byte("false")}, + }, + } + + nameNull := &ast.Name{ + Parts: []ast.Vertex{ + &ast.NamePart{Value: []byte("null")}, + }, + } + function := &ast.StmtFunction{ Name: &ast.Identifier{Value: []byte("bar")}, Params: []ast.Vertex{ @@ -924,6 +942,24 @@ func TestDoNotResolveReservedNames(t *testing.T) { Name: &ast.Identifier{Value: []byte("Never")}, }, }, + &ast.Parameter{ + Type: nameTrue, + Var: &ast.ExprVariable{ + Name: &ast.Identifier{Value: []byte("True")}, + }, + }, + &ast.Parameter{ + Type: nameFalse, + Var: &ast.ExprVariable{ + Name: &ast.Identifier{Value: []byte("False")}, + }, + }, + &ast.Parameter{ + Type: nameNull, + Var: &ast.ExprVariable{ + Name: &ast.Identifier{Value: []byte("Null")}, + }, + }, }, } @@ -951,6 +987,9 @@ func TestDoNotResolveReservedNames(t *testing.T) { nameObject: "object", nameMixed: "mixed", nameNever: "never", + nameTrue: "true", + nameFalse: "false", + nameNull: "null", } nsResolver := nsresolver.NewNamespaceResolver()