Skip to content

Commit

Permalink
AST: Introduce Builtin.AnyObject
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
slavapestov committed Apr 14, 2017
1 parent 0af7f01 commit 5993b63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/AST/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ Type swift::getBuiltinType(ASTContext &Context, StringRef Name) {
if (Name == "FPPPC128")
return Context.ThePPC128Type;

// AnyObject is the empty class-constrained existential.
if (Name == "AnyObject")
return CanType(
ProtocolCompositionType::get(Context, {},
/*hasExplicitAnyObject=*/true));

return Type();
}

Expand Down

0 comments on commit 5993b63

Please sign in to comment.