diff --git a/SwiftCompilerSources/Sources/AST/Type.swift b/SwiftCompilerSources/Sources/AST/Type.swift index 0da3540a7b0..c48280f7444 100644 --- a/SwiftCompilerSources/Sources/AST/Type.swift +++ b/SwiftCompilerSources/Sources/AST/Type.swift @@ -48,6 +48,8 @@ public struct Type: TypeProperties, CustomStringConvertible, NoReflectionChildre public var instanceTypeOfMetatype: Type { Type(bridged: bridged.getInstanceTypeOfMetatype()) } + public var staticTypeOfDynamicSelf: Type { Type(bridged: bridged.getStaticTypeOfDynamicSelf()) } + public var superClassType: Type? { precondition(isClass) let bridgedSuperClassTy = bridged.getSuperClassType() @@ -136,10 +138,12 @@ extension TypeProperties { public var isTuple: Bool { rawType.bridged.isTuple() } public var isFunction: Bool { rawType.bridged.isFunction() } + public var isArchetype: Bool { rawType.bridged.isArchetype() } public var isExistentialArchetype: Bool { rawType.bridged.isExistentialArchetype() } public var isExistentialArchetypeWithError: Bool { rawType.bridged.isExistentialArchetypeWithError() } public var isExistential: Bool { rawType.bridged.isExistential() } public var isClassExistential: Bool { rawType.bridged.isClassExistential() } + public var isGenericTypeParameter: Bool { rawType.bridged.isGenericTypeParam() } public var isUnownedStorageType: Bool { return rawType.bridged.isUnownedStorageType() } public var isMetatype: Bool { rawType.bridged.isMetatypeType() } public var isExistentialMetatype: Bool { rawType.bridged.isExistentialMetatypeType() } @@ -187,6 +191,7 @@ extension TypeProperties { public var isEscapable: Bool { rawType.bridged.isEscapable() } public var isNoEscape: Bool { rawType.bridged.isNoEscape() } public var isBuiltinType: Bool { rawType.bridged.isBuiltinType() } + public var archetypeRequiresClass: Bool { rawType.bridged.archetypeRequiresClass() } public var representationOfMetatype: AST.`Type`.MetatypeRepresentation { rawType.bridged.getRepresentationOfMetatype().representation diff --git a/include/swift/AST/ASTBridging.h b/include/swift/AST/ASTBridging.h index 03ff13ae7fa..01d83ff1c6e 100644 --- a/include/swift/AST/ASTBridging.h +++ b/include/swift/AST/ASTBridging.h @@ -3100,11 +3100,14 @@ struct BridgedASTType { BRIDGED_INLINE bool isGenericAtAnyLevel() const; BRIDGED_INLINE bool hasTypeParameter() const; BRIDGED_INLINE bool hasLocalArchetype() const; + BRIDGED_INLINE bool isArchetype() const; + BRIDGED_INLINE bool archetypeRequiresClass() const; BRIDGED_INLINE bool isExistentialArchetype() const; BRIDGED_INLINE bool isExistentialArchetypeWithError() const; BRIDGED_INLINE bool isExistential() const; BRIDGED_INLINE bool isDynamicSelf() const; BRIDGED_INLINE bool isClassExistential() const; + BRIDGED_INLINE bool isGenericTypeParam() const; BRIDGED_INLINE bool isEscapable() const; BRIDGED_INLINE bool isNoEscape() const; BRIDGED_INLINE bool isInteger() const; @@ -3129,6 +3132,7 @@ struct BridgedASTType { BRIDGED_INLINE TraitResult canBeClass() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedDeclObj getAnyNominal() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getInstanceTypeOfMetatype() const; + SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getStaticTypeOfDynamicSelf() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getSuperClassType() const; BRIDGED_INLINE MetatypeRepresentation getRepresentationOfMetatype() const; SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getContextSubstitutionMap() const; diff --git a/include/swift/AST/ASTBridgingImpl.h b/include/swift/AST/ASTBridgingImpl.h index 459ef7bd64a..7bafd04bc1d 100644 --- a/include/swift/AST/ASTBridgingImpl.h +++ b/include/swift/AST/ASTBridgingImpl.h @@ -423,6 +423,14 @@ bool BridgedASTType::hasLocalArchetype() const { return unbridged()->hasLocalArchetype(); } +bool BridgedASTType::isArchetype() const { + return unbridged()->is(); +} + +bool BridgedASTType::archetypeRequiresClass() const { + return unbridged()->castTo()->requiresClass(); +} + bool BridgedASTType::isExistentialArchetype() const { return unbridged()->is(); } @@ -443,6 +451,10 @@ bool BridgedASTType::isClassExistential() const { return unbridged()->isClassExistentialType(); } +bool BridgedASTType::isGenericTypeParam() const { + return unbridged()->is(); +} + bool BridgedASTType::isEscapable() const { return unbridged()->isEscapable(); } @@ -551,6 +563,10 @@ BridgedASTType BridgedASTType::getInstanceTypeOfMetatype() const { return {unbridged()->getAs()->getInstanceType().getPointer()}; } +BridgedASTType BridgedASTType::getStaticTypeOfDynamicSelf() const { + return {unbridged()->getAs()->getSelfType().getPointer()}; +} + BridgedASTType BridgedASTType::getSuperClassType() const { return {unbridged()->getSuperclass().getPointer()}; }