Skip to content

Commit 5ff6777

Browse files
authored
Merge pull request #27692 from CodaFi/reprsent
[NFC] Complete the IsIUO Request
2 parents 4acd803 + 4c7ab6e commit 5ff6777

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3702,7 +3702,7 @@ IsImplicitlyUnwrappedOptionalRequest::evaluate(Evaluator &evaluator,
37023702
}
37033703

37043704
case DeclKind::Var:
3705-
// FIXME: See the comment in validateTypedPattern().
3705+
TyR = cast<VarDecl>(decl)->getTypeReprOrParentPatternTypeRepr();
37063706
break;
37073707

37083708
default:

lib/Sema/TypeCheckPattern.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -720,27 +720,6 @@ static bool validateTypedPattern(TypeChecker &TC,
720720

721721
assert(!dyn_cast_or_null<SpecifierTypeRepr>(TL.getTypeRepr()));
722722

723-
// Track whether the decl in this typed pattern should be
724-
// implicitly unwrapped as needed during expression type checking.
725-
if (TL.getTypeRepr() && TL.getTypeRepr()->getKind() ==
726-
TypeReprKind::ImplicitlyUnwrappedOptional) {
727-
auto *subPattern = TP->getSubPattern();
728-
729-
while (auto *parenPattern = dyn_cast<ParenPattern>(subPattern))
730-
subPattern = parenPattern->getSubPattern();
731-
732-
if (auto *namedPattern = dyn_cast<NamedPattern>(subPattern)) {
733-
// FIXME: This needs to be done as part of
734-
// IsImplicitlyUnwrappedOptionalRequest::evaluate(); we just
735-
// need to find the right TypedPattern there for the VarDecl
736-
// in order to recover it's TypeRepr.
737-
namedPattern->getDecl()->setImplicitlyUnwrappedOptional(true);
738-
} else {
739-
assert(isa<AnyPattern>(subPattern) &&
740-
"Unexpected pattern nested in typed pattern!");
741-
}
742-
}
743-
744723
return hadError;
745724
}
746725

0 commit comments

Comments
 (0)