Skip to content

Commit ed80977

Browse files
committed
naive: Fix identifying next operator
1 parent 3d6ac5e commit ed80977

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

naive/op.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func nextOperatorIs(tokens []any, want token.Type) bool {
101101
for _, y := range tokens {
102102
op, ok := y.(token.Token)
103103
if !ok {
104-
break
104+
continue
105105
}
106106
if op.Type == want {
107107
return true

testdata/unary.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ if (! $foo->name instanceof Foo\Id);
3434

3535
if ($type instanceof BarType || !$type->canBar() || !$type->hasItem($m));
3636

37+
assert(! $type->getRel() instanceof OtherRel);
38+
3739
return - $a**3;
3840

3941
return $this->id & 0x3;

testdata/unary.input

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if (!$foo->name instanceof Foo\Id);
3535

3636
if ($type instanceof BarType || ! $type->canBar() || ! $type->hasItem($m));
3737

38+
assert (!$type -> getRel () instanceof OtherRel) ;
39+
3840
return -$a ** 3 ;
3941

4042
return$this->id&0x3;

0 commit comments

Comments
 (0)