mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We'll need types to be convertible from multiple kinds of inouts, which currently can't be represented with protocol conformance since we only allow one protocol conformance per type per protocol. Instead just look for a magic "__inout_conversion" static method in the type; this is lame but easy, and inout conversions shouldn't be available outside of the stdlib anyway. Swift SVN r15599
67 lines
2.3 KiB
C++
67 lines
2.3 KiB
C++
//===-- KnownProtocols.def - Compiler protocol metaprogramming --*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines macros used for macro-metaprogramming with compiler-known
|
|
// protocols.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
/// \def PROTOCOL(Id)
|
|
///
|
|
/// The enumerator value is \c KnownProtocolKind::Id. The protocol represented
|
|
/// is simply named \p Id.
|
|
#ifndef PROTOCOL
|
|
#define PROTOCOL(Id)
|
|
#endif
|
|
|
|
/// \def LITERAL_CONVERTIBLE_PROTOCOL(Id)
|
|
#ifndef LITERAL_CONVERTIBLE_PROTOCOL
|
|
#define LITERAL_CONVERTIBLE_PROTOCOL(Id) PROTOCOL(Id)
|
|
#endif
|
|
|
|
/// \def BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(Id)
|
|
///
|
|
/// Note that this is not a special form of LITERAL_CONVERTIBLE_PROTOCOL.
|
|
#ifndef BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL
|
|
#define BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(Id) PROTOCOL(Id)
|
|
#endif
|
|
|
|
PROTOCOL(ArrayBound)
|
|
PROTOCOL(Sequence)
|
|
PROTOCOL(Generator)
|
|
PROTOCOL(LogicValue)
|
|
PROTOCOL(AnyObject)
|
|
PROTOCOL(RawRepresentable)
|
|
PROTOCOL(RawOptionSet)
|
|
PROTOCOL(Equatable)
|
|
PROTOCOL(Hashable)
|
|
PROTOCOL(Comparable)
|
|
|
|
LITERAL_CONVERTIBLE_PROTOCOL(ArrayLiteralConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(CharacterLiteralConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(DictionaryLiteralConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(FloatLiteralConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(IntegerLiteralConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(StringInterpolationConvertible)
|
|
LITERAL_CONVERTIBLE_PROTOCOL(StringLiteralConvertible)
|
|
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(BuiltinCharacterLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(BuiltinFloatLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(BuiltinIntegerLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(BuiltinStringLiteralConvertible)
|
|
BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL(BuiltinUTF16StringLiteralConvertible)
|
|
|
|
#undef LITERAL_CONVERTIBLE_PROTOCOL
|
|
#undef BUILTIN_LITERAL_CONVERTIBLE_PROTOCOL
|
|
#undef PROTOCOL
|