Open
Description
Description
The program below fails to compile, with the compiler complaining that the property-wrapper-backed property is missing an explicity type annotation.
Reproduction
@propertyWrapper
struct Query<T> {
init(_ type: T.Type = T.self, limit: Int?) {}
var wrappedValue: [T] { [] }
}
struct Item {}
struct S {
@Query<Item> var items // error: type annotation missing in pattern
}
Expected behavior
IMO, this should compile, since there is no ambiguity w.r.t. the resulting wrappedValue
type.
this would be different if the property were defined as @Query var items
instead of @Query<Item> var items
, since in that case the init call would be required to provide the type for T
.
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Additional information
No response