// RUN: %target-typecheck-verify-swift // https://github.com/apple/swift/issues/54962 @propertyWrapper @dynamicMemberLookup struct Binding { var wrappedValue: Value subscript(dynamicMember keyPath: WritableKeyPath) -> Binding { get { fatalError() } } } @propertyWrapper struct Wrapper { var wrappedValue: Value var projectedValue: Binding } @dynamicMemberLookup class Foo { struct State { let value: Bool } let currentState: State = State(value: false) subscript(dynamicMember keyPath: KeyPath) -> U { return currentState[keyPath: keyPath] } } struct Test { @Wrapper var foo: Foo func test() { if foo.bar { // expected-error {{value of type 'Foo' has no dynamic member 'bar' using key path from root type 'Foo.State'}} } } }