Open
Description
The following WyRL program:
term X term Y term Z define YZ as Y | Z term C{X,YZ...} reduce C{X x,Y,YZ... yzs}: => C(x++yzs)
Generates the following probe()
code:
public final void probe(Automaton automaton, int target, List activations) { int r0 = target; Automaton.State s0 = automaton.get(r0); if(s0.kind == K_C) { Automaton.Term t0 = (Automaton.Term) s0; int r1 = t0.contents; Automaton.State s1 = automaton.get(r1); Automaton.Collection c1 = (Automaton.Collection) s1; if(c1.size() >= 2) { for(int r3=0;r3!=c1.size();++r3) { int r2 = c1.get(r3); for(int r5=0;r5!=c1.size();++r5) { if(r5 == r3) { continue; } int r4 = c1.get(r5); if(Runtime.accepts(type1,automaton,automaton.get(r4), SCHEMA)) { int[] state = {r0, r1, r2, r3, r4, r5, 0}; activations.add(new Reduction.Activation(this,null,state)); } } } } } }
If we look very carefully, we can notice that r2
(which represents x
) is never tested against the type X
. This generates potentially invalid matches.
Metadata
Metadata
Assignees
Labels
No labels