[embedded] Allow metadata for DynamicSelfType to support using Self in classes

This commit is contained in:
Kuba Mracek
2023-10-18 19:52:50 -07:00
parent e9b01a35d8
commit 0663246daf
2 changed files with 24 additions and 1 deletions

View File

@@ -90,7 +90,8 @@ inline bool isEmbedded(CanType t) {
}
inline bool isMetadataAllowedInEmbedded(CanType t) {
return isa<ClassType>(t) || isa<BoundGenericClassType>(t);
return isa<ClassType>(t) || isa<BoundGenericClassType>(t) ||
isa<DynamicSelfType>(t);
}
inline bool isEmbedded(Decl *d) {

View File

@@ -0,0 +1,22 @@
// RUN: %target-swift-emit-ir %s -enable-experimental-feature Embedded -parse-as-library | %FileCheck %s
// REQUIRES: swift_in_compiler
// REQUIRES: VENDOR=apple
// REQUIRES: OS=macosx
class MyClass {
init() {
Self.static_foo()
}
static func static_foo() {}
}
@main
struct Main {
static func main() {
_ = MyClass()
}
}
// CHECK: define {{.*}}@main(