diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-03-06 16:09:41 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-03-08 10:56:47 +0000 |
| commit | 8e75c913b6f9b09cab2ad31fd7d66ea0d1703de8 (patch) | |
| tree | 08556bc4e03b3550324770d80f9a02b057b12ad4 /prog/rand.go | |
| parent | 4097c8d7a8596ddbc9a9db7b7f39c5cbdb1bd742 (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.go | 2 |
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) |
