Files
carbon-lang/toolchain/check/core_identifier.def
T
Richard Smith c297344937 Support conversion between integer types. (#6856)
Add an `IntFitsIn` interface with a custom witness, such that `T impls
IntFitsIn(U)` if `T` is an integer type all of whose values fit
losslessly into the integer type `U`. Use it to constrain implicit
conversions between integer types.

So far, this has not been extended to the
`CppCompat.[U]{Long32,LongLong64}` types, only to `Core.Int(N)` and
`Core.UInt(N)`.

Assisted-by: Gemini 3 Pro via Antigravity
2026-03-10 01:40:16 +00:00

83 lines
2.8 KiB
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This is an X-macro header. It does not use `#include` guards, and instead is
// designed to be `#include`ed after the x-macro is defined in order for its
// inclusion to expand to the desired output. Macro definitions are cleaned up
// at the end of this file.
//
// This macro should be defined before including this header:
// - CARBON_CORE_IDENTIFIER(Name)
// Invoked for each `Core` identifier.
#ifndef CARBON_CORE_IDENTIFIER
#error "Must define the x-macro to use this file."
#define CARBON_CORE_IDENTIFIER(Name)
#endif
CARBON_CORE_IDENTIFIER(AddAssignWith)
CARBON_CORE_IDENTIFIER(AddWith)
CARBON_CORE_IDENTIFIER(As)
CARBON_CORE_IDENTIFIER(AssignWith)
CARBON_CORE_IDENTIFIER(At)
CARBON_CORE_IDENTIFIER(BitAndAssignWith)
CARBON_CORE_IDENTIFIER(BitAndWith)
CARBON_CORE_IDENTIFIER(BitComplement)
CARBON_CORE_IDENTIFIER(BitOrAssignWith)
CARBON_CORE_IDENTIFIER(BitOrWith)
CARBON_CORE_IDENTIFIER(BitXorAssignWith)
CARBON_CORE_IDENTIFIER(BitXorWith)
CARBON_CORE_IDENTIFIER(Bool)
CARBON_CORE_IDENTIFIER(Char)
CARBON_CORE_IDENTIFIER(Convert)
CARBON_CORE_IDENTIFIER(Copy)
CARBON_CORE_IDENTIFIER(CppCompat)
CARBON_CORE_IDENTIFIER(Dec)
CARBON_CORE_IDENTIFIER(Destroy)
CARBON_CORE_IDENTIFIER(DivAssignWith)
CARBON_CORE_IDENTIFIER(DivWith)
CARBON_CORE_IDENTIFIER(EqWith)
CARBON_CORE_IDENTIFIER(Equal)
CARBON_CORE_IDENTIFIER(Float)
CARBON_CORE_IDENTIFIER(Get)
CARBON_CORE_IDENTIFIER(Greater)
CARBON_CORE_IDENTIFIER(GreaterOrEquivalent)
CARBON_CORE_IDENTIFIER(HasValue)
CARBON_CORE_IDENTIFIER(ImplicitAs)
CARBON_CORE_IDENTIFIER(Inc)
CARBON_CORE_IDENTIFIER(IndexWith)
CARBON_CORE_IDENTIFIER(Int)
CARBON_CORE_IDENTIFIER(IntFitsIn)
CARBON_CORE_IDENTIFIER(Iterate)
CARBON_CORE_IDENTIFIER(LeftShiftAssignWith)
CARBON_CORE_IDENTIFIER(LeftShiftWith)
CARBON_CORE_IDENTIFIER(Less)
CARBON_CORE_IDENTIFIER(LessOrEquivalent)
CARBON_CORE_IDENTIFIER(Long32)
CARBON_CORE_IDENTIFIER(LongLong64)
CARBON_CORE_IDENTIFIER(ModAssignWith)
CARBON_CORE_IDENTIFIER(ModWith)
CARBON_CORE_IDENTIFIER(MulAssignWith)
CARBON_CORE_IDENTIFIER(MulWith)
CARBON_CORE_IDENTIFIER(Negate)
CARBON_CORE_IDENTIFIER(NewCursor)
CARBON_CORE_IDENTIFIER(Next)
CARBON_CORE_IDENTIFIER(NotEqual)
CARBON_CORE_IDENTIFIER(NullptrT)
CARBON_CORE_IDENTIFIER(Op)
CARBON_CORE_IDENTIFIER(Optional)
CARBON_CORE_IDENTIFIER(OrderedWith)
CARBON_CORE_IDENTIFIER(RightShiftAssignWith)
CARBON_CORE_IDENTIFIER(RightShiftWith)
CARBON_CORE_IDENTIFIER(String)
CARBON_CORE_IDENTIFIER(SubAssignWith)
CARBON_CORE_IDENTIFIER(SubWith)
CARBON_CORE_IDENTIFIER(UInt)
CARBON_CORE_IDENTIFIER(ULong32)
CARBON_CORE_IDENTIFIER(ULongLong64)
CARBON_CORE_IDENTIFIER(UnsafeAs)
CARBON_CORE_IDENTIFIER(VoidBase)
#undef CARBON_CORE_IDENTIFIER