Skip to content

Type checking false positive for dynamic object properties #440

Closed
@tsandall

Description

The ref checker returns false positives for dynamic object property keys that are not strings. The type system needs to be updated so that dynamic object properties have key types in addition to value types.

> show
package repl

p[q] = 1

q = 1

version = {
	"Version": "0.5.7-dev",
	"BuildCommit": "e0586342-dirty",
	"BuildTimestamp": "2017-08-31T00:17:38Z",
	"BuildHostname": "spacebox.local",
}

> p[1]
1
> x = 1; p[x]
1 error occurred: 1:8: rego_type_error: undefined ref: data.repl.p[x]
	data.repl.p[x]
	            ^
	            have (type): number
	            want (type): string

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions