[Sema] Use ExistentialType for Any and AnyObject.#41909
[Sema] Use ExistentialType for Any and AnyObject.#41909hborla merged 5 commits intoswiftlang:mainfrom
ExistentialType for Any and AnyObject.#41909Conversation
|
@swift-ci please test source compatibility |
|
@swift-ci please test |
include/swift/AST/Types.h
Outdated
There was a problem hiding this comment.
Can you turn this into a bitfield on TypeBase?
lib/AST/ASTContext.cpp
Outdated
There was a problem hiding this comment.
This should already be canonical, you can do return CanType(ExistentialType::get(TheAnyType)) instead (it will assert if its not canonical)
lib/AST/ASTContext.cpp
Outdated
There was a problem hiding this comment.
Should this similarly be split up into constraint/existential versions, or do we not need the former anywhere?
lib/AST/ASTContext.cpp
Outdated
There was a problem hiding this comment.
ExistentialMetatypeType is probably retiring soon, but I wonder if this is better off as an assertion.
94910df to
c211ae5
Compare
c211ae5 to
1bced5a
Compare
|
@swift-ci please smoke test |
1 similar comment
|
@swift-ci please smoke test |
|
@swift-ci please test source compatibility |
…importing dependent member types.
d1de655 to
27ae04e
Compare
|
@swift-ci please smoke test |
composition types.
|
@swift-ci please smoke test |
This change models existential
AnyandAnyObjectusingExistentialType. Previously, these two existential types still were modeled withProtocolCompositionTypebecause they're not required to be written withany, but this allowed usinganyon these types in conformance constraint context, e.g.This also forced all code that operates on existential types to handle both
ExistentialTypeandProtocolCompositionType. This change enables cleaning up all of that code, getting rid ofTypeBase::isExistentialTypein favor ofTypeBase::is<ExistentialType>, addingASTVerifierchecks to ensure that no expressions have a protocol composition type to catch more bugs, etcNote that
AnyandAnyObjectstill do not print withanyin the ASTPrinter, except when it's needed to distinguish between the existential metatype and the singleton metatype, e.g.any Any.Typevs(any Any).Type.