Skip to content

Exhaustive eval for map/list/object evaluation #1118

@mneff-roblox

Description

@mneff-roblox

Feature request checklist

  • There are no issues that match the desired change
  • The change is large enough it can't be addressed with a simple Pull Request
  • If this is a bug, please file a Bug Report.

Change
Similar to how exhaustive eval of and merges the unknowns, I think there should be exhaustive eval for these types.

	// If any argument is unknown or error early terminate.
	for i, key := range m.keys {
		keyVal := key.Eval(ctx)
		if types.IsUnknownOrError(keyVal) {
			return keyVal
		}
		valVal := m.vals[i].Eval(ctx)
		if types.IsUnknownOrError(valVal) {
			return valVal
		}
	}

You can see in the map code that the first unknown or error hit short circuits and returns, but if I'm building a map out of two unknowns, it would be nice for this to evaluate to the merging of those two unknowns when using exhaustive evaluation. Same applies to list and object.

Example

{"foo": a, "bar": b}
evaluates to
a (4) (*types.Unknown)

Desired output should be the same as
a && b
evaluates to
b (2), a (1) (*types.Unknown)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions