forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelayed_parsing.swift
20 lines (16 loc) · 869 Bytes
/
delayed_parsing.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// REQUIRES: swift_swift_parser
//
// RUN: %empty-directory(%t)
// RUN: %host-build-swift -swift-version 5 -parse-as-library -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath
// Type check testing
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/delayed_parsing.swiftmodule -experimental-skip-non-inlinable-function-bodies-without-types -swift-version 5 -parse-as-library -load-plugin-library %t/%target-library-name(MacroDefinition) %s
@freestanding(declaration)
macro freestandingWithClosure<T>(_ value:T, body:(T)->T)= #externalMacro(module:"MacroDefinition", type:"EmptyDeclarationMacro")
#freestandingWithClosure(0){(x:Int)in
structLocalStruct{
func opaqueReturn()->someAny{
return3
}
}
return x
}