Skip to content

Commit ac53a28

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents f3f5194 + 799ddd4 commit ac53a28

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/Sema/TypeCheckExpr.cpp

Lines changed: 1 addition & 1 deletion
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

test/Constraints/operator.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,21 @@ func sr10843() {
237237
(^^^)(s, s)
238238
_ = (==)(0, 0)
239239
}
240+
241+
// SR-10970
242+
precedencegroup PowerPrecedence {
243+
lowerThan: BitwiseShiftPrecedence
244+
higherThan: AdditionPrecedence
245+
associativity: right
246+
}
247+
infix operator ^^ : PowerPrecedence
248+
249+
extension Int {
250+
static func ^^ (lhs: Int, rhs: Int) -> Int {
251+
var result = 1
252+
for _ in 1...rhs { result *= lhs }
253+
return result
254+
}
255+
}
256+
257+
_ = 1 ^^ 2 ^^ 3 * 4 // expected-error {{adjacent operators are in unordered precedence groups 'PowerPrecedence' and 'MultiplicationPrecedence'}}

0 commit comments

Comments
 (0)