mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: Correctly set and honor the "is reflectable" bit on structs and classes.
If we only emit an opaque reflection record for a struct or class, then we can't reflect its fields. We failed both to clear the "is reflectable" bit in the context descriptor for non-reflectable structs, and to check for the bit before trying to present a struct's fields as children in the runtime. rdar://problem/41274260
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
import Swift
|
||||
import Foundation
|
||||
import simd
|
||||
|
||||
#if os(macOS)
|
||||
import AppKit
|
||||
@@ -284,6 +285,11 @@ testQLO(HasStringQLO.self)
|
||||
// CHECK-NEXT: HasStringQLO overboard
|
||||
// CHECK-NEXT: CanaryBase overboard
|
||||
|
||||
// simd types get no reflection info, so should have no mirror children
|
||||
let x = float4(0)
|
||||
print("float4 has \(Mirror(reflecting: x).children.count) children")
|
||||
// CHECK-NEXT: float4 has 0 children
|
||||
|
||||
// CHECK-LABEL: and now our song is done
|
||||
print("and now our song is done")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user