aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorNecip Fazil Yildiran <necip@google.com>2020-08-14 08:16:31 +0000
committerDmitry Vyukov <dvyukov@google.com>2020-08-14 11:02:10 +0200
commit5ce135324a84d6de67c913f1b725e3fc5ec39535 (patch)
tree96e0a34a3a773c5a797e8de66fd6f3a3542f1183 /prog/mutation.go
parent424dd8e7b52828cad44ce653a5d4ac30670f5e2c (diff)
prog: fix UnionType mutation for when per-field dir is specified
prog/TestMutateRandom used to fail due to this.
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 1484c055c..af6a458f0 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -451,10 +451,10 @@ func (t *UnionType) mutate(r *randGen, s *state, arg Arg, ctx ArgCtx) (calls []*
if index >= a.Index {
index++
}
- optType := t.Fields[index].Type
+ optType, optDir := t.Fields[index].Type, t.Fields[index].Dir(a.Dir())
removeArg(a.Option)
var newOpt Arg
- newOpt, calls = r.generateArg(s, optType, a.Dir())
+ newOpt, calls = r.generateArg(s, optType, optDir)
replaceArg(arg, MakeUnionArg(t, a.Dir(), newOpt, index))
return
}