Skip to content

Commit 244a823

Browse files
committed
[Constraint system] Maintain paren type sugar for patterns.
1 parent 7bef540 commit 244a823

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/Sema/CSGen.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,9 +2207,12 @@ namespace {
22072207

22082208
switch (pattern->getKind()) {
22092209
case PatternKind::Paren:
2210-
// Parentheses don't affect the type.
2211-
return getTypeForPattern(cast<ParenPattern>(pattern)->getSubPattern(),
2212-
locator);
2210+
// Parentheses don't affect the canonical type, but record them as
2211+
// type sugar.
2212+
return ParenType::get(
2213+
CS.getASTContext(),
2214+
getTypeForPattern(
2215+
cast<ParenPattern>(pattern)->getSubPattern(), locator));
22132216
case PatternKind::Var:
22142217
// Var doesn't affect the type.
22152218
return getTypeForPattern(cast<VarPattern>(pattern)->getSubPattern(),

0 commit comments

Comments
 (0)