I tried this:
extension USART3 {
@Register(bitWidth: 32)
public struct CR1 {
/// USART enable
@ReadWrite(bits: 0 ..< 1)
public var ue: UE
}
/// more stuff
}
it works. But
public extension USART3 {
@Register(bitWidth: 32)
struct CR1 {
/// USART enable
@ReadWrite(bits: 0 ..< 1)
public var ue: UE
}
/// more stuff
}
causes an error:
error: property cannot be declared public because its type uses an internal type
55 | public extension USART3 {
56 |
57 | @Register(bitWidth: 32)
| `- note: in expansion of macro 'Register' on struct 'CR1' here
58 | struct CR1 {
59 | /// USART enable
60 | @ReadWrite(bits: 0 ..< 1)
61 | public var ue: UE
| `- error: property cannot be declared public because its type uses an internal type
62 |
63 | /// Receiver enable
:
96 | @ReadWrite(bits: 10 ..< 11)
97 | public var pce: PCE
98 | }
+--- macro expansion @Register -------------------------------------
| 5 | private var _never: Never
| 6 |
| 7 | enum UE: ContiguousBitField {
| | `- note: type declared here
| 8 | typealias Storage = UInt32
| 9 | typealias Projection = Never
+-------------------------------------------------------------------
Is it a bug or I don't know something?
And this works:
/// Parity error
@ReadOnly(bits: 0 ..< 1)
public var pe: PE
but this does not:
@ReadOnly(bits: 0 ..< 1) // Parity error
public var pe: PE
Funny.