mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
16 lines
443 B
Swift
16 lines
443 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
struct Article {
|
|
let id: String
|
|
}
|
|
|
|
let keypath = \Article.id
|
|
func keypath_generator() -> KeyPath<Article, String> { return \.id }
|
|
func const_map(_const _ map: KeyPath<Article, String>) {}
|
|
|
|
const_map(\.id)
|
|
const_map(\Article.id)
|
|
|
|
const_map(keypath_generator()) // expected-error {{expect a compile-time constant literal}}
|
|
const_map(keypath) // expected-error {{expect a compile-time constant literal}}
|