Files
swift-mirror/test/Parse/escaped_identifiers.swift
Robin Kunde ab415e6b3e [Parse] Improve parser diagnostics for keyword-as-identifer errors (#6045)
Instead of the simple "expected identifier in declaration", the error will now read "keyword '%' cannot be used as an identifier here", and will be accompanied by a note suggesting escaping the keyword with backticks, as well as a fixit.

https://bugs.swift.org/browse/SR-3167
2016-12-13 16:12:53 -08:00

26 lines
322 B
Swift

// RUN: %target-typecheck-verify-swift
func `protocol`() {}
`protocol`()
class `Type` {}
var `class` = `Type`.self
func foo() {}
`foo`()
// Escaping suppresses identifier contextualization.
var get: (() -> ()) -> () = { $0() }
var applyGet: Int {
`get` { }
return 0
}
enum `switch` {}
typealias `Self` = Int