aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rand.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-03-06 16:09:41 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-03-13 10:31:21 +0000
commit43c7f3875016259bbb877ac58b831af47c92f06d (patch)
tree9a43856d22af805edc98c917db099a38fb68fdda /prog/rand.go
parent20d042025bd8e1f91bb1fec20ae1509a08bfa4ef (diff)
prog: auto-set proper conditional fields in Deserialize()
Treat all default union arguments as transient and reevaluate them after the call was fully parsed. Before conditional field patching, we do need to have performed arg validation, which also reevaluates conditions. To break the cycle, make validation configurable.
Diffstat (limited to 'prog/rand.go')
-rw-r--r--prog/rand.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/prog/rand.go b/prog/rand.go
index aca3163bd..742dbaa7c 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -886,7 +886,7 @@ func (a *UnionType) generate(r *randGen, s *state, dir Dir) (arg Arg, calls []*C
if a.isConditional() {
// Conditions may reference other fields that may not have already
// been generated. We'll fill them in later.
- return a.DefaultTransientArg(dir), nil
+ return a.DefaultArg(dir), nil
}
index := r.Intn(len(a.Fields))
optType, optDir := a.Fields[index].Type, a.Fields[index].Dir(dir)