This repository was archived by the owner on Apr 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ Constant fill using an exists clause
278278.. code ::
279279
280280 def constant_fill(float(N) A, float c) -> B {
281- B(i) = c where A(i) exists
281+ B(i) = c where exists A(i)
282282 }
283283
284284 An :code: `exists ` clause allows you to add additional expressions to the range
Original file line number Diff line number Diff line change @@ -162,8 +162,8 @@ struct Parser {
162162 } else if (lookahead.kind == TK_IN) {
163163 return parseRangeConstraint ();
164164 } else {
165- auto exp = parseExp ();
166165 L.expect (TK_EXISTS);
166+ auto exp = parseExp ();
167167 return Exists::create (exp->range (), {exp});
168168 }
169169 }
Original file line number Diff line number Diff line change @@ -487,12 +487,11 @@ struct Sema {
487487 // if we redefined an input, it is no longer valid for range expressions
488488 live_input_names.erase (stmt.ident ().name ());
489489
490- auto equivalent_statement_ =
491- stmt.equivalent ().map ([&](Equivalent eq) {
492- auto indices_ = eq.accesses ().map (
493- [&](TreeRef index) { return checkExp (index, true ); });
494- return Equivalent::create (eq.range (), eq.name (), indices_);
495- });
490+ auto equivalent_statement_ = stmt.equivalent ().map ([&](Equivalent eq) {
491+ auto indices_ = eq.accesses ().map (
492+ [&](TreeRef index) { return checkExp (index, true ); });
493+ return Equivalent::create (eq.range (), eq.name (), indices_);
494+ });
496495
497496 TreeRef assignment = stmt.assignment ();
498497 // For semantic consistency we allow overwriting reductions like +=!
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ TEST(TestCornerCases, E16){
216216TEST (TestCornerCases, E17 ) {
217217 auto r = F (1 );
218218 Succeed (
219- " def f(float(1) a) -> (b) { b(i) = 4.0 where a(i) exists }" , {F (1 )}, {r});
219+ " def f(float(1) a) -> (b) { b(i) = 4.0 where exists a(i) }" , {F (1 )}, {r});
220220 CHECK_EQ (at::Scalar (r[0 ]).toFloat (), 4 );
221221}
222222
You can’t perform that action at this time.
0 commit comments