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
278
278
.. code ::
279
279
280
280
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)
282
282
}
283
283
284
284
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 {
162
162
} else if (lookahead.kind == TK_IN) {
163
163
return parseRangeConstraint ();
164
164
} else {
165
- auto exp = parseExp ();
166
165
L.expect (TK_EXISTS);
166
+ auto exp = parseExp ();
167
167
return Exists::create (exp->range (), {exp});
168
168
}
169
169
}
Original file line number Diff line number Diff line change @@ -487,12 +487,11 @@ struct Sema {
487
487
// if we redefined an input, it is no longer valid for range expressions
488
488
live_input_names.erase (stmt.ident ().name ());
489
489
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
+ });
496
495
497
496
TreeRef assignment = stmt.assignment ();
498
497
// 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){
216
216
TEST (TestCornerCases, E17 ) {
217
217
auto r = F (1 );
218
218
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});
220
220
CHECK_EQ (at::Scalar (r[0 ]).toFloat (), 4 );
221
221
}
222
222
You can’t perform that action at this time.
0 commit comments