Skip to content

Commit 04684b0

Browse files
committed
Revert "[AST] Allocate PlaceholderTypes in the correct arena"
This reverts commit 97be042.
1 parent f30202e commit 04684b0

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ struct ASTContext::Implementation {
431431
llvm::DenseMap<Type, InOutType*> InOutTypes;
432432
llvm::DenseMap<std::pair<Type, void*>, DependentMemberType *>
433433
DependentMemberTypes;
434-
llvm::DenseMap<void *, PlaceholderType *> PlaceholderTypes;
435434
llvm::DenseMap<Type, DynamicSelfType *> DynamicSelfTypes;
436435
llvm::DenseMap<std::pair<EnumDecl*, Type>, EnumType*> EnumTypes;
437436
llvm::DenseMap<std::pair<StructDecl*, Type>, StructType*> StructTypes;
@@ -3126,27 +3125,8 @@ Type ErrorType::get(Type originalType) {
31263125

31273126
Type PlaceholderType::get(ASTContext &ctx, Originator originator) {
31283127
assert(originator);
3129-
3130-
auto hasTypeVariables = [&]() -> bool {
3131-
if (originator.is<TypeVariableType *>())
3132-
return true;
3133-
3134-
if (auto *depTy = originator.dyn_cast<DependentMemberType *>())
3135-
return depTy->hasTypeVariable();
3136-
3137-
return false;
3138-
}();
3139-
auto arena = hasTypeVariables ? AllocationArena::ConstraintSolver
3140-
: AllocationArena::Permanent;
3141-
3142-
auto &cache = ctx.getImpl().getArena(arena).PlaceholderTypes;
3143-
auto &entry = cache[originator.getOpaqueValue()];
3144-
if (entry)
3145-
return entry;
3146-
3147-
entry = new (ctx, arena)
3128+
return new (ctx, AllocationArena::Permanent)
31483129
PlaceholderType(ctx, originator, RecursiveTypeProperties::HasPlaceholder);
3149-
return entry;
31503130
}
31513131

31523132
BuiltinIntegerType *BuiltinIntegerType::get(BuiltinIntegerWidth BitWidth,

test/Constraints/rdar44770297.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,4 @@ func foo<T: P>(_: () throws -> T) -> T.A? { // expected-note {{where 'T' = 'Neve
88
fatalError()
99
}
1010

11-
let _ = foo() {fatalError()} & nil
12-
// expected-error@-1 {{global function 'foo' requires that 'Never' conform to 'P'}}
13-
// expected-error@-2 {{value of optional type 'Never.A?' must be unwrapped to a value of type 'Never.A'}}
14-
// expected-note@-3 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
15-
// expected-note@-4 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
11+
let _ = foo() {fatalError()} & nil // expected-error {{global function 'foo' requires that 'Never' conform to 'P'}}

0 commit comments

Comments
 (0)