- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathmagic_literal_expansion.swift
28 lines (19 loc) · 1.07 KB
/
magic_literal_expansion.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
28
// REQUIRES: swift_swift_parser, executable_test
// RUN: %empty-directory(%t)
// RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath
// RUN: %target-build-swift -swift-version 5 -load-plugin-library %t/%target-library-name(MacroDefinition) %s -o %t/main -module-name MacroUser -swift-version 5 -emit-tbd -emit-tbd-path %t/MacroUser.tbd -I %t
// RUN: %target-codesign %t/main
// RUN: %target-run %t/main | %FileCheck %s
@freestanding(expression)
macro MagicFile()->String= #externalMacro(module:"MacroDefinition", type:"MagicFileMacro")
@freestanding(expression)
macro MagicLine()->Int= #externalMacro(module:"MacroDefinition", type:"MagicLineMacro")
// CHECK: magic_literal_expansion.swift
print(#MagicFile)
// CHECK: 21
print(#MagicLine)
@freestanding(expression)
macro Nested()->Void= #externalMacro(module:"MacroDefinition", type:"NestedMagicLiteralMacro")
// CHECK: magic_literal_expansion.swift
// CHECK: 28
#Nested