Skip to content

Commit 5993b63

Browse files
committed
AST: Introduce Builtin.AnyObject
Soon, Swift.AnyObject will become a protocol composition type with no protocols and a class constraint. Since there's no way to write this in the language, cons up an AnyObject type in the Builtin module, so that the standard library can define 'typealias AnyObject = Builtin.AnyObject'.
1 parent 0af7f01 commit 5993b63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/AST/Builtins.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ Type swift::getBuiltinType(ASTContext &Context, StringRef Name) {
109109
if (Name == "FPPPC128")
110110
return Context.ThePPC128Type;
111111

112+
// AnyObject is the empty class-constrained existential.
113+
if (Name == "AnyObject")
114+
return CanType(
115+
ProtocolCompositionType::get(Context, {},
116+
/*hasExplicitAnyObject=*/true));
117+
112118
return Type();
113119
}
114120

0 commit comments

Comments
 (0)