Skip to content

Commit 236717b

Browse files
committed
Much cleaner check for non-assoc following right-assoc
1 parent 8d028bb commit 236717b

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

lib/Sema/TypeCheckExpr.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ namespace {
416416
if (!group) return false;
417417
if (storedGroup == group) return !GroupAndIsStrict.getInt();
418418
return TC.Context.associateInfixOperators(group, storedGroup)
419-
== Associativity::Left;
419+
!= Associativity::Right;
420420
}
421421
};
422422
} // end anonymous namespace
@@ -522,17 +522,8 @@ static Expr *foldSequence(TypeChecker &TC, DeclContext *DC,
522522
// If we've drained the entire sequence, we're done.
523523
if (S.empty()) return LHS;
524524

525-
// Otherwise, we have to check that this next operator actually
526-
// associates.
527-
if ((op2 = getNextOperator()) && op2.precedence) {
528-
associativity =
529-
TC.Context.associateInfixOperators(op1.precedence, op2.precedence);
530-
RHS = S[1];
531-
}
532-
533-
// If so, start all over with our new LHS.
534-
if (associativity != Associativity::None)
535-
return foldSequence(TC, DC, LHS, S, precedenceBound);
525+
// Otherwise, start all over with our new LHS.
526+
return foldSequence(TC, DC, LHS, S, precedenceBound);
536527
}
537528

538529
// If we ended up here, it's because we're either:

0 commit comments

Comments
 (0)