Skip to content

Commit 0868889

Browse files
committed
Add new source file Macros.swift
1 parent 7000969 commit 0868889

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

stdlib/public/core/Macros.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
/// Specifies the module and type name for an externally-defined macro, which
14+
/// must conform to the appropriate set of `Macro` protocols.
15+
///
16+
/// This macro can only be used to define other macros. For example:
17+
///
18+
/// macro stringify<T>(_ value: T) -> (T, String) =
19+
/// #externalMacro(module: "ExampleMacros", type :"StringifyMacro")
20+
///
21+
/// Use of this macro in any other context is an error.
22+
@expression
23+
public macro externalMacro<T>(module: String, type: String) -> T =
24+
Builtin.ExternalMacro
25+

0 commit comments

Comments
 (0)