mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
22 lines
558 B
Swift
22 lines
558 B
Swift
// RUN: %target-swift-frontend %s -typecheck -verify
|
|
|
|
@propertyWrapper
|
|
struct Wrapper1 {
|
|
var wrappedValue: Int?
|
|
}
|
|
|
|
class Test1 {
|
|
@Wrapper1 var user: Int
|
|
// expected-error@-1 {{property type 'Int' does not match 'wrappedValue' type 'Int?'}}
|
|
}
|
|
|
|
@propertyWrapper
|
|
struct Wrapper2 { // expected-note {{property wrapper type 'Wrapper2' declared here}}
|
|
var wrappedValue: Int??
|
|
}
|
|
|
|
class Test2 {
|
|
@Wrapper2 var user: Int?
|
|
// expected-error@-1 {{property type 'Int?' does not match that of the 'wrappedValue' property of its wrapper type 'Wrapper2'}}
|
|
}
|