Closed shreyas-goenka closed 2 months ago
patch file used:
@@
var x expression
@@
-dyn.NewValue(x, dyn.Location{})
+dyn.V(x)
@@
var x expression
var y identifier
@@
-dyn.NewValue(x, y)
+dyn.NewValue(x, []dyn.Location{y})
@@
var x expression
@@
-dyn.NewValue(x, dyn.Location{...})
+dyn.NewValue(x, []dyn.Location{{...}})
@@
var x expression
var y expression
@@
-dyn.NewValue(x, y.Location())
+dyn.NewValue(x, y.Locations())
@@
var x expression
var y expression
@@
-NewValue(x, y.Location())
+NewValue(x, y.Locations())
@@
@@
-dyn.NilValue.WithLocation(...)
+dyn.NilValue.WithLocations([]dyn.Location{...})
Once this is merged, I'll followup with the first use case for this: https://github.com/databricks/cli/pull/1506
Changes
This PR changes the location metadata associated with a
dyn.Value
to a slice of locations. This will allow us to keep track of location metadata across merges and overrides.The convention is to treat the first location in the slice as the primary location. Also, the semantics are the same as before if there's only one location associated with a value, that is:
Tests
Modifying existing merge unit tests. Other existing unit tests and integration tests pass.