@@ -28,8 +28,14 @@ func bar(x: Int) -> String { return "test" }
2828@section ( " mysection " ) let funcRef1 = foo // ok
2929@section ( " mysection " ) let funcRef2 = bar // ok
3030
31- // metatypes - TODO
32- //@section("mysection") let metatype1 = Int.self
31+ struct S : Hashable , Sendable { }
32+
33+ // metatypes
34+ @section ( " mysection " ) let metatype1 = Int . self
35+ @section ( " mysection " ) let metatype2 : Any . Type = Int . self
36+ @section ( " mysection " ) let metatype3 : Any . Type = S . self
37+ @section ( " mysection " ) let metatype4 : any ( Hashable & Sendable ) . Type = Int . self
38+ @section ( " mysection " ) let metatype5 : any ( Hashable & Sendable ) . Type = S . self
3339
3440// tuples
3541@section ( " mysection " ) let tuple1 = ( 1 , 2 , 3 , 2.718 , true ) // ok
@@ -56,6 +62,12 @@ func bar(x: Int) -> String { return "test" }
5662// CHECK: @"$s9SectionIR12boolLiteral2Sbvp" = {{.*}}constant %TSb zeroinitializer, section "mysection"
5763// CHECK: @"$s9SectionIR8funcRef1Siycvp" = {{.*}}constant %swift.function { ptr @"$s9SectionIR3fooSiyF", ptr null }, section "mysection"
5864// CHECK: @"$s9SectionIR8funcRef2ySSSicvp" = {{.*}}constant %swift.function { ptr @"$s9SectionIR3bar1xSSSi_tF", ptr null }, section "mysection"
65+
66+ // CHECK: @"$s9SectionIR9metatype2ypXpvp" = {{.*}}constant ptr @"$sSiN", section "mysection"
67+ // CHECK: @"$s9SectionIR9metatype3ypXpvp" = {{.*}}constant ptr getelementptr inbounds (<{ ptr, ptr, i64, ptr }>, ptr @"$s9SectionIR1SVMf", i32 0, i32 2), section "mysection"
68+ // CHECK: @"$s9SectionIR9metatype4SH_s8SendablepXpvp" = {{.*}}constant <{ ptr, ptr }> <{ ptr @"$sSiN", ptr @"$sSiSHsWP" }>, section "mysection"
69+ // CHECK: @"$s9SectionIR9metatype5SH_s8SendablepXpvp" = {{.*}}constant <{ ptr, ptr }> <{ ptr getelementptr inbounds (<{ ptr, ptr, i64, ptr }>, ptr @"$s9SectionIR1SVMf", i32 0, i32 2), ptr @"$s9SectionIR1SVSHAAWP" }>, section "mysection"
70+
5971// CHECK: @"$s9SectionIR6tuple1Si_S2iSdSbtvp" = {{.*}}constant <{ %TSi, %TSi, %TSi, %TSd, %TSb }> <{ %TSi <{ i64 1 }>, %TSi <{ i64 2 }>, %TSi <{ i64 3 }>, %TSd <{ double 2.718000e+00 }>, %TSb <{ i1 true }> }>, section "mysection"
6072// CHECK: @"$s9SectionIR6tuple2Si_SfSbtvp" = {{.*}}constant <{ %TSi, %TSf, %TSb }> <{ %TSi <{ i64 42 }>, %TSf <{ float 0x40091EB860000000 }>, %TSb zeroinitializer }>, section "mysection"
6173// CHECK: @"$s9SectionIR6tuple3Siyc_SSSictvp" = {{.*}}constant <{ %swift.function, %swift.function }> <{ %swift.function { ptr @"$s9SectionIR3fooSiyF", ptr null }, %swift.function { ptr @"$s9SectionIR3bar1xSSSi_tF", ptr null } }>, section "mysection"
0 commit comments