Skip to content

Commit 1819d33

Browse files
committed
Disable PlaceholderType parsing
1 parent be2aeb5 commit 1819d33

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

lib/Parse/ParseType.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ LayoutConstraint Parser::parseLayoutConstraint(Identifier LayoutConstraintID) {
151151
/// type-simple '!'
152152
/// type-collection
153153
/// type-array
154-
/// '_'
155154
ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID) {
156155
ParserResult<TypeRepr> ty;
157156

@@ -183,9 +182,6 @@ ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID) {
183182
ty = parseTypeCollection();
184183
break;
185184
}
186-
case tok::kw__:
187-
ty = makeParserResult(new (Context) PlaceholderTypeRepr(consumeToken()));
188-
break;
189185
case tok::kw_protocol:
190186
if (startsWithLess(peekToken())) {
191187
ty = parseOldStyleProtocolComposition();
@@ -1443,9 +1439,6 @@ bool Parser::canParseType() {
14431439
if (!consumeIf(tok::r_square))
14441440
return false;
14451441
break;
1446-
case tok::kw__:
1447-
consumeToken();
1448-
break;
14491442

14501443

14511444
default:

lib/Sema/PreCheckExpr.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,12 +1476,8 @@ TypeExpr *PreCheckExpression::simplifyTypeExpr(Expr *E) {
14761476
return simplifyNestedTypeExpr(UDE);
14771477
}
14781478

1479-
// Fold '_' into a placeholder type.
1480-
if (auto *DAE = dyn_cast<DiscardAssignmentExpr>(E)) {
1481-
auto *placeholderRepr =
1482-
new (getASTContext()) PlaceholderTypeRepr(DAE->getLoc());
1483-
return new (getASTContext()) TypeExpr(placeholderRepr);
1484-
}
1479+
// TODO: Fold DiscardAssignmentExpr into a placeholder type here once parsing
1480+
// them is supported.
14851481

14861482
// Fold T? into an optional type when T is a TypeExpr.
14871483
if (isa<OptionalEvaluationExpr>(E) || isa<BindOptionalExpr>(E)) {
@@ -1688,8 +1684,6 @@ TypeExpr *PreCheckExpression::simplifyTypeExpr(Expr *E) {
16881684
return nullptr;
16891685
if (auto *TyE = dyn_cast<TypeExpr>(E))
16901686
return TyE->getTypeRepr();
1691-
if (auto *DAE = dyn_cast<DiscardAssignmentExpr>(E))
1692-
return new (getASTContext()) PlaceholderTypeRepr(DAE->getLoc());
16931687
if (auto *TE = dyn_cast<TupleExpr>(E))
16941688
if (TE->getNumElements() == 0)
16951689
return TupleTypeRepr::createEmpty(ctx, TE->getSourceRange());

lib/Sema/TypeCheckType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,8 @@ static Type applyGenericArguments(Type type, TypeResolution resolution,
711711
if (!options.is(TypeResolverContext::TypeAliasDecl)) {
712712
// If the resolution object carries an opener, attempt to open
713713
// the unbound generic type.
714+
// TODO: We should be able to just open the generic arguments as N
715+
// different PlaceholderTypes.
714716
if (const auto openerFn = resolution.getUnboundTypeOpener())
715717
if (const auto boundTy = openerFn(unboundTy))
716718
return boundTy;

0 commit comments

Comments
 (0)