Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0210-rdar57356196.swift
Pavel Yaskevich ae79b0d0bd [CSApply] Always use String type for ObjC interop key path
If it's possible to build an Objective-C key path for key path
expression make sure that its implicitly generated string literal
expression has a `String` type.

Resolves: rdar://problem/57356196
2020-02-15 00:04:09 -08:00

22 lines
373 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -typecheck -verify
// REQUIRES: objc_interop
import Foundation
@objc class A : NSObject {
@objc var x: Int = 42
}
@propertyWrapper
struct Attr<V> {
var wrappedValue: V {
get { fatalError() }
}
init(wrappedValue: V, key: KeyPath<A, V>) {}
}
class B {
@Attr(key: \.x) var y: Int = 0 // Ok
}