mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Raw identifiers are backtick-delimited identifiers that can contain any non-identifier character other than the backtick itself, CR, LF, or other non-printable ASCII code units, and which are also not composed entirely of operator characters.
60 lines
1.0 KiB
Swift
60 lines
1.0 KiB
Swift
// RUN: rm -f %t.*
|
|
// RUN: %target-swift-frontend -emit-sil %s -o %t.sil
|
|
// RUN: %FileCheck --input-file=%t.sil %s
|
|
// RUN: %target-swift-frontend -Xllvm -parse-serialized-sil -emit-silgen %t.sil -module-name=printer_include_decl | %FileCheck %s
|
|
|
|
var x: Int
|
|
// CHECK: var x: Int
|
|
|
|
class Foo {
|
|
// FIXME: The constructors and destructors without bodies cannot be parsed.
|
|
init(i: Int) {
|
|
self.x = i
|
|
}
|
|
// CHECK: init(i: Int)
|
|
|
|
deinit { m() }
|
|
// CHECK: deinit
|
|
|
|
subscript(x: Int, y: Int) -> Int {
|
|
get {
|
|
return 0
|
|
}
|
|
set {}
|
|
}
|
|
// CHECK: subscript(x: Int, y: Int) -> Int
|
|
|
|
final var x : Int
|
|
// CHECK: var x: Int
|
|
|
|
final var y : Int {
|
|
get {
|
|
return 5
|
|
}
|
|
}
|
|
// CHECK: var y: Int
|
|
|
|
func m() {}
|
|
// CHECK: func m()
|
|
|
|
enum E {}
|
|
// CHECK: enum E
|
|
}
|
|
|
|
func bar(x: Foo) -> Int {
|
|
return x.x
|
|
}
|
|
// CHECK: func bar(x: Foo) -> Int
|
|
|
|
extension Foo.E {
|
|
// CHECK: extension Foo.E {
|
|
func e(x: Foo.E) {}
|
|
// CHECK: func e(x: Foo.E)
|
|
}
|
|
|
|
func `foo space`() { }
|
|
// CHECK: func `foo space`()
|
|
|
|
var `x space`: Int
|
|
// CHECK: var `x space`: Int
|