- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathmacro_self.swift
27 lines (20 loc) · 684 Bytes
/
macro_self.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: %target-swift-frontend -parse %s -verify
@freestanding(expression) // expected-error {{expected expression}}
macro self()= #externalMacro(module:"MacroDefinition", type:"InvalidMacro")
func sync(){}
@freestanding(expression) // expected-error {{expected expression}}
macro Self()= #externalMacro(module:"MacroDefinition", type:"InvalidMacro")
func testSelfAsFreestandingMacro(){
_ = #self
}
func testCapitalSelfAsFreestandingMacro(){
_ = #Self
}
func testSelfAsAttachedMacro(){
@self // expected-error {{expected expression}}
structFoo{}
}
func testCapitalSelfAsAttachedMacro(){
@Self // expected-error {{expected expression}}
structFoo{}
}