From bfb1a96aefec8fc4544729beeb5d56239d0dcabb Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 18 Dec 2024 23:09:10 +0000 Subject: [PATCH 01/13] Add support for IntLiteral operators. Also add support for mixed comparison between different integer types. --- toolchain/base/int.h | 11 +- toolchain/check/eval.cpp | 301 ++++++++++++++------- toolchain/diagnostics/diagnostic_kind.def | 1 + toolchain/lower/constant.cpp | 11 +- toolchain/lower/file_context.h | 6 + toolchain/lower/function_context.h | 5 + toolchain/lower/handle_call.cpp | 99 +++++-- toolchain/sem_ir/builtin_function_kind.cpp | 97 +++++-- toolchain/sem_ir/builtin_function_kind.h | 2 +- 9 files changed, 381 insertions(+), 152 deletions(-) diff --git a/toolchain/base/int.h b/toolchain/base/int.h index 712afb3fa75c8..918180fa467b4 100644 --- a/toolchain/base/int.h +++ b/toolchain/base/int.h @@ -232,6 +232,14 @@ constexpr int32_t IntId::InvalidIndex = Invalid.AsIndex(); // an array of `APInt` values and represented as an index in the ID. class IntStore { public: + // The maximum supported bit width of an integer type. + // TODO: Pick a maximum size and document it in the design. For now + // we use 2^^23, because that's the largest size that LLVM supports. + static constexpr int MaxIntWidth = 1 << 23; + + // Pick a canonical bit width for the provided number of significant bits. + static auto CanonicalBitWidth(int significant_bits) -> int; + // Accepts a signed `int64_t` and uses the mathematical signed integer value // of it as the added integer value. // @@ -395,9 +403,6 @@ class IntStore { return IntId::Invalid; } - // Pick a canonical bit width for the provided number of significant bits. - static auto CanonicalBitWidth(int significant_bits) -> int; - // Canonicalize an incoming signed APInt to the correct bit width. static auto CanonicalizeSigned(llvm::APInt value) -> llvm::APInt; diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 87c680b54e324..cc94cb3c9b33a 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -667,17 +667,14 @@ static auto ValidateIntType(Context& context, SemIRLoc loc, {.type = bit_width->type_id, .value = bit_width_val}); return false; } - // TODO: Pick a maximum size and document it in the design. For now - // we use 2^^23, because that's the largest size that LLVM supports. - constexpr int MaxIntWidth = 1 << 23; - if (bit_width_val.ugt(MaxIntWidth)) { + if (bit_width_val.ugt(IntStore::MaxIntWidth)) { CARBON_DIAGNOSTIC(IntWidthTooLarge, Error, "integer type width of {0} is greater than the " "maximum supported width of {1}", TypedInt, int); context.emitter().Emit(loc, IntWidthTooLarge, {.type = bit_width->type_id, .value = bit_width_val}, - MaxIntWidth); + IntStore::MaxIntWidth); return false; } return true; @@ -769,6 +766,15 @@ static auto DiagnoseDivisionByZero(Context& context, SemIRLoc loc) -> void { context.emitter().Emit(loc, CompileTimeDivisionByZero); } +// Get an integer at a suitable bit-width: either its actual width if it has a +// fixed width, or the canonical width from the value store if not. +static auto GetIntAtSuitableWidth(Context& context, IntId bit_width_id, + IntId int_id) -> llvm::APInt { + return bit_width_id.is_valid() + ? context.ints().GetAtWidth(int_id, bit_width_id) + : context.ints().Get(int_id); +} + // Performs a builtin unary integer -> integer operation. static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, SemIR::BuiltinFunctionKind builtin_kind, @@ -777,24 +783,34 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, auto op = context.insts().GetAs(arg_id); auto [is_signed, bit_width_id] = context.sem_ir().types().GetIntTypeInfo(op.type_id); - CARBON_CHECK(bit_width_id != IntId::Invalid, - "Cannot evaluate a generic bit width integer: {0}", op); - llvm::APInt op_val = context.ints().GetAtWidth(op.int_id, bit_width_id); + llvm::APInt op_val = GetIntAtSuitableWidth(context, bit_width_id, op.int_id); switch (builtin_kind) { case SemIR::BuiltinFunctionKind::IntSNegate: - if (is_signed && op_val.isMinSignedValue()) { - CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, - "integer overflow in negation of {0}", TypedInt); - context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, - {.type = op.type_id, .value = op_val}); + if (op_val.isMinSignedValue()) { + if (bit_width_id.is_valid()) { + CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, + "integer overflow in negation of {0}", TypedInt); + context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, + {.type = op.type_id, .value = op_val}); + } else { + // Widen the integer so we don't overflow into the sign bit. + op_val = op_val.sext(op_val.getBitWidth() + + llvm::APInt::APINT_BITS_PER_WORD); + } } op_val.negate(); break; case SemIR::BuiltinFunctionKind::IntUNegate: + CARBON_CHECK(bit_width_id.is_valid(), "Unsigned negate on unsized int"); op_val.negate(); break; case SemIR::BuiltinFunctionKind::IntComplement: + // TODO: Should we have separate builtins for signed and unsigned + // complement? Like with signed/unsigned negate, these operations do + // different things to the integer value, even though they do the same + // thing to the bits. We treat IntLiteral complement as signed complement, + // given that the result of unsigned complement depends on the bit width. op_val.flipAllBits(); break; default: @@ -804,80 +820,54 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, return MakeIntResult(context, op.type_id, is_signed, std::move(op_val)); } -// Performs a builtin binary integer -> integer operation. -static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, - SemIR::BuiltinFunctionKind builtin_kind, - SemIR::InstId lhs_id, - SemIR::InstId rhs_id) - -> SemIR::ConstantId { - auto lhs = context.insts().GetAs(lhs_id); - auto rhs = context.insts().GetAs(rhs_id); - - // Check for division by zero. - switch (builtin_kind) { - case SemIR::BuiltinFunctionKind::IntSDiv: - case SemIR::BuiltinFunctionKind::IntSMod: - case SemIR::BuiltinFunctionKind::IntUDiv: - case SemIR::BuiltinFunctionKind::IntUMod: - if (context.ints().Get(rhs.int_id).isZero()) { - DiagnoseDivisionByZero(context, loc); - return SemIR::ErrorInst::SingletonConstantId; - } - break; - default: - break; - } - - auto [lhs_is_signed, lhs_bit_width_id] = - context.sem_ir().types().GetIntTypeInfo(lhs.type_id); - llvm::APInt lhs_val = context.ints().GetAtWidth(lhs.int_id, lhs_bit_width_id); - - llvm::APInt result_val; - - // First handle shift, which can directly use the canonical RHS and doesn't - // overflow. - switch (builtin_kind) { - // Bit shift. - case SemIR::BuiltinFunctionKind::IntLeftShift: - case SemIR::BuiltinFunctionKind::IntRightShift: { - const auto& rhs_orig_val = context.ints().Get(rhs.int_id); - if (rhs_orig_val.uge(lhs_val.getBitWidth()) || - (rhs_orig_val.isNegative() && lhs_is_signed)) { - CARBON_DIAGNOSTIC( - CompileTimeShiftOutOfRange, Error, - "shift distance not in range [0, {0}) in {1} {2:<<|>>} {3}", - unsigned, TypedInt, BoolAsSelect, TypedInt); - context.emitter().Emit( - loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), - {.type = lhs.type_id, .value = lhs_val}, - builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, - {.type = rhs.type_id, .value = rhs_orig_val}); - // TODO: Is it useful to recover by returning 0 or -1? - return SemIR::ErrorInst::SingletonConstantId; - } +namespace { +// A pair of APInts that are the operands of a binary operator. We use an +// aggregate rather than `std::pair` to allow RVO of the individual ints. +struct APIntBinaryOperands { + llvm::APInt lhs; + llvm::APInt rhs; +}; +} - if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { - result_val = lhs_val.shl(rhs_orig_val); - } else if (lhs_is_signed) { - result_val = lhs_val.ashr(rhs_orig_val); +// Get a pair of integers at the same suitable bit-width: either their actual +// width if they have a fixed width, or the smallest canonical width in which +// they both fit otherwise. +static auto GetIntsAtSuitableWidth(Context& context, IntId bit_width_id, + IntId lhs_id, IntId rhs_id) + -> APIntBinaryOperands { + // Unsized operands: take the wider of the bit widths. + if (!bit_width_id.is_valid()) { + APIntBinaryOperands result = {.lhs = context.ints().Get(lhs_id), + .rhs = context.ints().Get(rhs_id)}; + if (result.lhs.getBitWidth() != result.rhs.getBitWidth()) { + if (result.lhs.getBitWidth() > result.rhs.getBitWidth()) { + result.rhs = result.rhs.sext(result.lhs.getBitWidth()); } else { - result_val = lhs_val.lshr(rhs_orig_val); + result.lhs = result.lhs.sext(result.rhs.getBitWidth()); } - return MakeIntResult(context, lhs.type_id, lhs_is_signed, - std::move(result_val)); } - - default: - // Break to do additional setup for other builtin kinds. - break; + return result; } - // Other operations are already checked to be homogeneous, so we can extend - // the RHS with the LHS bit width. - CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); - llvm::APInt rhs_val = context.ints().GetAtWidth(rhs.int_id, lhs_bit_width_id); + return {.lhs = context.ints().GetAtWidth(lhs_id, bit_width_id), + .rhs = context.ints().GetAtWidth(rhs_id, bit_width_id)}; +} - // We may also need to diagnose overflow for these operations. +namespace { +// The result of performing a binary int operation. +struct BinaryIntOpResult { + llvm::APInt result_val; + bool overflow; + Lex::TokenKind op_token; +}; +} + +// Computes the result of a homogeneous binary (int, int) -> int operation. +static auto ComputeBinaryIntOpResult(SemIR::BuiltinFunctionKind builtin_kind, + const llvm::APInt& lhs_val, + const llvm::APInt& rhs_val) + -> BinaryIntOpResult { + llvm::APInt result_val; bool overflow = false; Lex::TokenKind op_token = Lex::TokenKind::Not; @@ -943,23 +933,145 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, case SemIR::BuiltinFunctionKind::IntLeftShift: case SemIR::BuiltinFunctionKind::IntRightShift: - CARBON_FATAL("Handled specially above."); + CARBON_FATAL("Non-homogeneous operation handled separately."); default: CARBON_FATAL("Unexpected operation kind."); } + return {.result_val = std::move(result_val), + .overflow = overflow, + .op_token = op_token}; +} + +// Performs a builtin binary integer -> integer operation. +static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, + SemIR::InstId rhs_id) + -> SemIR::ConstantId { + auto lhs = context.insts().GetAs(lhs_id); + auto rhs = context.insts().GetAs(rhs_id); + + // Check for division by zero. + switch (builtin_kind) { + case SemIR::BuiltinFunctionKind::IntSDiv: + case SemIR::BuiltinFunctionKind::IntSMod: + case SemIR::BuiltinFunctionKind::IntUDiv: + case SemIR::BuiltinFunctionKind::IntUMod: + if (context.ints().Get(rhs.int_id).isZero()) { + DiagnoseDivisionByZero(context, loc); + return SemIR::ErrorInst::SingletonConstantId; + } + break; + default: + break; + } - if (overflow) { + auto [lhs_is_signed, lhs_bit_width_id] = + context.sem_ir().types().GetIntTypeInfo(lhs.type_id); + + // First handle shift, which can directly use the canonical RHS and doesn't + // overflow. + switch (builtin_kind) { + // Bit shift. + case SemIR::BuiltinFunctionKind::IntLeftShift: + case SemIR::BuiltinFunctionKind::IntRightShift: { + llvm::APInt lhs_val = + GetIntAtSuitableWidth(context, lhs_bit_width_id, lhs.int_id); + const auto& rhs_orig_val = context.ints().Get(rhs.int_id); + if ((lhs_bit_width_id.is_valid() && + rhs_orig_val.uge(lhs_val.getBitWidth())) || + (rhs_orig_val.isNegative() && + context.sem_ir().types().IsSignedInt(rhs.type_id))) { + CARBON_DIAGNOSTIC( + CompileTimeShiftOutOfRange, Error, + "shift distance not in range [0, {0}) in {1} {2:<<|>>} {3}", + unsigned, TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), + {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + + llvm::APInt result_val; + if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { + if (!lhs_bit_width_id.is_valid()) { + // Ensure we don't generate a ridiculously large integer through a bit + // shift. + auto width = rhs_orig_val.trySExtValue(); + if (!width || *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { + CARBON_DIAGNOSTIC(CompileTimeUnsizedShiftOutOfRange, Error, + "shift distance of {0} would result in an " + "integer whose width is greater than the " + "maximum supported width of {1}", + TypedInt, int); + context.emitter().Emit(loc, CompileTimeUnsizedShiftOutOfRange, + {.type = rhs.type_id, .value = rhs_orig_val}, + IntStore::MaxIntWidth); + return SemIR::ErrorInst::SingletonConstantId; + } + lhs_val = lhs_val.sext(IntStore::CanonicalBitWidth( + lhs_val.getSignificantBits() + *width)); + } + + result_val = lhs_val.shl(rhs_orig_val); + } else if (lhs_is_signed) { + result_val = lhs_val.ashr(rhs_orig_val); + } else { + CARBON_CHECK(lhs_bit_width_id.is_valid(), + "Logical shift on unsized int"); + result_val = lhs_val.lshr(rhs_orig_val); + } + return MakeIntResult(context, lhs.type_id, lhs_is_signed, + std::move(result_val)); + } + + default: + // Break to do additional setup for other builtin kinds. + break; + } + + // Other operations are already checked to be homogeneous, so we can extend + // the RHS with the LHS bit width. + CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); + auto [lhs_val, rhs_val] = + GetIntsAtSuitableWidth(context, lhs_bit_width_id, lhs.int_id, rhs.int_id); + + BinaryIntOpResult result = + ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); + + if (result.overflow && !lhs_bit_width_id.is_valid()) { + // Retry with a larger bit width. Most operations can only overflow by one + // bit, but signed n-bit multiplication can overflow to 2n-1 bits. + int new_width = + builtin_kind == SemIR::BuiltinFunctionKind::IntSMul + ? lhs_val.getBitWidth() * 2 + : IntStore::CanonicalBitWidth(lhs_val.getBitWidth() + 1); + new_width = std::min(new_width, IntStore::MaxIntWidth); + lhs_val = context.ints().GetAtWidth(lhs.int_id, new_width); + rhs_val = context.ints().GetAtWidth(rhs.int_id, new_width); + + // Note that this can in theory still overflow if we limited `new_width` to + // `MaxIntWidth`. In that case we fall through to the signed overflow + // diagnostic below. + result = ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); + } + + if (result.overflow) { CARBON_DIAGNOSTIC(CompileTimeIntegerOverflow, Error, "integer overflow in calculation {0} {1} {2}", TypedInt, Lex::TokenKind, TypedInt); context.emitter().Emit(loc, CompileTimeIntegerOverflow, - {.type = lhs.type_id, .value = lhs_val}, op_token, + {.type = lhs.type_id, .value = lhs_val}, + result.op_token, {.type = rhs.type_id, .value = rhs_val}); } return MakeIntResult(context, lhs.type_id, lhs_is_signed, - std::move(result_val)); + std::move(result.result_val)); } // Performs a builtin integer comparison. @@ -971,15 +1083,8 @@ static auto PerformBuiltinIntComparison(Context& context, -> SemIR::ConstantId { auto lhs = context.insts().GetAs(lhs_id); auto rhs = context.insts().GetAs(rhs_id); - CARBON_CHECK(lhs.type_id == rhs.type_id, - "Builtin comparison with mismatched types!"); - - auto [is_signed, bit_width_id] = - context.sem_ir().types().GetIntTypeInfo(lhs.type_id); - CARBON_CHECK(bit_width_id != IntId::Invalid, - "Cannot evaluate a generic bit width integer: {0}", lhs); - llvm::APInt lhs_val = context.ints().GetAtWidth(lhs.int_id, bit_width_id); - llvm::APInt rhs_val = context.ints().GetAtWidth(rhs.int_id, bit_width_id); + llvm::APInt lhs_val = context.ints().Get(lhs.int_id); + llvm::APInt rhs_val = context.ints().Get(rhs.int_id); bool result; switch (builtin_kind) { @@ -990,16 +1095,16 @@ static auto PerformBuiltinIntComparison(Context& context, result = (lhs_val != rhs_val); break; case SemIR::BuiltinFunctionKind::IntLess: - result = is_signed ? lhs_val.slt(rhs_val) : lhs_val.ult(rhs_val); + result = lhs_val.slt(rhs_val); break; case SemIR::BuiltinFunctionKind::IntLessEq: - result = is_signed ? lhs_val.sle(rhs_val) : lhs_val.ule(rhs_val); + result = lhs_val.sle(rhs_val); break; case SemIR::BuiltinFunctionKind::IntGreater: - result = is_signed ? lhs_val.sgt(rhs_val) : lhs_val.sgt(rhs_val); + result = lhs_val.sgt(rhs_val); break; case SemIR::BuiltinFunctionKind::IntGreaterEq: - result = is_signed ? lhs_val.sge(rhs_val) : lhs_val.sge(rhs_val); + result = lhs_val.sge(rhs_val); break; default: CARBON_FATAL("Unexpected operation kind."); @@ -1311,7 +1416,7 @@ static auto MakeConstantForCall(EvalContext& eval_context, SemIRLoc loc, // If any operand of the call is non-constant, the call is non-constant. // TODO: Some builtin calls might allow some operands to be non-constant. if (!has_constant_operands) { - if (builtin_kind.IsCompTimeOnly()) { + if (builtin_kind.IsCompTimeOnly(eval_context.sem_ir(), call.type_id)) { CARBON_DIAGNOSTIC(NonConstantCallToCompTimeOnlyFunction, Error, "non-constant call to compile-time-only function"); CARBON_DIAGNOSTIC(CompTimeOnlyFunctionHere, Note, diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index bd7eb61b566d3..9359f9c78b4e8 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -306,6 +306,7 @@ CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerNegateOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeFloatBitWidth) CARBON_DIAGNOSTIC_KIND(CompileTimeShiftOutOfRange) +CARBON_DIAGNOSTIC_KIND(CompileTimeUnsizedShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(ContinueOutsideLoop) CARBON_DIAGNOSTIC_KIND(CopyOfUncopyableType) CARBON_DIAGNOSTIC_KIND(CoreNameNotFound) diff --git a/toolchain/lower/constant.cpp b/toolchain/lower/constant.cpp index ee32d091a910b..cfc956579e3ef 100644 --- a/toolchain/lower/constant.cpp +++ b/toolchain/lower/constant.cpp @@ -48,6 +48,11 @@ class ConstantContext { return nullptr; } + // Gets the value to use for an integer literal. + auto GetIntLiteralAsValue() const -> llvm::Constant* { + return file_context_->GetIntLiteralAsValue(); + } + // Gets a callable's function. Returns nullptr for a builtin. auto GetFunction(SemIR::FunctionId function_id) -> llvm::Function* { return file_context_->GetFunction(function_id); @@ -187,9 +192,9 @@ static auto EmitAsConstant(ConstantContext& context, SemIR::IntValue inst) // represented as an LLVM integer type. auto* int_type = llvm::dyn_cast(type); if (!int_type) { - auto* struct_type = llvm::dyn_cast(type); - CARBON_CHECK(struct_type && struct_type->getNumElements() == 0); - return llvm::ConstantStruct::get(struct_type); + auto* int_literal_value = context.GetIntLiteralAsValue(); + CARBON_CHECK(int_literal_value->getType() == type); + return int_literal_value; } auto val = context.sem_ir().ints().Get(inst.int_id); diff --git a/toolchain/lower/file_context.h b/toolchain/lower/file_context.h index c2f1d57722493..2c1fd28011b6f 100644 --- a/toolchain/lower/file_context.h +++ b/toolchain/lower/file_context.h @@ -68,6 +68,12 @@ class FileContext { return llvm::ConstantStruct::get(GetTypeType()); } + // Returns a lowered value to use for a value of int literal type. + auto GetIntLiteralAsValue() -> llvm::Constant* { + // TODO: Consider adding a named struct type for integer literals. + return llvm::ConstantStruct::get(llvm::StructType::get(llvm_context())); + } + // Returns a global value for the given instruction. auto GetGlobal(SemIR::InstId inst_id) -> llvm::Value*; diff --git a/toolchain/lower/function_context.h b/toolchain/lower/function_context.h index eef1a7370cac7..de2aff947aa49 100644 --- a/toolchain/lower/function_context.h +++ b/toolchain/lower/function_context.h @@ -89,6 +89,11 @@ class FunctionContext { return file_context_->GetTypeAsValue(); } + // Returns a lowered value to use for a value of int literal type. + auto GetIntLiteralAsValue() -> llvm::Constant* { + return file_context_->GetIntLiteralAsValue(); + } + // Returns the instruction immediately after all the existing static allocas. // This is the insert point for future static allocas. auto GetInstructionAfterAllocas() const -> llvm::Instruction* { diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index 9ea2dc5e6b83d..84ffa4653e138 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -58,6 +58,25 @@ static auto GetBuiltinFCmpPredicate(SemIR::BuiltinFunctionKind builtin_kind) } } +// Given an argument that is either a sized integer or integer literal, produces +// a corresponding value. +static auto GetIntOrIntLiteralValue(FunctionContext& context, + SemIR::InstId arg_id) -> llvm::Value* { + auto* result = context.GetValue(arg_id); + + // An IntLiteral value will have been lowered to an empty struct. Produce a + // ConstantInt with its constant value instead. + if (isa(result)) { + CARBON_CHECK(result == context.GetIntLiteralAsValue()); + auto int_value = context.sem_ir().insts().GetAs( + context.sem_ir().constant_values().GetConstantInstId(arg_id)); + return llvm::ConstantInt::get( + context.llvm_context(), context.sem_ir().ints().Get(int_value.int_id)); + } + + return result; +} + // Returns whether the specified instruction has a signed integer type. static auto IsSignedInt(FunctionContext& context, SemIR::InstId int_id) -> bool { @@ -65,6 +84,53 @@ static auto IsSignedInt(FunctionContext& context, SemIR::InstId int_id) context.sem_ir().insts().Get(int_id).type_id()); } +static auto HandleIntComparison(FunctionContext& context, SemIR::InstId inst_id, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) + -> void { + llvm::Value* lhs = GetIntOrIntLiteralValue(context, lhs_id); + llvm::Value* rhs = GetIntOrIntLiteralValue(context, rhs_id); + const auto* lhs_type = cast(lhs->getType()); + const auto* rhs_type = cast(rhs->getType()); + + // We perform a signed comparison if either operand is signed. + bool lhs_signed = IsSignedInt(context, lhs_id); + bool rhs_signed = IsSignedInt(context, rhs_id); + bool cmp_signed = lhs_signed || rhs_signed; + + // Compute the width for the comparison. This is the smallest width that + // fits both types, after widening them to include a sign bit if + // necessary. + auto width_for_cmp = [&](const llvm::IntegerType* type, bool is_signed) { + unsigned width = type->getBitWidth(); + if (!is_signed && cmp_signed) { + // We're performing a signed comparison but this input is unsigned. + // Widen it by at least one bit to provide a sign bit. + ++width; + } + return width; + }; + // TODO: This might be an awkward size, such as 33 or 65 bits, for a + // signed/unsigned comparison. Would it be better to round this up to a + // "nicer" bit width? + unsigned cmp_width = std::max(width_for_cmp(lhs_type, lhs_signed), + width_for_cmp(rhs_type, rhs_signed)); + auto* cmp_type = llvm::IntegerType::get(context.llvm_context(), cmp_width); + + // Widen the operands as needed. + auto zext_or_sext = [&](llvm::Value* value, bool is_signed) { + return is_signed ? context.builder().CreateSExt(value, cmp_type) + : context.builder().CreateZExt(value, cmp_type); + }; + lhs = zext_or_sext(lhs, lhs_signed); + rhs = zext_or_sext(rhs, rhs_signed); + + context.SetLocal( + inst_id, + context.builder().CreateICmp( + GetBuiltinICmpPredicate(builtin_kind, cmp_signed), lhs, rhs)); +} + // Handles a call to a builtin function. static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, SemIR::BuiltinFunctionKind builtin_kind, @@ -245,19 +311,21 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, return; } case SemIR::BuiltinFunctionKind::IntLeftShift: { - context.SetLocal( - inst_id, context.builder().CreateShl(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]))); + context.SetLocal(inst_id, + context.builder().CreateShl( + context.GetValue(arg_ids[0]), + GetIntOrIntLiteralValue(context, arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntRightShift: { - context.SetLocal( - inst_id, - IsSignedInt(context, inst_id) - ? context.builder().CreateAShr(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1])) - : context.builder().CreateLShr(context.GetValue(arg_ids[0]), - context.GetValue(arg_ids[1]))); + context.SetLocal(inst_id, + IsSignedInt(context, inst_id) + ? context.builder().CreateAShr( + context.GetValue(arg_ids[0]), + GetIntOrIntLiteralValue(context, arg_ids[1])) + : context.builder().CreateLShr( + context.GetValue(arg_ids[0]), + GetIntOrIntLiteralValue(context, arg_ids[1]))); return; } case SemIR::BuiltinFunctionKind::IntEq: @@ -268,12 +336,8 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntGreaterEq: case SemIR::BuiltinFunctionKind::BoolEq: case SemIR::BuiltinFunctionKind::BoolNeq: { - context.SetLocal( - inst_id, - context.builder().CreateICmp( - GetBuiltinICmpPredicate(builtin_kind, - IsSignedInt(context, arg_ids[0])), - context.GetValue(arg_ids[0]), context.GetValue(arg_ids[1]))); + HandleIntComparison(context, inst_id, builtin_kind, arg_ids[0], + arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::FloatNegate: { @@ -320,7 +384,8 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntConvertChecked: { // TODO: Check this statically. - CARBON_CHECK(builtin_kind.IsCompTimeOnly()); + CARBON_CHECK(builtin_kind.IsCompTimeOnly( + context.sem_ir(), context.sem_ir().insts().Get(inst_id).type_id())); CARBON_FATAL("Missing constant value for call to comptime-only function"); } } diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 3146f6c55f8f0..24d6bfb609f80 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -79,15 +79,21 @@ struct NoReturn { // Constraint that a type is `bool`. using Bool = BuiltinType; +// Constraint that requires the type to be a sized integer type. +struct AnySizedInt { + static auto Check(const File& sem_ir, ValidateState& /*state*/, + TypeId type_id) -> bool { + return sem_ir.types().Is(type_id); + } +}; + // Constraint that requires the type to be an integer type. struct AnyInt { static auto Check(const File& sem_ir, ValidateState& state, TypeId type_id) -> bool { - if (BuiltinType::Check(sem_ir, state, - type_id)) { - return true; - } - return sem_ir.types().Is(type_id); + return AnySizedInt::Check(sem_ir, state, type_id) || + BuiltinType::Check(sem_ir, state, + type_id); } }; @@ -188,6 +194,10 @@ using IntT = TypeParam<0, AnyInt>; // generic type parameter that is constrained to be an integer type. using IntU = TypeParam<1, AnyInt>; +// Convenience name used in the builtin type signatures below for a first +// generic type parameter that is constrained to be a sized integer type. +using SizedIntT = TypeParam<0, AnySizedInt>; + // Convenience name used in the builtin type signatures below for a first // generic type parameter that is constrained to be an float type. using FloatT = TypeParam<0, AnyFloat>; @@ -196,16 +206,16 @@ using FloatT = TypeParam<0, AnyFloat>; constexpr BuiltinInfo None = {"", nullptr}; // Prints a single character. -constexpr BuiltinInfo PrintChar = {"print.char", - ValidateSignatureAnyInt>}; +constexpr BuiltinInfo PrintChar = { + "print.char", ValidateSignatureAnySizedInt>}; // Prints an integer. -constexpr BuiltinInfo PrintInt = {"print.int", - ValidateSignatureNoReturn>}; +constexpr BuiltinInfo PrintInt = { + "print.int", ValidateSignatureNoReturn>}; // Reads a single character from stdin. constexpr BuiltinInfo ReadChar = {"read.char", - ValidateSignatureAnyInt>}; + ValidateSignatureAnySizedInt>}; // Returns the `Core.IntLiteral` type. constexpr BuiltinInfo IntLiteralMakeType = {"int_literal.make_type", @@ -257,28 +267,28 @@ constexpr BuiltinInfo IntSMod = {"int.smod", ValidateSignatureIntT>}; // "int.unegate": unsigned integer negation. -constexpr BuiltinInfo IntUNegate = {"int.unegate", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUNegate = { + "int.unegate", ValidateSignatureSizedIntT>}; // "int.uadd": unsigned integer addition. -constexpr BuiltinInfo IntUAdd = {"int.uadd", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUAdd = { + "int.uadd", ValidateSignatureSizedIntT>}; // "int.usub": unsigned integer subtraction. -constexpr BuiltinInfo IntUSub = {"int.usub", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUSub = { + "int.usub", ValidateSignatureSizedIntT>}; // "int.umul": unsigned integer multiplication. -constexpr BuiltinInfo IntUMul = {"int.umul", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUMul = { + "int.umul", ValidateSignatureSizedIntT>}; // "int.udiv": unsigned integer division. -constexpr BuiltinInfo IntUDiv = {"int.udiv", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUDiv = { + "int.udiv", ValidateSignatureSizedIntT>}; // "int.mod": integer modulo. -constexpr BuiltinInfo IntUMod = {"int.umod", - ValidateSignatureIntT>}; +constexpr BuiltinInfo IntUMod = { + "int.umod", ValidateSignatureSizedIntT>}; // "int.complement": integer bitwise complement. constexpr BuiltinInfo IntComplement = {"int.complement", @@ -306,27 +316,27 @@ constexpr BuiltinInfo IntRightShift = { // "int.eq": integer equality comparison. constexpr BuiltinInfo IntEq = {"int.eq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.neq": integer non-equality comparison. constexpr BuiltinInfo IntNeq = {"int.neq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.less": integer less than comparison. constexpr BuiltinInfo IntLess = {"int.less", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.less_eq": integer less than or equal comparison. constexpr BuiltinInfo IntLessEq = {"int.less_eq", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.greater": integer greater than comparison. constexpr BuiltinInfo IntGreater = {"int.greater", - ValidateSignatureBool>}; + ValidateSignatureBool>}; // "int.greater_eq": integer greater than or equal comparison. constexpr BuiltinInfo IntGreaterEq = { - "int.greater_eq", ValidateSignatureBool>}; + "int.greater_eq", ValidateSignatureBool>}; // "float.negate": float negation. constexpr BuiltinInfo FloatNegate = {"float.negate", @@ -411,8 +421,35 @@ auto BuiltinFunctionKind::IsValidType(const File& sem_ir, return ValidateFns[AsInt()](sem_ir, arg_types, return_type); } -auto BuiltinFunctionKind::IsCompTimeOnly() const -> bool { - return *this == BuiltinFunctionKind::IntConvertChecked; +auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, + TypeId return_type_id) const -> bool { + switch (*this) { + case IntConvertChecked: + // Checked integer conversions are compile-time only. + return true; + + case IntSNegate: + case IntComplement: + case IntSAdd: + case IntSSub: + case IntSMul: + case IntSDiv: + case IntSMod: + case IntAnd: + case IntOr: + case IntXor: + case IntLeftShift: + case IntRightShift: + // Integer builtins producing an IntLiteral are compile-time only. + // TODO: We could allow these at runtime and just produce an empty struct + // result. Should we? + return sem_ir.types().Is(return_type_id); + + default: + // TODO: Should the sized MakeType functions be compile-time only? We + // can't produce diagnostics for bad sizes at runtime. + return false; + } } } // namespace Carbon::SemIR diff --git a/toolchain/sem_ir/builtin_function_kind.h b/toolchain/sem_ir/builtin_function_kind.h index ab1ba4507f886..d992d545e00c7 100644 --- a/toolchain/sem_ir/builtin_function_kind.h +++ b/toolchain/sem_ir/builtin_function_kind.h @@ -37,7 +37,7 @@ class BuiltinFunctionKind : public CARBON_ENUM_BASE(BuiltinFunctionKind) { TypeId return_type) const -> bool; // Returns whether this is a compile-time-only function. - auto IsCompTimeOnly() const -> bool; + auto IsCompTimeOnly(const File& sem_ir, TypeId return_type_id) const -> bool; }; #define CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(Name) \ From 55e5b83dfb35d92660a3452bdcdc8ed827c60530 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 18 Dec 2024 23:14:46 +0000 Subject: [PATCH 02/13] Add IntLiteral operations to the prelude. --- core/io.carbon | 3 +- core/prelude/operators/arithmetic.carbon | 29 ++++++++++++++ core/prelude/operators/bitwise.carbon | 29 ++++++++++++++ core/prelude/operators/comparison.carbon | 17 +++++++++ toolchain/check/testdata/array/base.carbon | 2 +- .../testdata/array/canonicalize_index.carbon | 2 +- .../testdata/basics/builtin_types.carbon | 2 +- .../fail_numeric_literal_overflow.carbon | 2 +- .../testdata/basics/numeric_literals.carbon | 2 +- .../testdata/builtins/float/make_type.carbon | 4 +- .../builtins/int/convert_checked.carbon | 8 ++-- .../check/testdata/builtins/print/char.carbon | 6 +-- .../check/testdata/builtins/print/int.carbon | 6 +-- .../testdata/class/generic/import.carbon | 20 +++++----- toolchain/check/testdata/class/import.carbon | 38 +++++++++---------- .../testdata/function/builtin/method.carbon | 2 +- .../testdata/if_expr/control_flow.carbon | 2 +- .../if_expr/fail_not_in_function.carbon | 6 +-- .../index/fail_negative_indexing.carbon | 38 ++++++++++++++----- .../builtin/fail_type_mismatch_once.carbon | 19 +++++----- .../builtin/fail_unimplemented_op.carbon | 10 ++--- .../overloaded/bit_complement.carbon | 4 +- .../testdata/operators/overloaded/dec.carbon | 4 +- .../testdata/operators/overloaded/eq.carbon | 2 +- .../operators/overloaded/fail_no_impl.carbon | 6 +-- .../overloaded/fail_no_impl_for_arg.carbon | 2 +- .../testdata/operators/overloaded/inc.carbon | 4 +- .../operators/overloaded/negate.carbon | 4 +- .../packages/implicit_imports_prelude.carbon | 2 +- .../check/testdata/pointer/import.carbon | 2 +- .../testdata/return/returned_var_scope.carbon | 2 +- toolchain/check/testdata/struct/import.carbon | 30 +++++++-------- .../access/fail_negative_indexing.carbon | 17 +++++++-- .../tuple/access/index_not_literal.carbon | 2 +- toolchain/check/testdata/tuple/import.carbon | 30 +++++++-------- .../lower/testdata/builtins/print_read.carbon | 2 +- 36 files changed, 233 insertions(+), 127 deletions(-) diff --git a/core/io.carbon b/core/io.carbon index 80c1aa3acf051..b5a917e37a45f 100644 --- a/core/io.carbon +++ b/core/io.carbon @@ -15,5 +15,4 @@ fn PrintChar(x: i32) -> i32 = "print.char"; fn ReadChar() -> i32 = "read.char"; // TODO: Change this to a global constant once they are fully supported. -// TODO: Use simply -1 once we support negate on an IntLiteral. -fn EOF() -> i32 { return -(1 as i32); } +fn EOF() -> i32 { return -1; } diff --git a/core/prelude/operators/arithmetic.carbon b/core/prelude/operators/arithmetic.carbon index 693d0571f2b42..36705e2cc5678 100644 --- a/core/prelude/operators/arithmetic.carbon +++ b/core/prelude/operators/arithmetic.carbon @@ -4,6 +4,8 @@ package Core library "prelude/operators/arithmetic"; +import library "prelude/types/int_literal"; + // Addition: `a + b`. interface Add { fn Op[self: Self](other: Self) -> Self; @@ -68,3 +70,30 @@ interface Mod { interface ModAssign { fn Op[addr self: Self*](other: Self); } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as Add { + fn Op[self: Self](other: Self) -> Self = "int.sadd"; +} + +impl IntLiteral() as Div { + fn Op[self: Self](other: Self) -> Self = "int.sdiv"; +} + +impl IntLiteral() as Mod { + fn Op[self: Self](other: Self) -> Self = "int.smod"; +} + +impl IntLiteral() as Mul { + fn Op[self: Self](other: Self) -> Self = "int.smul"; +} + +impl IntLiteral() as Negate { + fn Op[self: Self]() -> Self = "int.snegate"; +} + +impl IntLiteral() as Sub { + fn Op[self: Self](other: Self) -> Self = "int.ssub"; +} diff --git a/core/prelude/operators/bitwise.carbon b/core/prelude/operators/bitwise.carbon index 30e665c294063..1eecda4b94b06 100644 --- a/core/prelude/operators/bitwise.carbon +++ b/core/prelude/operators/bitwise.carbon @@ -4,6 +4,8 @@ package Core library "prelude/operators/bitwise"; +import library "prelude/types/int_literal"; + // Bit complement: `^a`. interface BitComplement { fn Op[self: Self]() -> Self; @@ -58,3 +60,30 @@ interface RightShift { interface RightShiftAssign { fn Op[addr self: Self*](other: Self); } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as BitAnd { + fn Op[self: Self](other: Self) -> Self = "int.and"; +} + +impl IntLiteral() as BitComplement { + fn Op[self: Self]() -> Self = "int.complement"; +} + +impl IntLiteral() as BitOr { + fn Op[self: Self](other: Self) -> Self = "int.or"; +} + +impl IntLiteral() as BitXor { + fn Op[self: Self](other: Self) -> Self = "int.xor"; +} + +impl IntLiteral() as LeftShift { + fn Op[self: Self](other: Self) -> Self = "int.left_shift"; +} + +impl IntLiteral() as RightShift { + fn Op[self: Self](other: Self) -> Self = "int.right_shift"; +} diff --git a/core/prelude/operators/comparison.carbon b/core/prelude/operators/comparison.carbon index 7a76a70361f83..45d48b3fbfa2e 100644 --- a/core/prelude/operators/comparison.carbon +++ b/core/prelude/operators/comparison.carbon @@ -5,6 +5,7 @@ package Core library "prelude/operators/comparison"; export import library "prelude/types/bool"; +import library "prelude/types/int_literal"; // Equality comparison: `a == b` and `a != b`. interface Eq { @@ -28,3 +29,19 @@ impl bool as Eq { fn Equal[self: Self](other: Self) -> bool = "bool.eq"; fn NotEqual[self: Self](other: Self) -> bool = "bool.neq"; } + + +// Operations for IntLiteral. These need to be here because IntLiteral has no +// associated library of its own. +impl IntLiteral() as Eq { + fn Equal[self: Self](other: Self) -> bool = "int.eq"; + fn NotEqual[self: Self](other: Self) -> bool = "int.neq"; +} + +impl IntLiteral() as Ordered { + // TODO: fn Compare + fn Less[self: Self](other: Self) -> bool = "int.less"; + fn LessOrEquivalent[self: Self](other: Self) -> bool = "int.less_eq"; + fn Greater[self: Self](other: Self) -> bool = "int.greater"; + fn GreaterOrEquivalent[self: Self](other: Self) -> bool = "int.greater_eq"; +} diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index 21002ef401a59..b1e1d8ea7e799 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -52,7 +52,7 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index ede43d291df3b..e43f1d9c199a9 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -53,7 +53,7 @@ let c: [i32; ConvertToU32(3)]* = &a; // CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] // CHECK:STDOUT: %array: %array_type = tuple_value (%int_1.2, %int_2.2, %int_3.1) [template] // CHECK:STDOUT: %int_3.3: %u32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.8, @impl.32(%int_32) [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.8, @impl.44(%int_32) [template] // CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] // CHECK:STDOUT: %interface.11: = interface_witness (%Convert.16) [template] // CHECK:STDOUT: %Convert.bound.5: = bound_method %int_3.3, %Convert.16 [template] diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index 33d0bc462bdb8..234a1b06353a1 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -37,7 +37,7 @@ var test_type: type = i32; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon index 3a7a956a7d338..fe65ca8055565 100644 --- a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +++ b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon @@ -63,7 +63,7 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index 052ab63f6f82f..626d9f8efd86b 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -80,7 +80,7 @@ fn F() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 7fb8e8f28e4f6..40cc14b496d90 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -108,7 +108,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, Float, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Int = %import_ref.193 +// CHECK:STDOUT: .Int = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -194,7 +194,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Main//types, Float, loaded [template = constants.%Float] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Int = %import_ref.193 +// CHECK:STDOUT: .Int = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/convert_checked.carbon b/toolchain/check/testdata/builtins/int/convert_checked.carbon index 31a00ee65264f..7e1d3cfb65d5d 100644 --- a/toolchain/check/testdata/builtins/int/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -960,7 +960,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 // CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 +// CHECK:STDOUT: .Int = %import_ref.253 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1122,7 +1122,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 // CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 +// CHECK:STDOUT: .Int = %import_ref.253 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1469,7 +1469,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 // CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 +// CHECK:STDOUT: .Int = %import_ref.253 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1718,7 +1718,7 @@ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .UInt = %import_ref.22 // CHECK:STDOUT: .ImplicitAs = %import_ref.29 -// CHECK:STDOUT: .Int = %import_ref.217 +// CHECK:STDOUT: .Int = %import_ref.253 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/print/char.carbon b/toolchain/check/testdata/builtins/print/char.carbon index 1eb168d79e520..322130ec23b73 100644 --- a/toolchain/check/testdata/builtins/print/char.carbon +++ b/toolchain/check/testdata/builtins/print/char.carbon @@ -46,12 +46,12 @@ fn Main() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .PrintChar = %import_ref.193 +// CHECK:STDOUT: .PrintChar = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//io // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: %PrintChar.type.2 = import_ref Core//io, PrintChar, loaded [template = constants.%PrintChar.2] +// CHECK:STDOUT: %import_ref.229: %PrintChar.type.2 = import_ref Core//io, PrintChar, loaded [template = constants.%PrintChar.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -93,7 +93,7 @@ fn Main() { // CHECK:STDOUT: %.loc16_13.2: %i32 = converted %int_1, %.loc16_13.1 [template = constants.%int_1.2] // CHECK:STDOUT: %print.char.loc16: init %i32 = call %PrintChar.ref.loc16(%.loc16_13.2) // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %PrintChar.ref.loc17: %PrintChar.type.2 = name_ref PrintChar, imports.%import_ref.193 [template = constants.%PrintChar.2] +// CHECK:STDOUT: %PrintChar.ref.loc17: %PrintChar.type.2 = name_ref PrintChar, imports.%import_ref.229 [template = constants.%PrintChar.2] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] // CHECK:STDOUT: %impl.elem0.loc17: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %Convert.bound.loc17: = bound_method %int_2, %impl.elem0.loc17 [template = constants.%Convert.bound.2] diff --git a/toolchain/check/testdata/builtins/print/int.carbon b/toolchain/check/testdata/builtins/print/int.carbon index 4b24230f45268..2bc5d0b1e0656 100644 --- a/toolchain/check/testdata/builtins/print/int.carbon +++ b/toolchain/check/testdata/builtins/print/int.carbon @@ -48,12 +48,12 @@ fn Main() { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Print = %import_ref.193 +// CHECK:STDOUT: .Print = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//io // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: %Print.type.2 = import_ref Core//io, Print, loaded [template = constants.%Print.2] +// CHECK:STDOUT: %import_ref.229: %Print.type.2 = import_ref Core//io, Print, loaded [template = constants.%Print.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -89,7 +89,7 @@ fn Main() { // CHECK:STDOUT: %.loc16_9.2: %i32 = converted %int_1, %.loc16_9.1 [template = constants.%int_1.2] // CHECK:STDOUT: %print.int.loc16: init %empty_tuple.type = call %Print.ref.loc16(%.loc16_9.2) // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %Print.ref.loc18: %Print.type.2 = name_ref Print, imports.%import_ref.193 [template = constants.%Print.2] +// CHECK:STDOUT: %Print.ref.loc18: %Print.type.2 = name_ref Print, imports.%import_ref.229 [template = constants.%Print.2] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] // CHECK:STDOUT: %impl.elem0.loc18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] // CHECK:STDOUT: %Convert.bound.loc18: = bound_method %int_2, %impl.elem0.loc18 [template = constants.%Convert.bound.2] diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 42a27cb9d555c..ccefee7f3e253 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -284,15 +284,15 @@ class Class(U:! type) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, CompleteClass, loaded [template = constants.%CompleteClass.generic] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.197 -// CHECK:STDOUT: .ImplicitAs = %import_ref.198 +// CHECK:STDOUT: .Int = %import_ref.233 +// CHECK:STDOUT: .ImplicitAs = %import_ref.234 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.193: = import_ref Main//foo, loc9_1, loaded [template = constants.%complete_type.4] -// CHECK:STDOUT: %import_ref.194 = import_ref Main//foo, inst37 [no loc], unloaded -// CHECK:STDOUT: %import_ref.195 = import_ref Main//foo, loc7_8, unloaded -// CHECK:STDOUT: %import_ref.196 = import_ref Main//foo, loc8_17, unloaded +// CHECK:STDOUT: %import_ref.229: = import_ref Main//foo, loc9_1, loaded [template = constants.%complete_type.4] +// CHECK:STDOUT: %import_ref.230 = import_ref Main//foo, inst37 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231 = import_ref Main//foo, loc7_8, unloaded +// CHECK:STDOUT: %import_ref.232 = import_ref Main//foo, loc8_17, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -360,10 +360,10 @@ class Class(U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.194 -// CHECK:STDOUT: .n = imports.%import_ref.195 -// CHECK:STDOUT: .F = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.193 +// CHECK:STDOUT: .Self = imports.%import_ref.230 +// CHECK:STDOUT: .n = imports.%import_ref.231 +// CHECK:STDOUT: .F = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.229 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 8dda32981715a..f651b26a53368 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -204,14 +204,14 @@ fn Run() { // CHECK:STDOUT: %import_ref.10: = import_ref Main//a, loc9_1, loaded [template = constants.%complete_type.3] // CHECK:STDOUT: %import_ref.11 = import_ref Main//a, inst21 [no loc], unloaded // CHECK:STDOUT: %import_ref.12: %Field.elem = import_ref Main//a, loc8_8, loaded [template = %.1] -// CHECK:STDOUT: %import_ref.201: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] -// CHECK:STDOUT: %import_ref.202 = import_ref Main//a, inst56 [no loc], unloaded -// CHECK:STDOUT: %import_ref.203: %F.type = import_ref Main//a, loc14_21, loaded [template = constants.%F] -// CHECK:STDOUT: %import_ref.204: %G.type = import_ref Main//a, loc15_27, loaded [template = constants.%G] -// CHECK:STDOUT: %import_ref.205: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] -// CHECK:STDOUT: %import_ref.206 = import_ref Main//a, inst56 [no loc], unloaded -// CHECK:STDOUT: %import_ref.207 = import_ref Main//a, loc14_21, unloaded -// CHECK:STDOUT: %import_ref.208 = import_ref Main//a, loc15_27, unloaded +// CHECK:STDOUT: %import_ref.237: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] +// CHECK:STDOUT: %import_ref.238 = import_ref Main//a, inst56 [no loc], unloaded +// CHECK:STDOUT: %import_ref.239: %F.type = import_ref Main//a, loc14_21, loaded [template = constants.%F] +// CHECK:STDOUT: %import_ref.240: %G.type = import_ref Main//a, loc15_27, loaded [template = constants.%G] +// CHECK:STDOUT: %import_ref.241: = import_ref Main//a, loc16_1, loaded [template = constants.%complete_type.1] +// CHECK:STDOUT: %import_ref.242 = import_ref Main//a, inst56 [no loc], unloaded +// CHECK:STDOUT: %import_ref.243 = import_ref Main//a, loc14_21, unloaded +// CHECK:STDOUT: %import_ref.244 = import_ref Main//a, loc15_27, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -243,18 +243,18 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.1 [from "a.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.202 -// CHECK:STDOUT: .F = imports.%import_ref.203 -// CHECK:STDOUT: .G = imports.%import_ref.204 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.201 +// CHECK:STDOUT: .Self = imports.%import_ref.238 +// CHECK:STDOUT: .F = imports.%import_ref.239 +// CHECK:STDOUT: .G = imports.%import_ref.240 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.237 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared.2 [from "a.carbon"] { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.206 -// CHECK:STDOUT: .F = imports.%import_ref.207 -// CHECK:STDOUT: .G = imports.%import_ref.208 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.205 +// CHECK:STDOUT: .Self = imports.%import_ref.242 +// CHECK:STDOUT: .F = imports.%import_ref.243 +// CHECK:STDOUT: .G = imports.%import_ref.244 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.241 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete [from "a.carbon"]; @@ -301,12 +301,12 @@ fn Run() { // CHECK:STDOUT: %.loc12_30: init %ForwardDeclared.1 = converted %.loc12_29.1, %.loc12_29.2 [template = constants.%ForwardDeclared.val] // CHECK:STDOUT: assign %c.var, %.loc12_30 // CHECK:STDOUT: %c.ref.loc13: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.203 [template = constants.%F] +// CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.239 [template = constants.%F] // CHECK:STDOUT: %F.bound: = bound_method %c.ref.loc13, %F.ref // CHECK:STDOUT: %.loc13: %ForwardDeclared.1 = bind_value %c.ref.loc13 // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.bound(%.loc13) // CHECK:STDOUT: %c.ref.loc14: ref %ForwardDeclared.1 = name_ref c, %c -// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.204 [template = constants.%G] +// CHECK:STDOUT: %G.ref: %G.type = name_ref G, imports.%import_ref.240 [template = constants.%G] // CHECK:STDOUT: %G.bound: = bound_method %c.ref.loc14, %G.ref // CHECK:STDOUT: %addr.loc14: %ptr.3 = addr_of %c.ref.loc14 // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.bound(%addr.loc14) @@ -326,5 +326,5 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self.param_patt: %ForwardDeclared.1]() [from "a.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr .inst605: %ptr.3]() [from "a.carbon"]; +// CHECK:STDOUT: fn @G[addr .inst653: %ptr.3]() [from "a.carbon"]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index 0e484d50fbbe5..f427a3ae15249 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -66,7 +66,7 @@ var arr: [i32; (1 as i32).(I.F)(2)]; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .As = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.193 +// CHECK:STDOUT: .ImplicitAs = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 1e4814a629020..a5b29b6c8faec 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -46,7 +46,7 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Bool = %import_ref.193 +// CHECK:STDOUT: .Bool = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 8c4c3bc09c90e..69b252c0445ca 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -50,7 +50,7 @@ class C { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Float = %import_ref.193 +// CHECK:STDOUT: .Float = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -74,8 +74,8 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .n = .inst559.loc37_8 -// CHECK:STDOUT: complete_type_witness = .inst561.loc38_1 +// CHECK:STDOUT: .n = .inst607.loc37_8 +// CHECK:STDOUT: complete_type_witness = .inst609.loc38_1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index 922b45ac905f3..dc74a2d0bf837 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -9,7 +9,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var c: [i32; 2] = (42, 42); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: cannot access member of interface `Core.Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: error: array index `-10` is past the end of type `[i32; 2]` [ArrayIndexOutOfBounds] // CHECK:STDERR: var d: i32 = c[-10]; // CHECK:STDERR: ^~~ var d: i32 = c[-10]; @@ -29,19 +29,28 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound: = bound_method %int_42.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_42.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_42.2: %i32 = int_value 42 [template] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %array: %array_type = tuple_value (%int_42.2, %int_42.2) [template] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %Op.2 [template] +// CHECK:STDOUT: %int_-10.1: Core.IntLiteral = int_value -10 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_-10.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-10.2: %i32 = int_value -10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Negate = %import_ref.193 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -72,16 +81,16 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %int_42.loc11_24: Core.IntLiteral = int_value 42 [template = constants.%int_42.1] // CHECK:STDOUT: %.loc11_26.1: %tuple.type = tuple_literal (%int_42.loc11_20, %int_42.loc11_24) // CHECK:STDOUT: %impl.elem0.loc11_26.1: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26.1: = bound_method %int_42.loc11_20, %impl.elem0.loc11_26.1 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26.1: = specific_function %Convert.bound.loc11_26.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] +// CHECK:STDOUT: %Convert.bound.loc11_26.1: = bound_method %int_42.loc11_20, %impl.elem0.loc11_26.1 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_26.1: = specific_function %Convert.bound.loc11_26.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] // CHECK:STDOUT: %int.convert_checked.loc11_26.1: init %i32 = call %Convert.specific_fn.loc11_26.1(%int_42.loc11_20) [template = constants.%int_42.2] // CHECK:STDOUT: %.loc11_26.2: init %i32 = converted %int_42.loc11_20, %int.convert_checked.loc11_26.1 [template = constants.%int_42.2] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0] // CHECK:STDOUT: %.loc11_26.3: ref %i32 = array_index file.%c.var, %int_0 // CHECK:STDOUT: %.loc11_26.4: init %i32 = initialize_from %.loc11_26.2 to %.loc11_26.3 [template = constants.%int_42.2] // CHECK:STDOUT: %impl.elem0.loc11_26.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26.2: = bound_method %int_42.loc11_24, %impl.elem0.loc11_26.2 [template = constants.%Convert.bound] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26.2: = specific_function %Convert.bound.loc11_26.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] +// CHECK:STDOUT: %Convert.bound.loc11_26.2: = bound_method %int_42.loc11_24, %impl.elem0.loc11_26.2 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_26.2: = specific_function %Convert.bound.loc11_26.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] // CHECK:STDOUT: %int.convert_checked.loc11_26.2: init %i32 = call %Convert.specific_fn.loc11_26.2(%int_42.loc11_24) [template = constants.%int_42.2] // CHECK:STDOUT: %.loc11_26.5: init %i32 = converted %int_42.loc11_24, %int.convert_checked.loc11_26.2 [template = constants.%int_42.2] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1] @@ -92,9 +101,20 @@ var d: i32 = c[-10]; // CHECK:STDOUT: assign file.%c.var, %.loc11_27 // CHECK:STDOUT: %c.ref: ref %array_type = name_ref c, file.%c // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc15_16.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %impl.elem0.loc15_16.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_10) [template = constants.%int_-10.1] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %.loc15_19.1: ref %i32 = array_index %c.ref, [template = ] +// CHECK:STDOUT: %impl.elem0.loc15_16.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.snegate, %impl.elem0.loc15_16.2 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-10.1] +// CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %int.snegate, %.loc15_16.1 [template = constants.%int_-10.1] +// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_16.2) [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_16.3: %i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_16.4: %i32 = converted %int.snegate, %.loc15_16.3 [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc15_19.1: ref %i32 = array_index %c.ref, %.loc15_16.4 [template = ] // CHECK:STDOUT: %.loc15_19.2: %i32 = bind_value %.loc15_19.1 // CHECK:STDOUT: assign file.%d.var, %.loc15_19.2 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index ca3606c738a3e..923d8b434aec0 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -9,16 +9,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon fn Main() -> i32 { - // The following line has two mismatches, but after the first, it shouldn't - // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+7]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 3.4 + 12; + // TODO: The following line has two mismatches, but after the first, it + // shouldn't keep erroring. + // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+7]]:10: error: cannot access member of interface `Core.Add` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return {} + 3.4 + 12; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 3.4 + 12; + // CHECK:STDERR: return {} + 3.4 + 12; // CHECK:STDERR: ^~~~~~~~~~~~~ - return 12 + 3.4 + 12; + return {} + 3.4 + 12; } // CHECK:STDOUT: --- fail_type_mismatch_once.carbon @@ -28,8 +28,9 @@ fn Main() -> i32 { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -60,9 +61,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_12.loc21_10: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %.loc21: %empty_struct_type = struct_literal () // CHECK:STDOUT: %float: f64 = float_literal 3.4000000000000004 [template = constants.%float] -// CHECK:STDOUT: %int_12.loc21_21: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index b67d0fa9bf4c1..4b7c3eb7e1938 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -9,10 +9,10 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: return 12 + 34; + // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Core.Add` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: return {} + 34; // CHECK:STDERR: ^~~~~~~ - return 12 + 34; + return {} + 34; } // CHECK:STDOUT: --- fail_unimplemented_op.carbon @@ -22,7 +22,7 @@ fn Main() -> i32 { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Main.type: type = fn_type @Main [template] // CHECK:STDOUT: %Main: %Main.type = struct_value () [template] -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -54,7 +54,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal () // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [template = constants.%int_34] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index ccd42c22a5f06..2d187168b3097 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -57,7 +57,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %BitComplement.ref: type = name_ref BitComplement, imports.%import_ref.1 [template = constants.%BitComplement.type] @@ -77,7 +77,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %BitComplement.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %BitComplement.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index 8d3048c5f1c10..efd01579e2716 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -58,7 +58,7 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Dec.ref: type = name_ref Dec, imports.%import_ref.1 [template = constants.%Dec.type] @@ -66,7 +66,7 @@ fn TestOp() { // CHECK:STDOUT: %TestOp.decl: %TestOp.type = fn_decl @TestOp [template = constants.%TestOp] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Dec.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Dec.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %ptr.1 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %ptr.1 = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index aba611ffadaef..702c5722d06a7 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -377,7 +377,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Eq = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.7 -// CHECK:STDOUT: .ImplicitAs = %import_ref.12 +// CHECK:STDOUT: .ImplicitAs = %import_ref.27 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index f76473272923c..6ef104a7a34a8 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -59,9 +59,9 @@ fn TestRef(b: C) { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Negate = %import_ref.1 -// CHECK:STDOUT: .Add = %import_ref.6 -// CHECK:STDOUT: .AddAssign = %import_ref.11 -// CHECK:STDOUT: .Inc = %import_ref.16 +// CHECK:STDOUT: .Add = %import_ref.39 +// CHECK:STDOUT: .AddAssign = %import_ref.41 +// CHECK:STDOUT: .Inc = %import_ref.46 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 6ea10283ce257..cafb9f4779aa0 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -78,7 +78,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Add = %import_ref.1 // CHECK:STDOUT: .AddAssign = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.10 +// CHECK:STDOUT: .ImplicitAs = %import_ref.43 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index ff7d9a6b5ef8f..50fdcf4a6a0b3 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -58,7 +58,7 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, imports.%import_ref.1 [template = constants.%Inc.type] @@ -66,7 +66,7 @@ fn TestOp() { // CHECK:STDOUT: %TestOp.decl: %TestOp.type = fn_decl @TestOp [template = constants.%TestOp] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Inc.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Inc.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %ptr.1 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %ptr.1 = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index 8c0efa78ea09b..214749551a945 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -57,7 +57,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.1 [template] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %Negate.ref: type = name_ref Negate, imports.%import_ref.1 [template = constants.%Negate.type] @@ -77,7 +77,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %C.ref as %Negate.ref { +// CHECK:STDOUT: impl @impl.1: %C.ref as %Negate.ref { // CHECK:STDOUT: %Op.decl: %Op.type.1 = fn_decl @Op.1 [template = constants.%Op.1] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 diff --git a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon index 27424c5b306ae..750084f7a3590 100644 --- a/toolchain/check/testdata/packages/implicit_imports_prelude.carbon +++ b/toolchain/check/testdata/packages/implicit_imports_prelude.carbon @@ -80,7 +80,7 @@ var b: i32 = a; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: ref %i32 = import_ref Main//lib, a, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.191 +// CHECK:STDOUT: .Int = %import_ref.227 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/import.carbon b/toolchain/check/testdata/pointer/import.carbon index 3018624adfec4..ac36364780961 100644 --- a/toolchain/check/testdata/pointer/import.carbon +++ b/toolchain/check/testdata/pointer/import.carbon @@ -91,7 +91,7 @@ var a: i32* = a_ref; // CHECK:STDOUT: %import_ref.1 = import_ref Implicit//default, a_orig, unloaded // CHECK:STDOUT: %import_ref.2: ref %ptr = import_ref Implicit//default, a_ref, loaded // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.192 +// CHECK:STDOUT: .Int = %import_ref.228 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 6776faa597e0d..21acef38b1770 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -57,7 +57,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Bool = %import_ref.193 +// CHECK:STDOUT: .Bool = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index b0a4fbae02488..ae04ebf099a9f 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -294,13 +294,13 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.194 -// CHECK:STDOUT: .ImplicitAs = %import_ref.197 +// CHECK:STDOUT: .Int = %import_ref.230 +// CHECK:STDOUT: .ImplicitAs = %import_ref.233 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst602 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.232 = import_ref Implicit//default, inst650 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -365,8 +365,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.195 +// CHECK:STDOUT: .Self = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.231 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -454,8 +454,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst602 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst650 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -486,8 +486,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -555,12 +555,12 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.196 +// CHECK:STDOUT: .ImplicitAs = %import_ref.232 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst602 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst650 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -606,8 +606,8 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon index 2d6290bd08508..323d02a58d56d 100644 --- a/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon @@ -9,9 +9,9 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/access/fail_negative_indexing.carbon var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:17: error: cannot access member of interface `Core.Negate` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:14: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] // CHECK:STDERR: var b: i32 = a.(-10); -// CHECK:STDERR: ^~~ +// CHECK:STDERR: ^~~~~~~ var b: i32 = a.(-10); // CHECK:STDOUT: --- fail_negative_indexing.carbon @@ -36,13 +36,19 @@ var b: i32 = a.(-10); // CHECK:STDOUT: %int_6.2: %i32 = int_value 6 [template] // CHECK:STDOUT: %tuple: %tuple.type.2 = tuple_value (%int_12.2, %int_6.2) [template] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %Op.2 [template] +// CHECK:STDOUT: %int_-10: Core.IntLiteral = int_value -10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 -// CHECK:STDOUT: .Negate = %import_ref.193 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -93,6 +99,11 @@ var b: i32 = a.(-10); // CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref %tuple.type.2 = name_ref a, file.%a // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc15: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_10, %impl.elem0.loc15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_10) [template = constants.%int_-10] +// CHECK:STDOUT: %.loc15_17.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-10] +// CHECK:STDOUT: %.loc15_17.2: Core.IntLiteral = converted %int.snegate, %.loc15_17.1 [template = constants.%int_-10] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/access/index_not_literal.carbon b/toolchain/check/testdata/tuple/access/index_not_literal.carbon index 6e45793f2a6c3..772b138cbbe95 100644 --- a/toolchain/check/testdata/tuple/access/index_not_literal.carbon +++ b/toolchain/check/testdata/tuple/access/index_not_literal.carbon @@ -64,7 +64,7 @@ var d: i32 = a.({.index = 1 as i32}.index); // CHECK:STDOUT: .Bool = %import_ref.1 // CHECK:STDOUT: .Int = %import_ref.2 // CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: .As = %import_ref.194 +// CHECK:STDOUT: .As = %import_ref.230 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index 32a90df4b979f..50b8962dbc785 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -323,13 +323,13 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.194 -// CHECK:STDOUT: .ImplicitAs = %import_ref.197 +// CHECK:STDOUT: .Int = %import_ref.230 +// CHECK:STDOUT: .ImplicitAs = %import_ref.233 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst637 [no loc], unloaded +// CHECK:STDOUT: %import_ref.231: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.232 = import_ref Implicit//default, inst685 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -401,8 +401,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.196 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.195 +// CHECK:STDOUT: .Self = imports.%import_ref.232 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.231 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -499,8 +499,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst637 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst685 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -532,8 +532,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -601,12 +601,12 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Implicit//default, C, loaded [template = constants.%C.generic] // CHECK:STDOUT: %import_ref.4: %F.type = import_ref Implicit//default, F, loaded [template = constants.%F] // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .ImplicitAs = %import_ref.196 +// CHECK:STDOUT: .ImplicitAs = %import_ref.232 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst637 [no loc], unloaded +// CHECK:STDOUT: %import_ref.230: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] +// CHECK:STDOUT: %import_ref.231 = import_ref Implicit//default, inst685 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -652,8 +652,8 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.195 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.194 +// CHECK:STDOUT: .Self = imports.%import_ref.231 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.230 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/print_read.carbon b/toolchain/lower/testdata/builtins/print_read.carbon index 8834eea2d5190..5e2b582f39774 100644 --- a/toolchain/lower/testdata/builtins/print_read.carbon +++ b/toolchain/lower/testdata/builtins/print_read.carbon @@ -16,7 +16,7 @@ fn ReadChar() -> i32 = "read.char"; fn Main() { Core.Print(1); - let EOF: i32 = -(1 as i32); + let EOF: i32 = -1; while (ReadChar() != EOF) { // "Hi" if (PrintChar(0x48) != EOF) { From 312a778ebe5e6bee54dfe6e2eb4386e5117b309e Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 01:04:10 +0000 Subject: [PATCH 03/13] Testing for new ops. --- toolchain/check/eval.cpp | 26 +- .../check/testdata/builtins/int/and.carbon | 353 +++++- .../testdata/builtins/int/complement.carbon | 652 ++++++++++- .../check/testdata/builtins/int/eq.carbon | 785 +++++++++++-- .../testdata/builtins/int/greater_eq.carbon | 1001 ++++++++++++++--- .../testdata/builtins/int/left_shift.carbon | 807 +++++++++++-- .../testdata/builtins/int/less_eq.carbon | 991 +++++++++++++--- .../testdata/builtins/int/right_shift.carbon | 6 +- .../check/testdata/builtins/int/sadd.carbon | 2 +- .../check/testdata/builtins/int/sdiv.carbon | 2 +- .../check/testdata/builtins/int/smod.carbon | 2 +- .../check/testdata/builtins/int/smul.carbon | 2 +- .../check/testdata/builtins/int/ssub.carbon | 2 +- toolchain/diagnostics/diagnostic_kind.def | 1 + 14 files changed, 4100 insertions(+), 532 deletions(-) diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index cc94cb3c9b33a..39556ed85f37a 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -979,13 +979,11 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, llvm::APInt lhs_val = GetIntAtSuitableWidth(context, lhs_bit_width_id, lhs.int_id); const auto& rhs_orig_val = context.ints().Get(rhs.int_id); - if ((lhs_bit_width_id.is_valid() && - rhs_orig_val.uge(lhs_val.getBitWidth())) || - (rhs_orig_val.isNegative() && - context.sem_ir().types().IsSignedInt(rhs.type_id))) { + if (lhs_bit_width_id.is_valid() && + rhs_orig_val.uge(lhs_val.getBitWidth())) { CARBON_DIAGNOSTIC( CompileTimeShiftOutOfRange, Error, - "shift distance not in range [0, {0}) in {1} {2:<<|>>} {3}", + "shift distance >= type width of {0} in `{1} {2:<<|>>} {3}`", unsigned, TypedInt, BoolAsSelect, TypedInt); context.emitter().Emit( loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), @@ -996,9 +994,23 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, return SemIR::ErrorInst::SingletonConstantId; } + if (rhs_orig_val.isNegative() && + context.sem_ir().types().IsSignedInt(rhs.type_id)) { + CARBON_DIAGNOSTIC(CompileTimeShiftNegative, Error, + "shift distance negative in `{0} {1:<<|>>} {2}`", + TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftNegative, + {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + llvm::APInt result_val; if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { - if (!lhs_bit_width_id.is_valid()) { + if (!lhs_bit_width_id.is_valid() && !lhs_val.isZero()) { // Ensure we don't generate a ridiculously large integer through a bit // shift. auto width = rhs_orig_val.trySExtValue(); @@ -1062,7 +1074,7 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, if (result.overflow) { CARBON_DIAGNOSTIC(CompileTimeIntegerOverflow, Error, - "integer overflow in calculation {0} {1} {2}", TypedInt, + "integer overflow in calculation `{0} {1} {2}`", TypedInt, Lex::TokenKind, TypedInt); context.emitter().Emit(loc, CompileTimeIntegerOverflow, {.type = lhs.type_id, .value = lhs_val}, diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index be154cb47204f..9cf404b1c7bf0 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -10,6 +10,8 @@ // --- int_and.carbon +library "[[@TEST_NAME]]"; + fn And(a: i32, b: i32) -> i32 = "int.and"; var arr: [i32; And(12, 10)]; @@ -19,6 +21,35 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { return And(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +var arr_lit: [i32; AndLit(12, 10)]; +let arr_lit_p: [i32; 8]* = &arr_lit; + +// & between a positive and negative literal should produce a positive value. +var arr_lit_large: [i32; AndLit(0x8000_0000_0000_0000, -1) >> 48]*; +let arr_lit_large_p: [i32; 0x8000]* = arr_lit_large; + +// --- fail_literal_runtime.carbon + +library "[[@TEST_NAME]]"; + +fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+6]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: return AndLit(5, a); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return AndLit(5, a); +} + // CHECK:STDOUT: --- int_and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -78,12 +109,12 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -91,39 +122,39 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %And.ref: %And.type = name_ref And, %And.decl [template = constants.%And] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12.1] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10.1] -// CHECK:STDOUT: %impl.elem0.loc4_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_20: = bound_method %int_12, %impl.elem0.loc4_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc4_20: = specific_function %Convert.bound.loc4_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc4_20: init %i32 = call %Convert.specific_fn.loc4_20(%int_12) [template = constants.%int_12.2] -// CHECK:STDOUT: %.loc4_20.1: %i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%int_12.2] -// CHECK:STDOUT: %.loc4_20.2: %i32 = converted %int_12, %.loc4_20.1 [template = constants.%int_12.2] -// CHECK:STDOUT: %impl.elem0.loc4_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_24: = bound_method %int_10, %impl.elem0.loc4_24 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc4_24: = specific_function %Convert.bound.loc4_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc4_24: init %i32 = call %Convert.specific_fn.loc4_24(%int_10) [template = constants.%int_10.2] -// CHECK:STDOUT: %.loc4_24.1: %i32 = value_of_initializer %int.convert_checked.loc4_24 [template = constants.%int_10.2] -// CHECK:STDOUT: %.loc4_24.2: %i32 = converted %int_10, %.loc4_24.1 [template = constants.%int_10.2] -// CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%.loc4_20.2, %.loc4_24.2) [template = constants.%int_8.1] -// CHECK:STDOUT: %impl.elem0.loc4_26: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc4_26: = bound_method %int.and, %impl.elem0.loc4_26 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc4_26: = specific_function %Convert.bound.loc4_26, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc4_26.1: %i32 = value_of_initializer %int.and [template = constants.%int_8.1] -// CHECK:STDOUT: %.loc4_26.2: %i32 = converted %int.and, %.loc4_26.1 [template = constants.%int_8.1] -// CHECK:STDOUT: %int.convert_checked.loc4_26: init Core.IntLiteral = call %Convert.specific_fn.loc4_26(%.loc4_26.2) [template = constants.%int_8.2] -// CHECK:STDOUT: %.loc4_26.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_26 [template = constants.%int_8.2] -// CHECK:STDOUT: %.loc4_26.4: Core.IntLiteral = converted %int.and, %.loc4_26.3 [template = constants.%int_8.2] -// CHECK:STDOUT: %array_type.loc4: type = array_type %.loc4_26.4, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %impl.elem0.loc6_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc6_20: = bound_method %int_12, %impl.elem0.loc6_20 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc6_20: = specific_function %Convert.bound.loc6_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc6_20: init %i32 = call %Convert.specific_fn.loc6_20(%int_12) [template = constants.%int_12.2] +// CHECK:STDOUT: %.loc6_20.1: %i32 = value_of_initializer %int.convert_checked.loc6_20 [template = constants.%int_12.2] +// CHECK:STDOUT: %.loc6_20.2: %i32 = converted %int_12, %.loc6_20.1 [template = constants.%int_12.2] +// CHECK:STDOUT: %impl.elem0.loc6_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc6_24: = bound_method %int_10, %impl.elem0.loc6_24 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc6_24: = specific_function %Convert.bound.loc6_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc6_24: init %i32 = call %Convert.specific_fn.loc6_24(%int_10) [template = constants.%int_10.2] +// CHECK:STDOUT: %.loc6_24.1: %i32 = value_of_initializer %int.convert_checked.loc6_24 [template = constants.%int_10.2] +// CHECK:STDOUT: %.loc6_24.2: %i32 = converted %int_10, %.loc6_24.1 [template = constants.%int_10.2] +// CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%.loc6_20.2, %.loc6_24.2) [template = constants.%int_8.1] +// CHECK:STDOUT: %impl.elem0.loc6_26: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] +// CHECK:STDOUT: %Convert.bound.loc6_26: = bound_method %int.and, %impl.elem0.loc6_26 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc6_26: = specific_function %Convert.bound.loc6_26, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc6_26.1: %i32 = value_of_initializer %int.and [template = constants.%int_8.1] +// CHECK:STDOUT: %.loc6_26.2: %i32 = converted %int.and, %.loc6_26.1 [template = constants.%int_8.1] +// CHECK:STDOUT: %int.convert_checked.loc6_26: init Core.IntLiteral = call %Convert.specific_fn.loc6_26(%.loc6_26.2) [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc6_26.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc6_26.4: Core.IntLiteral = converted %int.and, %.loc6_26.3 [template = constants.%int_8.2] +// CHECK:STDOUT: %array_type.loc6: type = array_type %.loc6_26.4, %i32 [template = constants.%array_type] // CHECK:STDOUT: %arr.var: ref %array_type = var arr // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %int_8, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %array_type.loc7: type = array_type %int_8, %i32 [template = constants.%array_type] // CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a @@ -133,12 +164,12 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -156,9 +187,9 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.and -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.and, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 +// CHECK:STDOUT: %.loc10_19.1: %i32 = value_of_initializer %int.and +// CHECK:STDOUT: %.loc10_19.2: %i32 = converted %int.and, %.loc10_19.1 +// CHECK:STDOUT: return %.loc10_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -169,3 +200,241 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %AndLit.type: type = fn_type @AndLit [template] +// CHECK:STDOUT: %AndLit: %AndLit.type = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %array_type.1: type = array_type %int_8, %i32 [template] +// CHECK:STDOUT: %ptr.1: type = ptr_type %array_type.1 [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %int_48: Core.IntLiteral = int_value 48 [template] +// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %Op.type.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %Op.4: %Op.type.4 = struct_value () [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%Op.4) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_9223372036854775808, %Op.4 [template] +// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template] +// CHECK:STDOUT: %array_type.2: type = array_type %int_32768, %i32 [template] +// CHECK:STDOUT: %ptr.2: type = ptr_type %array_type.2 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.6 +// CHECK:STDOUT: .RightShift = %import_ref.44 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .AndLit = %AndLit.decl +// CHECK:STDOUT: .arr_lit = %arr_lit +// CHECK:STDOUT: .arr_lit_p = @__global_init.%arr_lit_p +// CHECK:STDOUT: .arr_lit_large = %arr_lit_large +// CHECK:STDOUT: .arr_lit_large_p = @__global_init.%arr_lit_large_p +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %AndLit.decl: %AndLit.type = fn_decl @AndLit [template = constants.%AndLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_58: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_62: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_74: init type = call %IntLiteral.ref.loc4_62() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_74.1: type = value_of_initializer %int_literal.make_type.loc4_74 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_74.2: type = converted %int_literal.make_type.loc4_74, %.loc4_74.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %AndLit.ref.loc6: %AndLit.type = name_ref AndLit, %AndLit.decl [template = constants.%AndLit] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %int.and.loc6: init Core.IntLiteral = call %AndLit.ref.loc6(%int_12, %int_10) [template = constants.%int_8] +// CHECK:STDOUT: %.loc6_33.1: Core.IntLiteral = value_of_initializer %int.and.loc6 [template = constants.%int_8] +// CHECK:STDOUT: %.loc6_33.2: Core.IntLiteral = converted %int.and.loc6, %.loc6_33.1 [template = constants.%int_8] +// CHECK:STDOUT: %array_type.loc6: type = array_type %.loc6_33.2, %i32 [template = constants.%array_type.1] +// CHECK:STDOUT: %arr_lit.var: ref %array_type.1 = var arr_lit +// CHECK:STDOUT: %arr_lit: ref %array_type.1 = bind_name arr_lit, %arr_lit.var +// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8] +// CHECK:STDOUT: %array_type.loc7: type = array_type %int_8, %i32 [template = constants.%array_type.1] +// CHECK:STDOUT: %ptr.loc7: type = ptr_type %array_type.1 [template = constants.%ptr.1] +// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %AndLit.ref.loc10: %AndLit.type = name_ref AndLit, %AndLit.decl [template = constants.%AndLit] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc10_56: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc10_56: = bound_method %int_1, %impl.elem0.loc10_56 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound.loc10_56(%int_1) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_56.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_56.2: Core.IntLiteral = converted %int.snegate, %.loc10_56.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.and.loc10: init Core.IntLiteral = call %AndLit.ref.loc10(%int_9223372036854775808, %.loc10_56.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int_48: Core.IntLiteral = int_value 48 [template = constants.%int_48] +// CHECK:STDOUT: %impl.elem0.loc10_60: %Op.type.3 = interface_witness_access constants.%interface.2, element0 [template = constants.%Op.4] +// CHECK:STDOUT: %Op.bound.loc10_60: = bound_method %int.and.loc10, %impl.elem0.loc10_60 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %.loc10_58.1: Core.IntLiteral = value_of_initializer %int.and.loc10 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc10_58.2: Core.IntLiteral = converted %int.and.loc10, %.loc10_58.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int.right_shift: init Core.IntLiteral = call %Op.bound.loc10_60(%.loc10_58.2, %int_48) [template = constants.%int_32768] +// CHECK:STDOUT: %.loc10_60.1: Core.IntLiteral = value_of_initializer %int.right_shift [template = constants.%int_32768] +// CHECK:STDOUT: %.loc10_60.2: Core.IntLiteral = converted %int.right_shift, %.loc10_60.1 [template = constants.%int_32768] +// CHECK:STDOUT: %array_type.loc10: type = array_type %.loc10_60.2, %i32 [template = constants.%array_type.2] +// CHECK:STDOUT: %ptr.loc10: type = ptr_type %array_type.2 [template = constants.%ptr.2] +// CHECK:STDOUT: %arr_lit_large.var: ref %ptr.2 = var arr_lit_large +// CHECK:STDOUT: %arr_lit_large: ref %ptr.2 = bind_name arr_lit_large, %arr_lit_large.var +// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768] +// CHECK:STDOUT: %array_type.loc11: type = array_type %int_32768, %i32 [template = constants.%array_type.2] +// CHECK:STDOUT: %ptr.loc11: type = ptr_type %array_type.2 [template = constants.%ptr.2] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @AndLit(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %arr_lit.ref: ref %array_type.1 = name_ref arr_lit, file.%arr_lit +// CHECK:STDOUT: %addr: %ptr.1 = addr_of %arr_lit.ref +// CHECK:STDOUT: %arr_lit_p: %ptr.1 = bind_name arr_lit_p, %addr +// CHECK:STDOUT: %arr_lit_large.ref: ref %ptr.2 = name_ref arr_lit_large, file.%arr_lit_large +// CHECK:STDOUT: %.loc11: %ptr.2 = bind_value %arr_lit_large.ref +// CHECK:STDOUT: %arr_lit_large_p: %ptr.2 = bind_name arr_lit_large_p, %.loc11 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_literal_runtime.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %AndLit.type: type = fn_type @AndLit [template] +// CHECK:STDOUT: %AndLit: %AndLit.type = struct_value () [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .AndLit = %AndLit.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %AndLit.decl: %AndLit.type = fn_decl @AndLit [template = constants.%AndLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_58: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_62: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_74: init type = call %IntLiteral.ref.loc4_62() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_74.1: type = value_of_initializer %int_literal.make_type.loc4_74 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_74.2: type = converted %int_literal.make_type.loc4_74, %.loc4_74.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc6_9: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc6_13: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc6_25: init type = call %IntLiteral.ref.loc6_13() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int_literal.make_type.loc6_25 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_25.2: type = converted %int_literal.make_type.loc6_25, %.loc6_25.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc6_31: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc6_35: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc6_47: init type = call %IntLiteral.ref.loc6_35() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_47.1: type = value_of_initializer %int_literal.make_type.loc6_47 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_47.2: type = converted %int_literal.make_type.loc6_47, %.loc6_47.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @AndLit(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %AndLit.ref: %AndLit.type = name_ref AndLit, file.%AndLit.decl [template = constants.%AndLit] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %a.ref: Core.IntLiteral = name_ref a, %a +// CHECK:STDOUT: %int.and: init Core.IntLiteral = call %AndLit.ref(%int_5, %a.ref) +// CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = value_of_initializer %int.and +// CHECK:STDOUT: %.loc13_22.2: Core.IntLiteral = converted %int.and, %.loc13_22.1 +// CHECK:STDOUT: return %.loc13_22.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index 7ab8b08777fc6..741cca8b5ab9f 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -10,6 +10,8 @@ // --- int_complement.carbon +library "[[@TEST_NAME]]"; + fn Complement(a: i32) -> i32 = "int.complement"; fn And(a: i32, b: i32) -> i32 = "int.and"; @@ -20,6 +22,41 @@ fn RuntimeCall(a: i32) -> i32 { return Complement(a); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Complement(0)) as Expect(-1); + Test(Complement(1)) as Expect(-2); + Test(Complement(-1)) as Expect(0); + Test(Complement(-0x7FFF_FFFF_FFFF_FFFF)) as Expect(0x7FFF_FFFF_FFFF_FFFE); + Test(Complement(-0x8000_0000_0000_0000)) as Expect(0x7FFF_FFFF_FFFF_FFFF); + Test(Complement(0x7FFF_FFFF_FFFF_FFFF)) as Expect(-0x8000_0000_0000_0000); + Test(Complement(0x8000_0000_0000_0000)) as Expect(-0x8000_0000_0000_0001); +} + +// --- fail_literal_runtime.carbon + +library "[[@TEST_NAME]]"; + +fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + +fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+6]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: return Complement(a); + // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Complement(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.complement"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return Complement(a); +} + // CHECK:STDOUT: --- int_complement.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -81,10 +118,10 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 @@ -98,12 +135,12 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc3_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc3_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -111,43 +148,43 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %And.ref: %And.type = name_ref And, %And.decl [template = constants.%And] // CHECK:STDOUT: %Complement.ref: %Complement.type = name_ref Complement, %Complement.decl [template = constants.%Complement] // CHECK:STDOUT: %int_1193046: Core.IntLiteral = int_value 1193046 [template = constants.%int_1193046.1] -// CHECK:STDOUT: %impl.elem0.loc5_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5_31: = bound_method %int_1193046, %impl.elem0.loc5_31 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc5_31: = specific_function %Convert.bound.loc5_31, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc5_31: init %i32 = call %Convert.specific_fn.loc5_31(%int_1193046) [template = constants.%int_1193046.2] -// CHECK:STDOUT: %.loc5_31.1: %i32 = value_of_initializer %int.convert_checked.loc5_31 [template = constants.%int_1193046.2] -// CHECK:STDOUT: %.loc5_31.2: %i32 = converted %int_1193046, %.loc5_31.1 [template = constants.%int_1193046.2] -// CHECK:STDOUT: %int.complement: init %i32 = call %Complement.ref(%.loc5_31.2) [template = constants.%int_-1193047] +// CHECK:STDOUT: %impl.elem0.loc7_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc7_31: = bound_method %int_1193046, %impl.elem0.loc7_31 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc7_31: = specific_function %Convert.bound.loc7_31, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc7_31: init %i32 = call %Convert.specific_fn.loc7_31(%int_1193046) [template = constants.%int_1193046.2] +// CHECK:STDOUT: %.loc7_31.1: %i32 = value_of_initializer %int.convert_checked.loc7_31 [template = constants.%int_1193046.2] +// CHECK:STDOUT: %.loc7_31.2: %i32 = converted %int_1193046, %.loc7_31.1 [template = constants.%int_1193046.2] +// CHECK:STDOUT: %int.complement: init %i32 = call %Complement.ref(%.loc7_31.2) [template = constants.%int_-1193047] // CHECK:STDOUT: %int_16777215: Core.IntLiteral = int_value 16777215 [template = constants.%int_16777215.1] -// CHECK:STDOUT: %.loc5_39.1: %i32 = value_of_initializer %int.complement [template = constants.%int_-1193047] -// CHECK:STDOUT: %.loc5_39.2: %i32 = converted %int.complement, %.loc5_39.1 [template = constants.%int_-1193047] -// CHECK:STDOUT: %impl.elem0.loc5_42: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc5_42: = bound_method %int_16777215, %impl.elem0.loc5_42 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc5_42: = specific_function %Convert.bound.loc5_42, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc5_42: init %i32 = call %Convert.specific_fn.loc5_42(%int_16777215) [template = constants.%int_16777215.2] -// CHECK:STDOUT: %.loc5_42.1: %i32 = value_of_initializer %int.convert_checked.loc5_42 [template = constants.%int_16777215.2] -// CHECK:STDOUT: %.loc5_42.2: %i32 = converted %int_16777215, %.loc5_42.1 [template = constants.%int_16777215.2] -// CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%.loc5_39.2, %.loc5_42.2) [template = constants.%int_15584169.1] -// CHECK:STDOUT: %impl.elem0.loc5_50: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc5_50: = bound_method %int.and, %impl.elem0.loc5_50 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc5_50: = specific_function %Convert.bound.loc5_50, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc5_50.1: %i32 = value_of_initializer %int.and [template = constants.%int_15584169.1] -// CHECK:STDOUT: %.loc5_50.2: %i32 = converted %int.and, %.loc5_50.1 [template = constants.%int_15584169.1] -// CHECK:STDOUT: %int.convert_checked.loc5_50: init Core.IntLiteral = call %Convert.specific_fn.loc5_50(%.loc5_50.2) [template = constants.%int_15584169.2] -// CHECK:STDOUT: %.loc5_50.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc5_50 [template = constants.%int_15584169.2] -// CHECK:STDOUT: %.loc5_50.4: Core.IntLiteral = converted %int.and, %.loc5_50.3 [template = constants.%int_15584169.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %.loc5_50.4, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %.loc7_39.1: %i32 = value_of_initializer %int.complement [template = constants.%int_-1193047] +// CHECK:STDOUT: %.loc7_39.2: %i32 = converted %int.complement, %.loc7_39.1 [template = constants.%int_-1193047] +// CHECK:STDOUT: %impl.elem0.loc7_42: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc7_42: = bound_method %int_16777215, %impl.elem0.loc7_42 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc7_42: = specific_function %Convert.bound.loc7_42, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc7_42: init %i32 = call %Convert.specific_fn.loc7_42(%int_16777215) [template = constants.%int_16777215.2] +// CHECK:STDOUT: %.loc7_42.1: %i32 = value_of_initializer %int.convert_checked.loc7_42 [template = constants.%int_16777215.2] +// CHECK:STDOUT: %.loc7_42.2: %i32 = converted %int_16777215, %.loc7_42.1 [template = constants.%int_16777215.2] +// CHECK:STDOUT: %int.and: init %i32 = call %And.ref(%.loc7_39.2, %.loc7_42.2) [template = constants.%int_15584169.1] +// CHECK:STDOUT: %impl.elem0.loc7_50: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] +// CHECK:STDOUT: %Convert.bound.loc7_50: = bound_method %int.and, %impl.elem0.loc7_50 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc7_50: = specific_function %Convert.bound.loc7_50, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc7_50.1: %i32 = value_of_initializer %int.and [template = constants.%int_15584169.1] +// CHECK:STDOUT: %.loc7_50.2: %i32 = converted %int.and, %.loc7_50.1 [template = constants.%int_15584169.1] +// CHECK:STDOUT: %int.convert_checked.loc7_50: init Core.IntLiteral = call %Convert.specific_fn.loc7_50(%.loc7_50.2) [template = constants.%int_15584169.2] +// CHECK:STDOUT: %.loc7_50.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc7_50 [template = constants.%int_15584169.2] +// CHECK:STDOUT: %.loc7_50.4: Core.IntLiteral = converted %int.and, %.loc7_50.3 [template = constants.%int_15584169.2] +// CHECK:STDOUT: %array_type.loc7: type = array_type %.loc7_50.4, %i32 [template = constants.%array_type] // CHECK:STDOUT: %arr.var: ref %array_type = var arr // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %int_15584169: Core.IntLiteral = int_value 15584169 [template = constants.%int_15584169.2] -// CHECK:STDOUT: %array_type.loc6: type = array_type %int_15584169, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %array_type.loc8: type = array_type %int_15584169, %i32 [template = constants.%array_type] // CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a @@ -155,10 +192,10 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc8_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc8_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc8_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc10_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc10_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc10_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc10_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 @@ -175,9 +212,9 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: %Complement.ref: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %int.complement: init %i32 = call %Complement.ref(%a.ref) -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.complement -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int.complement, %.loc9_23.1 -// CHECK:STDOUT: return %.loc9_23.2 +// CHECK:STDOUT: %.loc11_23.1: %i32 = value_of_initializer %int.complement +// CHECK:STDOUT: %.loc11_23.2: %i32 = converted %int.complement, %.loc11_23.1 +// CHECK:STDOUT: return %.loc11_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -188,3 +225,524 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Complement.type: type = fn_type @Complement [template] +// CHECK:STDOUT: %Complement: %Complement.type = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_-1) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_-2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_-2) [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2, %Op.2 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_0) [template] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_9223372036854775807, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775807: Core.IntLiteral = int_value -9223372036854775807 [template] +// CHECK:STDOUT: %int_9223372036854775806: Core.IntLiteral = int_value 9223372036854775806 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_9223372036854775806) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_9223372036854775806) [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_9223372036854775808, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_9223372036854775807) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_9223372036854775807) [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_-9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_-9223372036854775808) [template] +// CHECK:STDOUT: %int_-9223372036854775809: Core.IntLiteral = int_value -9223372036854775809 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_-9223372036854775809) [template] +// CHECK:STDOUT: %Test.specific_fn.7: = specific_function %Test, @Test(%int_-9223372036854775809) [template] +// CHECK:STDOUT: %int_9223372036854775809: Core.IntLiteral = int_value 9223372036854775809 [template] +// CHECK:STDOUT: %Op.bound.5: = bound_method %int_9223372036854775809, %Op.2 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.8: %Expect.8 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Complement = %Complement.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Complement.decl: %Complement.type = fn_decl @Complement [template = constants.%Complement] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_18: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_22: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_34: init type = call %IntLiteral.ref.loc4_22() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.1: type = value_of_initializer %int_literal.make_type.loc4_34 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.2: type = converted %int_literal.make_type.loc4_34, %.loc4_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_40: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_44: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_56: init type = call %IntLiteral.ref.loc4_44() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.1: type = value_of_initializer %int_literal.make_type.loc4_56 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.2: type = converted %int_literal.make_type.loc4_56, %.loc4_56.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Complement(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc10: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_0.loc10: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.complement.loc10: init Core.IntLiteral = call %Complement.ref.loc10(%int_0.loc10) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_21.1: Core.IntLiteral = value_of_initializer %int.complement.loc10 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_21.2: Core.IntLiteral = converted %int.complement.loc10, %.loc10_21.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_21.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_21.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc10: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc10: = bound_method %int_1.loc10, %impl.elem0.loc10 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc10: init Core.IntLiteral = call %Op.bound.loc10(%int_1.loc10) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc10 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_35.2: Core.IntLiteral = converted %int.snegate.loc10, %.loc10_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_21.4: ref %Expect.2 = temporary %.loc10_21.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc11: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.complement.loc11: init Core.IntLiteral = call %Complement.ref.loc11(%int_1.loc11) [template = constants.%int_-2] +// CHECK:STDOUT: %.loc11_21.1: Core.IntLiteral = value_of_initializer %int.complement.loc11 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc11_21.2: Core.IntLiteral = converted %int.complement.loc11, %.loc11_21.1 [template = constants.%int_-2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_-2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_21.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_21.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %impl.elem0.loc11: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc11: = bound_method %int_2, %impl.elem0.loc11 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc11: init Core.IntLiteral = call %Op.bound.loc11(%int_2) [template = constants.%int_-2] +// CHECK:STDOUT: %.loc11_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc11 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc11_35.2: Core.IntLiteral = converted %int.snegate.loc11, %.loc11_35.1 [template = constants.%int_-2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_-2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_21.4: ref %Expect.3 = temporary %.loc11_21.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc12: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12: = bound_method %int_1.loc12, %impl.elem0.loc12 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc12: init Core.IntLiteral = call %Op.bound.loc12(%int_1.loc12) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_19.2: Core.IntLiteral = converted %int.snegate.loc12, %.loc12_19.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.complement.loc12: init Core.IntLiteral = call %Complement.ref.loc12(%.loc12_19.2) [template = constants.%int_0] +// CHECK:STDOUT: %.loc12_22.1: Core.IntLiteral = value_of_initializer %int.complement.loc12 [template = constants.%int_0] +// CHECK:STDOUT: %.loc12_22.2: Core.IntLiteral = converted %int.complement.loc12, %.loc12_22.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_0) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc12_22.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.4 = call %Test.specific_fn.loc12() to %.loc12_22.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc12_22.4: ref %Expect.4 = temporary %.loc12_22.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc13: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_9223372036854775807.loc13: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %impl.elem0.loc13: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13: = bound_method %int_9223372036854775807.loc13, %impl.elem0.loc13 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc13: init Core.IntLiteral = call %Op.bound.loc13(%int_9223372036854775807.loc13) [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %.loc13_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13 [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %.loc13_19.2: Core.IntLiteral = converted %int.snegate.loc13, %.loc13_19.1 [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %int.complement.loc13: init Core.IntLiteral = call %Complement.ref.loc13(%.loc13_19.2) [template = constants.%int_9223372036854775806] +// CHECK:STDOUT: %.loc13_42.1: Core.IntLiteral = value_of_initializer %int.complement.loc13 [template = constants.%int_9223372036854775806] +// CHECK:STDOUT: %.loc13_42.2: Core.IntLiteral = converted %int.complement.loc13, %.loc13_42.1 [template = constants.%int_9223372036854775806] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_9223372036854775806) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc13_42.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.5 = call %Test.specific_fn.loc13() to %.loc13_42.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775806: Core.IntLiteral = int_value 9223372036854775806 [template = constants.%int_9223372036854775806] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_9223372036854775806) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc13_42.4: ref %Expect.5 = temporary %.loc13_42.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc14: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_9223372036854775808.loc14: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc14: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14: = bound_method %int_9223372036854775808.loc14, %impl.elem0.loc14 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc14: init Core.IntLiteral = call %Op.bound.loc14(%int_9223372036854775808.loc14) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc14_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc14_19.2: Core.IntLiteral = converted %int.snegate.loc14, %.loc14_19.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.complement.loc14: init Core.IntLiteral = call %Complement.ref.loc14(%.loc14_19.2) [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %.loc14_42.1: Core.IntLiteral = value_of_initializer %int.complement.loc14 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %.loc14_42.2: Core.IntLiteral = converted %int.complement.loc14, %.loc14_42.1 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_9223372036854775807) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc14_42.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.6 = call %Test.specific_fn.loc14() to %.loc14_42.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775807.loc14: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_9223372036854775807) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc14_42.4: ref %Expect.6 = temporary %.loc14_42.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc15: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_9223372036854775807.loc15: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int.complement.loc15: init Core.IntLiteral = call %Complement.ref.loc15(%int_9223372036854775807.loc15) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc15_41.1: Core.IntLiteral = value_of_initializer %int.complement.loc15 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc15_41.2: Core.IntLiteral = converted %int.complement.loc15, %.loc15_41.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-9223372036854775808) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc15_41.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.7 = call %Test.specific_fn.loc15() to %.loc15_41.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc15: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc15: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int_9223372036854775808.loc15, %impl.elem0.loc15 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc15: init Core.IntLiteral = call %Op.bound.loc15(%int_9223372036854775808.loc15) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc15_75.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc15_75.2: Core.IntLiteral = converted %int.snegate.loc15, %.loc15_75.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-9223372036854775808) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc15_41.4: ref %Expect.7 = temporary %.loc15_41.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Complement.ref.loc16: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %int_9223372036854775808.loc16: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int.complement.loc16: init Core.IntLiteral = call %Complement.ref.loc16(%int_9223372036854775808.loc16) [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc16_41.1: Core.IntLiteral = value_of_initializer %int.complement.loc16 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc16_41.2: Core.IntLiteral = converted %int.complement.loc16, %.loc16_41.1 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_-9223372036854775809) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc16_41.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.8 = call %Test.specific_fn.loc16() to %.loc16_41.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775809: Core.IntLiteral = int_value 9223372036854775809 [template = constants.%int_9223372036854775809] +// CHECK:STDOUT: %impl.elem0.loc16: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16: = bound_method %int_9223372036854775809, %impl.elem0.loc16 [template = constants.%Op.bound.5] +// CHECK:STDOUT: %int.snegate.loc16: init Core.IntLiteral = call %Op.bound.loc16(%int_9223372036854775809) [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc16_75.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc16_75.2: Core.IntLiteral = converted %int.snegate.loc16, %.loc16_75.1 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_-9223372036854775809) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc16_41.4: ref %Expect.8 = temporary %.loc16_41.3, %Test.call.loc16 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-2 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775806) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775806 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775806 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775806) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775806 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775806 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775807) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775807 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775807 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775807) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775807 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775807 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-9223372036854775809) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-9223372036854775809) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_literal_runtime.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Complement.type: type = fn_type @Complement [template] +// CHECK:STDOUT: %Complement: %Complement.type = struct_value () [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Complement = %Complement.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Complement.decl: %Complement.type = fn_decl @Complement [template = constants.%Complement] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_18: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_22: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_34: init type = call %IntLiteral.ref.loc4_22() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.1: type = value_of_initializer %int_literal.make_type.loc4_34 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.2: type = converted %int_literal.make_type.loc4_34, %.loc4_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_40: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_44: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_56: init type = call %IntLiteral.ref.loc4_44() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.1: type = value_of_initializer %int_literal.make_type.loc4_56 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.2: type = converted %int_literal.make_type.loc4_56, %.loc4_56.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc6_9: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc6_13: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc6_25: init type = call %IntLiteral.ref.loc6_13() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int_literal.make_type.loc6_25 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_25.2: type = converted %int_literal.make_type.loc6_25, %.loc6_25.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc6_31: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc6_35: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc6_47: init type = call %IntLiteral.ref.loc6_35() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_47.1: type = value_of_initializer %int_literal.make_type.loc6_47 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_47.2: type = converted %int_literal.make_type.loc6_47, %.loc6_47.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Complement(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Complement.ref: %Complement.type = name_ref Complement, file.%Complement.decl [template = constants.%Complement] +// CHECK:STDOUT: %a.ref: Core.IntLiteral = name_ref a, %a +// CHECK:STDOUT: %int.complement: init Core.IntLiteral = call %Complement.ref(%a.ref) +// CHECK:STDOUT: %.loc13_23.1: Core.IntLiteral = value_of_initializer %int.complement +// CHECK:STDOUT: %.loc13_23.2: Core.IntLiteral = converted %int.complement, %.loc13_23.1 +// CHECK:STDOUT: return %.loc13_23.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index d8a3614bad6ea..5b7b7d891094c 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -10,6 +10,8 @@ // --- int_eq.carbon +library "[[@TEST_NAME]]"; + fn Eq(a: i32, b: i32) -> bool = "int.eq"; class True {} @@ -33,6 +35,38 @@ package FailBadDecl; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(Eq(5, 5)) as Expect(true); + Test(Eq(5, 6)) as Expect(false); + Test(Eq(-1, -1)) as Expect(true); + Test(Eq(-1, 1)) as Expect(false); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: i32) -> bool = "int.eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(Eq(5, 5)) as Expect(true); + Test(Eq(5, 6)) as Expect(false); + Test(Eq(-1, -1)) as Expect(true); + Test(Eq(-1, 1)) as Expect(false); +} + // CHECK:STDOUT: --- int_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -94,13 +128,13 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_10: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc2_26.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_26.2: type = converted %bool.make_type, %.loc2_26.1 [template = bool] +// CHECK:STDOUT: %.loc4_26.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_26.2: type = converted %bool.make_type, %.loc4_26.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -116,8 +150,8 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ // CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %True.ref.loc7: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %False.ref.loc7: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 // CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param // CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 @@ -131,13 +165,13 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc12_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc12_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc12_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_35.2: type = converted %bool.make_type, %.loc12_35.1 [template = bool] +// CHECK:STDOUT: %.loc14_35.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc14_35.2: type = converted %bool.make_type, %.loc14_35.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -168,67 +202,67 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: %True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %int_1.loc8_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc8_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc8_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_19: = bound_method %int_1.loc8_19, %impl.elem0.loc8_19 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_19: = specific_function %Convert.bound.loc8_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_19: init %i32 = call %Convert.specific_fn.loc8_19(%int_1.loc8_19) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.convert_checked.loc8_19 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int_1.loc8_19, %.loc8_19.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_22: = bound_method %int_1.loc8_22, %impl.elem0.loc8_22 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_22: = specific_function %Convert.bound.loc8_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_22: init %i32 = call %Convert.specific_fn.loc8_22(%int_1.loc8_22) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_22.1: %i32 = value_of_initializer %int.convert_checked.loc8_22 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_22.2: %i32 = converted %int_1.loc8_22, %.loc8_22.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19.2, %.loc8_22.2) [template = constants.%true] -// CHECK:STDOUT: %.loc8_13.1: bool = value_of_initializer %int.eq.loc8 [template = constants.%true] -// CHECK:STDOUT: %.loc8_13.2: bool = converted %int.eq.loc8, %.loc8_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc8_13.2 br !if.expr.then.loc8 else br !if.expr.else.loc8 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8: -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc8(%True.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8: -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc8(%False.ref.loc8) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8: -// CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] +// CHECK:STDOUT: %Eq.ref.loc10: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc10_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc10_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc10_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_19: = bound_method %int_1.loc10_19, %impl.elem0.loc10_19 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_19: = specific_function %Convert.bound.loc10_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_19: init %i32 = call %Convert.specific_fn.loc10_19(%int_1.loc10_19) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc10_19.1: %i32 = value_of_initializer %int.convert_checked.loc10_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc10_19.2: %i32 = converted %int_1.loc10_19, %.loc10_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc10_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_22: = bound_method %int_1.loc10_22, %impl.elem0.loc10_22 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_22: = specific_function %Convert.bound.loc10_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_22: init %i32 = call %Convert.specific_fn.loc10_22(%int_1.loc10_22) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc10_22.1: %i32 = value_of_initializer %int.convert_checked.loc10_22 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc10_22.2: %i32 = converted %int_1.loc10_22, %.loc10_22.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.eq.loc10: init bool = call %Eq.ref.loc10(%.loc10_19.2, %.loc10_22.2) [template = constants.%true] +// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.eq.loc10, %.loc10_13.1 [template = constants.%true] +// CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc10: +// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc10: +// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc10: +// CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref: %False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %Eq.ref.loc11: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_20: = bound_method %int_1.loc9, %impl.elem0.loc9_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_20: = specific_function %Convert.bound.loc9_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_20: init %i32 = call %Convert.specific_fn.loc9_20(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.1: %i32 = value_of_initializer %int.convert_checked.loc9_20 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_20.2: %i32 = converted %int_1.loc9, %.loc9_20.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_23: = bound_method %int_2, %impl.elem0.loc9_23 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_23: = specific_function %Convert.bound.loc9_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_23: init %i32 = call %Convert.specific_fn.loc9_23(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int_2, %.loc9_23.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20.2, %.loc9_23.2) [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.eq.loc9 [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.eq.loc9, %.loc9_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] +// CHECK:STDOUT: %impl.elem0.loc11_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_20: = bound_method %int_1.loc11, %impl.elem0.loc11_20 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_20: = specific_function %Convert.bound.loc11_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_20: init %i32 = call %Convert.specific_fn.loc11_20(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_20.1: %i32 = value_of_initializer %int.convert_checked.loc11_20 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_20.2: %i32 = converted %int_1.loc11, %.loc11_20.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_23: = bound_method %int_2, %impl.elem0.loc11_23 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_23: = specific_function %Convert.bound.loc11_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_23: init %i32 = call %Convert.specific_fn.loc11_23(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_23.1: %i32 = value_of_initializer %int.convert_checked.loc11_23 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_23.2: %i32 = converted %int_2, %.loc11_23.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.eq.loc11: init bool = call %Eq.ref.loc11(%.loc11_20.2, %.loc11_23.2) [template = constants.%false] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.eq.loc11, %.loc11_14.1 [template = constants.%false] +// CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc11: +// CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc11(%True.ref.loc11) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc11: +// CHECK:STDOUT: %False.ref.loc11: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc11: +// CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -238,9 +272,9 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.eq: init bool = call %Eq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc13_18.1: bool = value_of_initializer %int.eq -// CHECK:STDOUT: %.loc13_18.2: bool = converted %int.eq, %.loc13_18.1 -// CHECK:STDOUT: return %.loc13_18.2 +// CHECK:STDOUT: %.loc15_18.1: bool = value_of_initializer %int.eq +// CHECK:STDOUT: %.loc15_18.2: bool = converted %int.eq, %.loc15_18.1 +// CHECK:STDOUT: return %.loc15_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon @@ -291,3 +325,602 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @WrongResult(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32; // CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %Eq.type: type = fn_type @Eq [template] +// CHECK:STDOUT: %Eq: %Eq.type = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.3 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eq = %Eq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eq.decl: %Eq.type = fn_decl @Eq [template = constants.%Eq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_10: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_14: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_26: init type = call %IntLiteral.ref.loc4_14() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.1: type = value_of_initializer %int_literal.make_type.loc4_26 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.2: type = converted %int_literal.make_type.loc4_26, %.loc4_26.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_32: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_36: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_48: init type = call %IntLiteral.ref.loc4_36() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_48.1: type = value_of_initializer %int_literal.make_type.loc4_48 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_48.2: type = converted %int_literal.make_type.loc4_48, %.loc4_48.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_54.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_54.2: type = converted %bool.make_type, %.loc4_54.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Eq(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> bool = "int.eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc10: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_5.loc10_11: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_5.loc10_14: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int.eq.loc10: init bool = call %Eq.ref.loc10(%int_5.loc10_11, %int_5.loc10_14) [template = constants.%true] +// CHECK:STDOUT: %.loc10_16.1: bool = value_of_initializer %int.eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_16.2: bool = converted %int.eq.loc10, %.loc10_16.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_16.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_16.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_16.4: ref %Expect.2 = temporary %.loc10_16.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc11: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %int.eq.loc11: init bool = call %Eq.ref.loc11(%int_5.loc11, %int_6) [template = constants.%false] +// CHECK:STDOUT: %.loc11_16.1: bool = value_of_initializer %int.eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_16.2: bool = converted %int.eq.loc11, %.loc11_16.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_16.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_16.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc11: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_16.4: ref %Expect.3 = temporary %.loc11_16.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc12: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc12_12: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc12_11: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12_11: = bound_method %int_1.loc12_12, %impl.elem0.loc12_11 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc12_11: init Core.IntLiteral = call %Op.bound.loc12_11(%int_1.loc12_12) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc12_16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc12_15: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12_15: = bound_method %int_1.loc12_16, %impl.elem0.loc12_15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc12_15: init Core.IntLiteral = call %Op.bound.loc12_15(%int_1.loc12_16) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12_11 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate.loc12_11, %.loc12_11.1 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12_15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc12_15.2: Core.IntLiteral = converted %int.snegate.loc12_15, %.loc12_15.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.eq.loc12: init bool = call %Eq.ref.loc12(%.loc12_11.2, %.loc12_15.2) [template = constants.%true] +// CHECK:STDOUT: %.loc12_18.1: bool = value_of_initializer %int.eq.loc12 [template = constants.%true] +// CHECK:STDOUT: %.loc12_18.2: bool = converted %int.eq.loc12, %.loc12_18.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_18.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_18.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc12: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_18.4: ref %Expect.2 = temporary %.loc12_18.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc13: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13: = bound_method %int_1.loc13_12, %impl.elem0.loc13 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13: init Core.IntLiteral = call %Op.bound.loc13(%int_1.loc13_12) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc13_15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc13_11.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_11.2: Core.IntLiteral = converted %int.snegate.loc13, %.loc13_11.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.eq.loc13: init bool = call %Eq.ref.loc13(%.loc13_11.2, %int_1.loc13_15) [template = constants.%false] +// CHECK:STDOUT: %.loc13_17.1: bool = value_of_initializer %int.eq.loc13 [template = constants.%false] +// CHECK:STDOUT: %.loc13_17.2: bool = converted %int.eq.loc13, %.loc13_17.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc13_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.3 = call %Test.specific_fn.loc13() to %.loc13_17.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc13: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc13_17.4: ref %Expect.3 = temporary %.loc13_17.3, %Test.call.loc13 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- mixed.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %Eq.type.1: type = fn_type @Eq.1 [template] +// CHECK:STDOUT: %Eq: %Eq.type.1 = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6.1: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_6.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_6.2: %i32 = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Bool = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.7 +// CHECK:STDOUT: .Negate = %import_ref.231 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eq = %Eq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eq.decl: %Eq.type.1 = fn_decl @Eq.1 [template = constants.%Eq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.2: type = converted %int_literal.make_type, %.loc4_26.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_40.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_40.2: type = converted %bool.make_type, %.loc4_40.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Eq.1(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> bool = "int.eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc10: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_5.loc10_11: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_5.loc10_14: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int_5.loc10_14, %impl.elem0.loc10 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%int_5.loc10_14) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_14.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_14.2: %i32 = converted %int_5.loc10_14, %.loc10_14.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %int.eq.loc10: init bool = call %Eq.ref.loc10(%int_5.loc10_11, %.loc10_14.2) [template = constants.%true] +// CHECK:STDOUT: %.loc10_16.1: bool = value_of_initializer %int.eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_16.2: bool = converted %int.eq.loc10, %.loc10_16.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_16.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_16.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_16.4: ref %Expect.2 = temporary %.loc10_16.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc11: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6.1] +// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_6, %impl.elem0.loc11 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11: init %i32 = call %Convert.specific_fn.loc11(%int_6) [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_14.1: %i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_14.2: %i32 = converted %int_6, %.loc11_14.1 [template = constants.%int_6.2] +// CHECK:STDOUT: %int.eq.loc11: init bool = call %Eq.ref.loc11(%int_5.loc11, %.loc11_14.2) [template = constants.%false] +// CHECK:STDOUT: %.loc11_16.1: bool = value_of_initializer %int.eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_16.2: bool = converted %int.eq.loc11, %.loc11_16.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_16.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_16.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc11: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_16.4: ref %Expect.3 = temporary %.loc11_16.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc12: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc12_12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_11: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12_11: = bound_method %int_1.loc12_12, %impl.elem0.loc12_11 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc12_11: init Core.IntLiteral = call %Op.bound.loc12_11(%int_1.loc12_12) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc12_16: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_15.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12_15: = bound_method %int_1.loc12_16, %impl.elem0.loc12_15.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc12_15: init Core.IntLiteral = call %Op.bound.loc12_15(%int_1.loc12_16) [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12_11 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate.loc12_11, %.loc12_11.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc12_15.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12: = bound_method %int.snegate.loc12_15, %impl.elem0.loc12_15.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12: = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc12_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12_15 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc12_15.2: Core.IntLiteral = converted %int.snegate.loc12_15, %.loc12_15.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %Convert.specific_fn.loc12(%.loc12_15.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc12_15.3: %i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc12_15.4: %i32 = converted %int.snegate.loc12_15, %.loc12_15.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.eq.loc12: init bool = call %Eq.ref.loc12(%.loc12_11.2, %.loc12_15.4) [template = constants.%true] +// CHECK:STDOUT: %.loc12_18.1: bool = value_of_initializer %int.eq.loc12 [template = constants.%true] +// CHECK:STDOUT: %.loc12_18.2: bool = converted %int.eq.loc12, %.loc12_18.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_18.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_18.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc12: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_18.4: ref %Expect.2 = temporary %.loc12_18.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Eq.ref.loc13: %Eq.type.1 = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc13_11: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13: = bound_method %int_1.loc13_12, %impl.elem0.loc13_11 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13: init Core.IntLiteral = call %Op.bound.loc13(%int_1.loc13_12) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc13_15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %.loc13_11.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_11.2: Core.IntLiteral = converted %int.snegate.loc13, %.loc13_11.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc13_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13: = bound_method %int_1.loc13_15, %impl.elem0.loc13_15 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc13: = specific_function %Convert.bound.loc13, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc13: init %i32 = call %Convert.specific_fn.loc13(%int_1.loc13_15) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_15.1: %i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_15.2: %i32 = converted %int_1.loc13_15, %.loc13_15.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.eq.loc13: init bool = call %Eq.ref.loc13(%.loc13_11.2, %.loc13_15.2) [template = constants.%false] +// CHECK:STDOUT: %.loc13_17.1: bool = value_of_initializer %int.eq.loc13 [template = constants.%false] +// CHECK:STDOUT: %.loc13_17.2: bool = converted %int.eq.loc13, %.loc13_17.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc13_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.3 = call %Test.specific_fn.loc13() to %.loc13_17.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc13: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc13_17.4: ref %Expect.3 = temporary %.loc13_17.3, %Test.call.loc13 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index b1c2f176a697e..1d2220c3e293d 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -10,6 +10,8 @@ // --- int_greater_eq.carbon +library "[[@TEST_NAME]]"; + fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq"; fn Negate(a: i32) -> i32 = "int.snegate"; @@ -28,6 +30,42 @@ fn RuntimeCall(a: i32, b: i32) -> bool { return GreaterEq(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn GreaterEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.greater_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(GreaterEq(5, 5)) as Expect(true); + Test(GreaterEq(5, 6)) as Expect(false); + Test(GreaterEq(6, 5)) as Expect(true); + Test(GreaterEq(-1, -1)) as Expect(true); + Test(GreaterEq(-1, 1)) as Expect(false); + Test(GreaterEq(1, -1)) as Expect(true); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn GreaterEq(a: Core.IntLiteral(), b: i32) -> bool = "int.greater_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(GreaterEq(5, 5)) as Expect(true); + Test(GreaterEq(5, 6)) as Expect(false); + Test(GreaterEq(6, 5)) as Expect(true); + Test(GreaterEq(-1, -1)) as Expect(true); + Test(GreaterEq(-1, 1)) as Expect(false); + Test(GreaterEq(1, -1)) as Expect(true); +} + // CHECK:STDOUT: --- int_greater_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -97,13 +135,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc2_33.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_33.2: type = converted %bool.make_type, %.loc2_33.1 [template = bool] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_33.2: type = converted %bool.make_type, %.loc4_33.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -117,10 +155,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 @@ -134,8 +172,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ // CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 // CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param // CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 @@ -149,13 +187,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc18_35.2: type = converted %bool.make_type, %.loc18_35.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -187,88 +225,26 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %false_.ref.loc9: %False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_27: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_27: = bound_method %int_1.loc9, %impl.elem0.loc9_27 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_27: = specific_function %Convert.bound.loc9_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_27: init %i32 = call %Convert.specific_fn.loc9_27(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %int.convert_checked.loc9_27 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_1.loc9, %.loc9_27.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_30: = bound_method %int_2, %impl.elem0.loc9_30 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_30: = specific_function %Convert.bound.loc9_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_30: init %i32 = call %Convert.specific_fn.loc9_30(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_30.1: %i32 = value_of_initializer %int.convert_checked.loc9_30 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_30.2: %i32 = converted %int_2, %.loc9_30.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27.2, %.loc9_30.2) [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.1: bool = value_of_initializer %int.greater_eq.loc9 [template = constants.%false] -// CHECK:STDOUT: %.loc9_14.2: bool = converted %int.greater_eq.loc9, %.loc9_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc9_14.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] -// CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_29: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_26: = bound_method %int_1.loc10_26, %impl.elem0.loc10_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_26: = specific_function %Convert.bound.loc10_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_26: init %i32 = call %Convert.specific_fn.loc10_26(%int_1.loc10_26) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.1: %i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.2: %i32 = converted %int_1.loc10_26, %.loc10_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_29: = bound_method %int_1.loc10_29, %impl.elem0.loc10_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_29: = specific_function %Convert.bound.loc10_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_29: init %i32 = call %Convert.specific_fn.loc10_29(%int_1.loc10_29) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_29.1: %i32 = value_of_initializer %int.convert_checked.loc10_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_29.2: %i32 = converted %int_1.loc10_29, %.loc10_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26.2, %.loc10_29.2) [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.greater_eq.loc10, %.loc10_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] -// CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ +// CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ // CHECK:STDOUT: %GreaterEq.ref.loc11: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] // CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_26: = bound_method %int_1.loc11, %impl.elem0.loc11_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_26: = specific_function %Convert.bound.loc11_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_26: init %i32 = call %Convert.specific_fn.loc11_26(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_26.1: %i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_26.2: %i32 = converted %int_1.loc11, %.loc11_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_29: = bound_method %int_0.loc11, %impl.elem0.loc11_29 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_29: = specific_function %Convert.bound.loc11_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_29: init %i32 = call %Convert.specific_fn.loc11_29(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_29.1: %i32 = value_of_initializer %int.convert_checked.loc11_29 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_29.2: %i32 = converted %int_0.loc11, %.loc11_29.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26.2, %.loc11_29.2) [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%true] -// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.greater_eq.loc11, %.loc11_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc11_27: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_27: = bound_method %int_1.loc11, %impl.elem0.loc11_27 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_27: = specific_function %Convert.bound.loc11_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_27: init %i32 = call %Convert.specific_fn.loc11_27(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_1.loc11, %.loc11_27.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_30: = bound_method %int_2, %impl.elem0.loc11_30 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_30: = specific_function %Convert.bound.loc11_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_30: init %i32 = call %Convert.specific_fn.loc11_30(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_30.1: %i32 = value_of_initializer %int.convert_checked.loc11_30 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_30.2: %i32 = converted %int_2, %.loc11_30.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_27.2, %.loc11_30.2) [template = constants.%false] +// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.greater_eq.loc11, %.loc11_14.1 [template = constants.%false] +// CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: // CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] @@ -279,31 +255,27 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc12: %False = name_ref false_, %false_ +// CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] +// CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ // CHECK:STDOUT: %GreaterEq.ref.loc12: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_34: = bound_method %int_1.loc12, %impl.elem0.loc12_34 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_34: = specific_function %Convert.bound.loc12_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_34: init %i32 = call %Convert.specific_fn.loc12_34(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_34.1: %i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_34.2: %i32 = converted %int_1.loc12, %.loc12_34.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_34.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_35.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_35.2: %i32 = converted %int.snegate.loc12, %.loc12_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_38: = bound_method %int_0.loc12, %impl.elem0.loc12_38 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_38: = specific_function %Convert.bound.loc12_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_38: init %i32 = call %Convert.specific_fn.loc12_38(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_38.1: %i32 = value_of_initializer %int.convert_checked.loc12_38 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_38.2: %i32 = converted %int_0.loc12, %.loc12_38.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_35.2, %.loc12_38.2) [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%false] -// CHECK:STDOUT: %.loc12_14.2: bool = converted %int.greater_eq.loc12, %.loc12_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc12_14.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 +// CHECK:STDOUT: %int_1.loc12_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc12_29: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_26: = bound_method %int_1.loc12_26, %impl.elem0.loc12_26 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_26: = specific_function %Convert.bound.loc12_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_26: init %i32 = call %Convert.specific_fn.loc12_26(%int_1.loc12_26) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_26.1: %i32 = value_of_initializer %int.convert_checked.loc12_26 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_26.2: %i32 = converted %int_1.loc12_26, %.loc12_26.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_1.loc12_29, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_1.loc12_29) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_1.loc12_29, %.loc12_29.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%.loc12_26.2, %.loc12_29.2) [template = constants.%true] +// CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%true] +// CHECK:STDOUT: %.loc12_13.2: bool = converted %int.greater_eq.loc12, %.loc12_13.1 [template = constants.%true] +// CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc12: // CHECK:STDOUT: %True.ref.loc12: type = name_ref True, file.%True.decl [template = constants.%True] @@ -314,28 +286,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: br !if.expr.result.loc12(%False.ref.loc12) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] +// CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc13: %True = name_ref true_, %true_ // CHECK:STDOUT: %GreaterEq.ref.loc13: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_36: = bound_method %int_1.loc13, %impl.elem0.loc13_36 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_36: = specific_function %Convert.bound.loc13_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_36: init %i32 = call %Convert.specific_fn.loc13_36(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_36.1: %i32 = value_of_initializer %int.convert_checked.loc13_36 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_36.2: %i32 = converted %int_1.loc13, %.loc13_36.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_36.2) [template = constants.%int_-1] +// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] // CHECK:STDOUT: %impl.elem0.loc13_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_26: = bound_method %int_0.loc13, %impl.elem0.loc13_26 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_26: = specific_function %Convert.bound.loc13_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_26: init %i32 = call %Convert.specific_fn.loc13_26(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_26.1: %i32 = value_of_initializer %int.convert_checked.loc13_26 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_26.2: %i32 = converted %int_0.loc13, %.loc13_26.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_37.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_37.2: %i32 = converted %int.snegate.loc13, %.loc13_37.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26.2, %.loc13_37.2) [template = constants.%true] +// CHECK:STDOUT: %Convert.bound.loc13_26: = bound_method %int_1.loc13, %impl.elem0.loc13_26 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc13_26: = specific_function %Convert.bound.loc13_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc13_26: init %i32 = call %Convert.specific_fn.loc13_26(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_26.1: %i32 = value_of_initializer %int.convert_checked.loc13_26 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_26.2: %i32 = converted %int_1.loc13, %.loc13_26.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_29: = bound_method %int_0.loc13, %impl.elem0.loc13_29 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_29: = specific_function %Convert.bound.loc13_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_29: init %i32 = call %Convert.specific_fn.loc13_29(%int_0.loc13) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_29.1: %i32 = value_of_initializer %int.convert_checked.loc13_29 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_29.2: %i32 = converted %int_0.loc13, %.loc13_29.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_26.2, %.loc13_29.2) [template = constants.%true] // CHECK:STDOUT: %.loc13_13.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%true] // CHECK:STDOUT: %.loc13_13.2: bool = converted %int.greater_eq.loc13, %.loc13_13.1 [template = constants.%true] // CHECK:STDOUT: if %.loc13_13.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 @@ -350,6 +318,76 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc13: // CHECK:STDOUT: %.loc13_13.3: type = block_arg !if.expr.result.loc13 [template = constants.%True] +// CHECK:STDOUT: %false_.ref.loc14: %False = name_ref false_, %false_ +// CHECK:STDOUT: %GreaterEq.ref.loc14: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %Negate.ref.loc14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc14_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_34: = bound_method %int_1.loc14, %impl.elem0.loc14_34 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc14_34: = specific_function %Convert.bound.loc14_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc14_34: init %i32 = call %Convert.specific_fn.loc14_34(%int_1.loc14) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_34.1: %i32 = value_of_initializer %int.convert_checked.loc14_34 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_34.2: %i32 = converted %int_1.loc14, %.loc14_34.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.snegate.loc14: init %i32 = call %Negate.ref.loc14(%.loc14_34.2) [template = constants.%int_-1] +// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc14_35.1: %i32 = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc14_35.2: %i32 = converted %int.snegate.loc14, %.loc14_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %impl.elem0.loc14_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_38: = bound_method %int_0.loc14, %impl.elem0.loc14_38 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc14_38: = specific_function %Convert.bound.loc14_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc14_38: init %i32 = call %Convert.specific_fn.loc14_38(%int_0.loc14) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc14_38.1: %i32 = value_of_initializer %int.convert_checked.loc14_38 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc14_38.2: %i32 = converted %int_0.loc14, %.loc14_38.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.greater_eq.loc14: init bool = call %GreaterEq.ref.loc14(%.loc14_35.2, %.loc14_38.2) [template = constants.%false] +// CHECK:STDOUT: %.loc14_14.1: bool = value_of_initializer %int.greater_eq.loc14 [template = constants.%false] +// CHECK:STDOUT: %.loc14_14.2: bool = converted %int.greater_eq.loc14, %.loc14_14.1 [template = constants.%false] +// CHECK:STDOUT: if %.loc14_14.2 br !if.expr.then.loc14 else br !if.expr.else.loc14 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc14: +// CHECK:STDOUT: %True.ref.loc14: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc14(%True.ref.loc14) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc14: +// CHECK:STDOUT: %False.ref.loc14: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc14(%False.ref.loc14) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc14: +// CHECK:STDOUT: %.loc14_14.3: type = block_arg !if.expr.result.loc14 [template = constants.%False] +// CHECK:STDOUT: %true_.ref.loc15: %True = name_ref true_, %true_ +// CHECK:STDOUT: %GreaterEq.ref.loc15: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_0.loc15: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_36: = bound_method %int_1.loc15, %impl.elem0.loc15_36 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc15_36: = specific_function %Convert.bound.loc15_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc15_36: init %i32 = call %Convert.specific_fn.loc15_36(%int_1.loc15) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_36.1: %i32 = value_of_initializer %int.convert_checked.loc15_36 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_36.2: %i32 = converted %int_1.loc15, %.loc15_36.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.snegate.loc15: init %i32 = call %Negate.ref.loc15(%.loc15_36.2) [template = constants.%int_-1] +// CHECK:STDOUT: %impl.elem0.loc15_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_26: = bound_method %int_0.loc15, %impl.elem0.loc15_26 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15_26: = specific_function %Convert.bound.loc15_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc15_26: init %i32 = call %Convert.specific_fn.loc15_26(%int_0.loc15) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_26.1: %i32 = value_of_initializer %int.convert_checked.loc15_26 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_26.2: %i32 = converted %int_0.loc15, %.loc15_26.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_37.1: %i32 = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_37.2: %i32 = converted %int.snegate.loc15, %.loc15_37.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.greater_eq.loc15: init bool = call %GreaterEq.ref.loc15(%.loc15_26.2, %.loc15_37.2) [template = constants.%true] +// CHECK:STDOUT: %.loc15_13.1: bool = value_of_initializer %int.greater_eq.loc15 [template = constants.%true] +// CHECK:STDOUT: %.loc15_13.2: bool = converted %int.greater_eq.loc15, %.loc15_13.1 [template = constants.%true] +// CHECK:STDOUT: if %.loc15_13.2 br !if.expr.then.loc15 else br !if.expr.else.loc15 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc15: +// CHECK:STDOUT: %True.ref.loc15: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc15(%True.ref.loc15) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc15: +// CHECK:STDOUT: %False.ref.loc15: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc15(%False.ref.loc15) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc15: +// CHECK:STDOUT: %.loc15_13.3: type = block_arg !if.expr.result.loc15 [template = constants.%True] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -359,8 +397,685 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_25.1: bool = value_of_initializer %int.greater_eq -// CHECK:STDOUT: %.loc17_25.2: bool = converted %int.greater_eq, %.loc17_25.1 -// CHECK:STDOUT: return %.loc17_25.2 +// CHECK:STDOUT: %.loc19_25.1: bool = value_of_initializer %int.greater_eq +// CHECK:STDOUT: %.loc19_25.2: bool = converted %int.greater_eq, %.loc19_25.1 +// CHECK:STDOUT: return %.loc19_25.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %GreaterEq.type: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %GreaterEq: %GreaterEq.type = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.3 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .GreaterEq = %GreaterEq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %GreaterEq.decl: %GreaterEq.type = fn_decl @GreaterEq [template = constants.%GreaterEq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_33: init type = call %IntLiteral.ref.loc4_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type.loc4_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type.loc4_33, %.loc4_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_39: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_43: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_55: init type = call %IntLiteral.ref.loc4_43() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.1: type = value_of_initializer %int_literal.make_type.loc4_55 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.2: type = converted %int_literal.make_type.loc4_55, %.loc4_55.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_61.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_61.2: type = converted %bool.make_type, %.loc4_61.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @GreaterEq(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> bool = "int.greater_eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc10: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_5.loc10_18: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_5.loc10_21: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%int_5.loc10_18, %int_5.loc10_21) [template = constants.%true] +// CHECK:STDOUT: %.loc10_23.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_23.2: bool = converted %int.greater_eq.loc10, %.loc10_23.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_23.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_23.4: ref %Expect.2 = temporary %.loc10_23.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc11: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_6.loc11: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%int_5.loc11, %int_6.loc11) [template = constants.%false] +// CHECK:STDOUT: %.loc11_23.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_23.2: bool = converted %int.greater_eq.loc11, %.loc11_23.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_23.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_23.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc11: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_23.4: ref %Expect.3 = temporary %.loc11_23.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc12: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_6.loc12: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %int_5.loc12: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%int_6.loc12, %int_5.loc12) [template = constants.%true] +// CHECK:STDOUT: %.loc12_23.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%true] +// CHECK:STDOUT: %.loc12_23.2: bool = converted %int.greater_eq.loc12, %.loc12_23.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_23.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc12: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_23.4: ref %Expect.2 = temporary %.loc12_23.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc13: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc13_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_18: = bound_method %int_1.loc13_19, %impl.elem0.loc13_18 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_18: init Core.IntLiteral = call %Op.bound.loc13_18(%int_1.loc13_19) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc13_23: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13_22: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_22: = bound_method %int_1.loc13_23, %impl.elem0.loc13_22 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_22: init Core.IntLiteral = call %Op.bound.loc13_22(%int_1.loc13_23) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_18 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_18.2: Core.IntLiteral = converted %int.snegate.loc13_18, %.loc13_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_22 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_22.2: Core.IntLiteral = converted %int.snegate.loc13_22, %.loc13_22.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_18.2, %.loc13_22.2) [template = constants.%true] +// CHECK:STDOUT: %.loc13_25.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%true] +// CHECK:STDOUT: %.loc13_25.2: bool = converted %int.greater_eq.loc13, %.loc13_25.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_25.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc13: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_25.4: ref %Expect.2 = temporary %.loc13_25.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc14: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc14_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc14: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14: = bound_method %int_1.loc14_19, %impl.elem0.loc14 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc14: init Core.IntLiteral = call %Op.bound.loc14(%int_1.loc14_19) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc14_22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc14_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc14_18.2: Core.IntLiteral = converted %int.snegate.loc14, %.loc14_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.greater_eq.loc14: init bool = call %GreaterEq.ref.loc14(%.loc14_18.2, %int_1.loc14_22) [template = constants.%false] +// CHECK:STDOUT: %.loc14_24.1: bool = value_of_initializer %int.greater_eq.loc14 [template = constants.%false] +// CHECK:STDOUT: %.loc14_24.2: bool = converted %int.greater_eq.loc14, %.loc14_24.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc14_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.3 = call %Test.specific_fn.loc14() to %.loc14_24.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc14: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc14_24.4: ref %Expect.3 = temporary %.loc14_24.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc15: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc15_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc15_22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int_1.loc15_22, %impl.elem0.loc15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc15: init Core.IntLiteral = call %Op.bound.loc15(%int_1.loc15_22) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_21.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_21.2: Core.IntLiteral = converted %int.snegate.loc15, %.loc15_21.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.greater_eq.loc15: init bool = call %GreaterEq.ref.loc15(%int_1.loc15_18, %.loc15_21.2) [template = constants.%true] +// CHECK:STDOUT: %.loc15_24.1: bool = value_of_initializer %int.greater_eq.loc15 [template = constants.%true] +// CHECK:STDOUT: %.loc15_24.2: bool = converted %int.greater_eq.loc15, %.loc15_24.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc15_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.2 = call %Test.specific_fn.loc15() to %.loc15_24.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc15: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc15_24.4: ref %Expect.2 = temporary %.loc15_24.3, %Test.call.loc15 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- mixed.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %GreaterEq.type: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %GreaterEq: %GreaterEq.type = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6.1: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_6.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_6.2: %i32 = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Bool = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.7 +// CHECK:STDOUT: .Negate = %import_ref.231 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .GreaterEq = %GreaterEq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %GreaterEq.decl: %GreaterEq.type = fn_decl @GreaterEq [template = constants.%GreaterEq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type, %.loc4_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_47.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_47.2: type = converted %bool.make_type, %.loc4_47.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @GreaterEq(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> bool = "int.greater_eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc10: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_5.loc10_18: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_5.loc10_21: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int_5.loc10_21, %impl.elem0.loc10 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%int_5.loc10_21) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_5.loc10_21, %.loc10_21.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%int_5.loc10_18, %.loc10_21.2) [template = constants.%true] +// CHECK:STDOUT: %.loc10_23.1: bool = value_of_initializer %int.greater_eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_23.2: bool = converted %int.greater_eq.loc10, %.loc10_23.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_23.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_23.4: ref %Expect.2 = temporary %.loc10_23.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc11: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_6.loc11: Core.IntLiteral = int_value 6 [template = constants.%int_6.1] +// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_6.loc11, %impl.elem0.loc11 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11: init %i32 = call %Convert.specific_fn.loc11(%int_6.loc11) [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_21.1: %i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_6.loc11, %.loc11_21.1 [template = constants.%int_6.2] +// CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%int_5.loc11, %.loc11_21.2) [template = constants.%false] +// CHECK:STDOUT: %.loc11_23.1: bool = value_of_initializer %int.greater_eq.loc11 [template = constants.%false] +// CHECK:STDOUT: %.loc11_23.2: bool = converted %int.greater_eq.loc11, %.loc11_23.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_23.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_23.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc11: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_23.4: ref %Expect.3 = temporary %.loc11_23.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc12: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_6.loc12: Core.IntLiteral = int_value 6 [template = constants.%int_6.1] +// CHECK:STDOUT: %int_5.loc12: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %impl.elem0.loc12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12: = bound_method %int_5.loc12, %impl.elem0.loc12 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12: = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %Convert.specific_fn.loc12(%int_5.loc12) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_5.loc12, %.loc12_21.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %int.greater_eq.loc12: init bool = call %GreaterEq.ref.loc12(%int_6.loc12, %.loc12_21.2) [template = constants.%true] +// CHECK:STDOUT: %.loc12_23.1: bool = value_of_initializer %int.greater_eq.loc12 [template = constants.%true] +// CHECK:STDOUT: %.loc12_23.2: bool = converted %int.greater_eq.loc12, %.loc12_23.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_23.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc12: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_23.4: ref %Expect.2 = temporary %.loc12_23.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc13: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc13_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc13_18: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_18: = bound_method %int_1.loc13_19, %impl.elem0.loc13_18 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_18: init Core.IntLiteral = call %Op.bound.loc13_18(%int_1.loc13_19) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc13_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc13_22.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_22: = bound_method %int_1.loc13_23, %impl.elem0.loc13_22.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_22: init Core.IntLiteral = call %Op.bound.loc13_22(%int_1.loc13_23) [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_18 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_18.2: Core.IntLiteral = converted %int.snegate.loc13_18, %.loc13_18.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc13_22.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13: = bound_method %int.snegate.loc13_22, %impl.elem0.loc13_22.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13: = specific_function %Convert.bound.loc13, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_22 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_22.2: Core.IntLiteral = converted %int.snegate.loc13_22, %.loc13_22.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc13: init %i32 = call %Convert.specific_fn.loc13(%.loc13_22.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc13_22.3: %i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc13_22.4: %i32 = converted %int.snegate.loc13_22, %.loc13_22.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.greater_eq.loc13: init bool = call %GreaterEq.ref.loc13(%.loc13_18.2, %.loc13_22.4) [template = constants.%true] +// CHECK:STDOUT: %.loc13_25.1: bool = value_of_initializer %int.greater_eq.loc13 [template = constants.%true] +// CHECK:STDOUT: %.loc13_25.2: bool = converted %int.greater_eq.loc13, %.loc13_25.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_25.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc13: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_25.4: ref %Expect.2 = temporary %.loc13_25.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc14: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc14_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc14_18: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14: = bound_method %int_1.loc14_19, %impl.elem0.loc14_18 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc14: init Core.IntLiteral = call %Op.bound.loc14(%int_1.loc14_19) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc14_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %.loc14_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc14_18.2: Core.IntLiteral = converted %int.snegate.loc14, %.loc14_18.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc14_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14: = bound_method %int_1.loc14_22, %impl.elem0.loc14_22 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc14: = specific_function %Convert.bound.loc14, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc14: init %i32 = call %Convert.specific_fn.loc14(%int_1.loc14_22) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_22.1: %i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_22.2: %i32 = converted %int_1.loc14_22, %.loc14_22.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.greater_eq.loc14: init bool = call %GreaterEq.ref.loc14(%.loc14_18.2, %.loc14_22.2) [template = constants.%false] +// CHECK:STDOUT: %.loc14_24.1: bool = value_of_initializer %int.greater_eq.loc14 [template = constants.%false] +// CHECK:STDOUT: %.loc14_24.2: bool = converted %int.greater_eq.loc14, %.loc14_24.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc14_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.3 = call %Test.specific_fn.loc14() to %.loc14_24.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc14: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc14_24.4: ref %Expect.3 = temporary %.loc14_24.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %GreaterEq.ref.loc15: %GreaterEq.type = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%GreaterEq] +// CHECK:STDOUT: %int_1.loc15_18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc15_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_21.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int_1.loc15_22, %impl.elem0.loc15_21.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc15: init Core.IntLiteral = call %Op.bound.loc15(%int_1.loc15_22) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc15_21.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.snegate.loc15, %impl.elem0.loc15_21.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc15_21.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_21.2: Core.IntLiteral = converted %int.snegate.loc15, %.loc15_21.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_21.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_21.3: %i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_21.4: %i32 = converted %int.snegate.loc15, %.loc15_21.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.greater_eq.loc15: init bool = call %GreaterEq.ref.loc15(%int_1.loc15_18, %.loc15_21.4) [template = constants.%true] +// CHECK:STDOUT: %.loc15_24.1: bool = value_of_initializer %int.greater_eq.loc15 [template = constants.%true] +// CHECK:STDOUT: %.loc15_24.2: bool = converted %int.greater_eq.loc15, %.loc15_24.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc15_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.2 = call %Test.specific_fn.loc15() to %.loc15_24.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc15: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc15_24.4: ref %Expect.2 = temporary %.loc15_24.3, %Test.call.loc15 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index a76d6a00e7bbd..0b0c0216418ad 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -10,6 +10,8 @@ // --- int_left_shift.carbon +library "[[@TEST_NAME]]"; + fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; var arr: [i32; LeftShift(5, 2)]; @@ -30,12 +32,12 @@ fn Negate(a: i32) -> i32 = "int.snegate"; // Shift greater than size is disallowed. let size_1: i32 = LeftShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 33 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = LeftShift(1, 33); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -43,7 +45,7 @@ let size_3: i32 = LeftShift(1, 33); // Overflow is allowed if the shift distance is in bounds. let overflow_1: i32 = LeftShift(1000, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance not in range [0, 32) in 1000 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -51,18 +53,83 @@ let overflow_2: i32 = LeftShift(1000, 32); // Oversize shifts aren't allowed even if there's no overflow. let no_overflow_1: i32 = LeftShift(0, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance not in range [0, 32) in 0 << 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); // Negative shifts aren't allowed either. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 << -1 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1)); +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +class Expect(N:! Core.IntLiteral()) {} +// CHECK:STDERR: literal.carbon:[[@LINE+4]]:13: error: expression cannot be used as a value [UseOfNonExprAsValue] +// CHECK:STDERR: fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; } +// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; } + +fn F() { + // Zero can be shifted by any amount. + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1000000000000)) as Expect(0); + + // Positive numbers can be shifted. + Test(LeftShift(1, 0)) as Expect(1); + Test(LeftShift(1, 1)) as Expect(2); + Test(LeftShift(2, 1)) as Expect(4); + Test(LeftShift(1, 2)) as Expect(4); + Test(LeftShift(3, 1)) as Expect(12); + + // Negative numbers can be shifted too. + Test(LeftShift(-1, 0)) as Expect(-1); + Test(LeftShift(-1, 1)) as Expect(-2); + Test(LeftShift(-2, 1)) as Expect(-4); + Test(LeftShift(-3, 1)) as Expect(-5); + + // Large numbers can be shifted. + Test(LeftShift(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0xFFFF_FFFF_FFFF_FFFE); + Test(LeftShift(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFF_FFFF_FFFE); +} +// --- literal_negative.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +// CHECK:STDERR: literal_negative.carbon:[[@LINE+4]]:16: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let bad: i32 = LeftShift(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad: i32 = LeftShift(1, -1); + +// --- literal_overflow.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +// CHECK:STDERR: literal_overflow.carbon:[[@LINE+4]]:16: error: shift distance of 4000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad: i32 = LeftShift(1, 4000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad: i32 = LeftShift(1, 4000_000_000); + +// CHECK:STDERR: literal_overflow.carbon:[[@LINE+3]]:25: error: shift distance of 4000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 4000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +let bad_negative: i32 = LeftShift(-1, 4000_000_000); + // CHECK:STDOUT: --- int_left_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -122,12 +189,12 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -135,39 +202,39 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, %LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc4_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_26: = bound_method %int_5, %impl.elem0.loc4_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc4_26: = specific_function %Convert.bound.loc4_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc4_26: init %i32 = call %Convert.specific_fn.loc4_26(%int_5) [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc4_26.1: %i32 = value_of_initializer %int.convert_checked.loc4_26 [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc4_26.2: %i32 = converted %int_5, %.loc4_26.1 [template = constants.%int_5.2] -// CHECK:STDOUT: %impl.elem0.loc4_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_29: = bound_method %int_2, %impl.elem0.loc4_29 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc4_29: = specific_function %Convert.bound.loc4_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc4_29: init %i32 = call %Convert.specific_fn.loc4_29(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_29.1: %i32 = value_of_initializer %int.convert_checked.loc4_29 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_29.2: %i32 = converted %int_2, %.loc4_29.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%.loc4_26.2, %.loc4_29.2) [template = constants.%int_20.1] -// CHECK:STDOUT: %impl.elem0.loc4_30: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc4_30: = bound_method %int.left_shift, %impl.elem0.loc4_30 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc4_30: = specific_function %Convert.bound.loc4_30, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc4_30.1: %i32 = value_of_initializer %int.left_shift [template = constants.%int_20.1] -// CHECK:STDOUT: %.loc4_30.2: %i32 = converted %int.left_shift, %.loc4_30.1 [template = constants.%int_20.1] -// CHECK:STDOUT: %int.convert_checked.loc4_30: init Core.IntLiteral = call %Convert.specific_fn.loc4_30(%.loc4_30.2) [template = constants.%int_20.2] -// CHECK:STDOUT: %.loc4_30.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_30 [template = constants.%int_20.2] -// CHECK:STDOUT: %.loc4_30.4: Core.IntLiteral = converted %int.left_shift, %.loc4_30.3 [template = constants.%int_20.2] -// CHECK:STDOUT: %array_type.loc4: type = array_type %.loc4_30.4, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %impl.elem0.loc6_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc6_26: = bound_method %int_5, %impl.elem0.loc6_26 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc6_26: = specific_function %Convert.bound.loc6_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc6_26: init %i32 = call %Convert.specific_fn.loc6_26(%int_5) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc6_26.1: %i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc6_26.2: %i32 = converted %int_5, %.loc6_26.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %impl.elem0.loc6_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc6_29: = bound_method %int_2, %impl.elem0.loc6_29 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc6_29: = specific_function %Convert.bound.loc6_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc6_29: init %i32 = call %Convert.specific_fn.loc6_29(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc6_29.1: %i32 = value_of_initializer %int.convert_checked.loc6_29 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc6_29.2: %i32 = converted %int_2, %.loc6_29.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%.loc6_26.2, %.loc6_29.2) [template = constants.%int_20.1] +// CHECK:STDOUT: %impl.elem0.loc6_30: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] +// CHECK:STDOUT: %Convert.bound.loc6_30: = bound_method %int.left_shift, %impl.elem0.loc6_30 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc6_30: = specific_function %Convert.bound.loc6_30, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc6_30.1: %i32 = value_of_initializer %int.left_shift [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc6_30.2: %i32 = converted %int.left_shift, %.loc6_30.1 [template = constants.%int_20.1] +// CHECK:STDOUT: %int.convert_checked.loc6_30: init Core.IntLiteral = call %Convert.specific_fn.loc6_30(%.loc6_30.2) [template = constants.%int_20.2] +// CHECK:STDOUT: %.loc6_30.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6_30 [template = constants.%int_20.2] +// CHECK:STDOUT: %.loc6_30.4: Core.IntLiteral = converted %int.left_shift, %.loc6_30.3 [template = constants.%int_20.2] +// CHECK:STDOUT: %array_type.loc6: type = array_type %.loc6_30.4, %i32 [template = constants.%array_type] // CHECK:STDOUT: %arr.var: ref %array_type = var arr // CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template = constants.%int_20.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %int_20, %i32 [template = constants.%array_type] +// CHECK:STDOUT: %array_type.loc7: type = array_type %int_20, %i32 [template = constants.%array_type] // CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a @@ -177,12 +244,12 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -200,9 +267,9 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_25.1: %i32 = value_of_initializer %int.left_shift -// CHECK:STDOUT: %.loc8_25.2: %i32 = converted %int.left_shift, %.loc8_25.1 -// CHECK:STDOUT: return %.loc8_25.2 +// CHECK:STDOUT: %.loc10_25.1: %i32 = value_of_initializer %int.left_shift +// CHECK:STDOUT: %.loc10_25.2: %i32 = converted %int.left_shift, %.loc10_25.1 +// CHECK:STDOUT: return %.loc10_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { @@ -327,8 +394,8 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %i32.loc29: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] // CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] // CHECK:STDOUT: %i32.loc34: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc40: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc40: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc41: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc41: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; @@ -470,29 +537,627 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: %.loc34_42.1: %i32 = value_of_initializer %int.left_shift.loc34 [template = ] // CHECK:STDOUT: %.loc34_42.2: %i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] // CHECK:STDOUT: %no_overflow_2: %i32 = bind_name no_overflow_2, %.loc34_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc40: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc40_31: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %LeftShift.ref.loc41: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc41_31: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] // CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc40_41: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc40_41: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc40_41: = bound_method %int_1.loc40_41, %impl.elem0.loc40_41 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc40_41: = specific_function %Convert.bound.loc40_41, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc40_41: init %i32 = call %Convert.specific_fn.loc40_41(%int_1.loc40_41) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_41.1: %i32 = value_of_initializer %int.convert_checked.loc40_41 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_41.2: %i32 = converted %int_1.loc40_41, %.loc40_41.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc40_41.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc40_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc40_31: = bound_method %int_1.loc40_31, %impl.elem0.loc40_31 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc40_31: = specific_function %Convert.bound.loc40_31, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc40_31: init %i32 = call %Convert.specific_fn.loc40_31(%int_1.loc40_31) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_31.1: %i32 = value_of_initializer %int.convert_checked.loc40_31 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_31.2: %i32 = converted %int_1.loc40_31, %.loc40_31.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc40_42.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc40_42.2: %i32 = converted %int.snegate, %.loc40_42.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc40: init %i32 = call %LeftShift.ref.loc40(%.loc40_31.2, %.loc40_42.2) [template = ] -// CHECK:STDOUT: %.loc40_44.1: %i32 = value_of_initializer %int.left_shift.loc40 [template = ] -// CHECK:STDOUT: %.loc40_44.2: %i32 = converted %int.left_shift.loc40, %.loc40_44.1 [template = ] -// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc40_44.2 +// CHECK:STDOUT: %int_1.loc41_41: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc41_41: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc41_41: = bound_method %int_1.loc41_41, %impl.elem0.loc41_41 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc41_41: = specific_function %Convert.bound.loc41_41, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc41_41: init %i32 = call %Convert.specific_fn.loc41_41(%int_1.loc41_41) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_41.1: %i32 = value_of_initializer %int.convert_checked.loc41_41 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_41.2: %i32 = converted %int_1.loc41_41, %.loc41_41.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc41_41.2) [template = constants.%int_-1] +// CHECK:STDOUT: %impl.elem0.loc41_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc41_31: = bound_method %int_1.loc41_31, %impl.elem0.loc41_31 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc41_31: = specific_function %Convert.bound.loc41_31, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc41_31: init %i32 = call %Convert.specific_fn.loc41_31(%int_1.loc41_31) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_31.1: %i32 = value_of_initializer %int.convert_checked.loc41_31 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_31.2: %i32 = converted %int_1.loc41_31, %.loc41_31.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_42.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] +// CHECK:STDOUT: %.loc41_42.2: %i32 = converted %int.snegate, %.loc41_42.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc41: init %i32 = call %LeftShift.ref.loc41(%.loc41_31.2, %.loc41_42.2) [template = ] +// CHECK:STDOUT: %.loc41_44.1: %i32 = value_of_initializer %int.left_shift.loc41 [template = ] +// CHECK:STDOUT: %.loc41_44.2: %i32 = converted %int.left_shift.loc41, %.loc41_44.1 [template = ] +// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc41_44.2 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %LeftShift.type: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %LeftShift: %LeftShift.type = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %N.patt.2: = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %int_1000000000000: Core.IntLiteral = int_value 1000000000000 [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1) [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_2) [template] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_4) [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_12) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %int_-2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2, %Op.2 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_-2) [template] +// CHECK:STDOUT: %int_-4: Core.IntLiteral = int_value -4 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_4, %Op.2 [template] +// CHECK:STDOUT: %Expect.9: type = class_type @Expect, @Expect(%int_-4) [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_3, %Op.2 [template] +// CHECK:STDOUT: %int_-3: Core.IntLiteral = int_value -3 [template] +// CHECK:STDOUT: %int_-6: Core.IntLiteral = int_value -6 [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Op.bound.5: = bound_method %int_5, %Op.2 [template] +// CHECK:STDOUT: %int_-5: Core.IntLiteral = int_value -5 [template] +// CHECK:STDOUT: %Expect.10: type = class_type @Expect, @Expect(%int_-5) [template] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] +// CHECK:STDOUT: %int_18446744073709551614: Core.IntLiteral = int_value 18446744073709551614 [template] +// CHECK:STDOUT: %Expect.11: type = class_type @Expect, @Expect(%int_18446744073709551614) [template] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %int_36893488147419103230: Core.IntLiteral = int_value 36893488147419103230 [template] +// CHECK:STDOUT: %Expect.12: type = class_type @Expect, @Expect(%int_36893488147419103230) [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LeftShift = %LeftShift.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type = fn_decl @LeftShift [template = constants.%LeftShift] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_33: init type = call %IntLiteral.ref.loc4_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type.loc4_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type.loc4_33, %.loc4_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_39: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_43: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_55: init type = call %IntLiteral.ref.loc4_43() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.1: type = value_of_initializer %int_literal.make_type.loc4_55 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.2: type = converted %int_literal.make_type.loc4_55, %.loc4_55.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_61: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_65: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_77: init type = call %IntLiteral.ref.loc4_65() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.1: type = value_of_initializer %int_literal.make_type.loc4_77 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.2: type = converted %int_literal.make_type.loc4_77, %.loc4_77.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc11_9.1: = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: = value_param_pattern %N.patt.loc11_9.1, runtime_param [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: = name_ref N, %N [template = ] +// CHECK:STDOUT: %N.param: = value_param runtime_param +// CHECK:STDOUT: %N: = bind_symbolic_name N, 0, %N.param [template = ] +// CHECK:STDOUT: %return.param: ref = out_param runtime_param0 +// CHECK:STDOUT: %return: ref = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LeftShift(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N: ) { +// CHECK:STDOUT: %N.patt.loc11_9.2: = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: ) -> { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc11: %empty_struct_type = struct_literal () +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc15_21: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.left_shift.loc15: init Core.IntLiteral = call %LeftShift.ref.loc15(%int_0.loc15_18, %int_0.loc15_21) [template = constants.%int_0] +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc15_35: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc16: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc16_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_1000000000000: Core.IntLiteral = int_value 1000000000000 [template = constants.%int_1000000000000] +// CHECK:STDOUT: %int.left_shift.loc16: init Core.IntLiteral = call %LeftShift.ref.loc16(%int_0.loc16_18, %int_1000000000000) [template = constants.%int_0] +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc16_47: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %Test.ref.loc19: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc19: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc19_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_0.loc19: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.left_shift.loc19: init Core.IntLiteral = call %LeftShift.ref.loc19(%int_1.loc19_18, %int_0.loc19) [template = constants.%int_1] +// CHECK:STDOUT: %Expect.ref.loc19: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc19_35: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_1) [template = constants.%Expect.3] +// CHECK:STDOUT: %Test.ref.loc20: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc20: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc20_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc20_21: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc20: init Core.IntLiteral = call %LeftShift.ref.loc20(%int_1.loc20_18, %int_1.loc20_21) [template = constants.%int_2] +// CHECK:STDOUT: %Expect.ref.loc20: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2.loc20: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %Expect.loc20: type = class_type @Expect, @Expect(constants.%int_2) [template = constants.%Expect.4] +// CHECK:STDOUT: %Test.ref.loc21: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_2.loc21: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc21: init Core.IntLiteral = call %LeftShift.ref.loc21(%int_2.loc21, %int_1.loc21) [template = constants.%int_4] +// CHECK:STDOUT: %Expect.ref.loc21: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4.loc21: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %Expect.loc21: type = class_type @Expect, @Expect(constants.%int_4) [template = constants.%Expect.5] +// CHECK:STDOUT: %Test.ref.loc22: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc22: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_2.loc22: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.left_shift.loc22: init Core.IntLiteral = call %LeftShift.ref.loc22(%int_1.loc22, %int_2.loc22) [template = constants.%int_4] +// CHECK:STDOUT: %Expect.ref.loc22: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4.loc22: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %Expect.loc22: type = class_type @Expect, @Expect(constants.%int_4) [template = constants.%Expect.5] +// CHECK:STDOUT: %Test.ref.loc23: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc23: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_3.loc23: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc23: init Core.IntLiteral = call %LeftShift.ref.loc23(%int_3.loc23, %int_1.loc23) [template = constants.%int_6] +// CHECK:STDOUT: %Expect.ref.loc23: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %Expect.loc23: type = class_type @Expect, @Expect(constants.%int_12) [template = constants.%Expect.6] +// CHECK:STDOUT: %Test.ref.loc26: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc26_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc26_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc26_18: = bound_method %int_1.loc26_19, %impl.elem0.loc26_18 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc26_18: init Core.IntLiteral = call %Op.bound.loc26_18(%int_1.loc26_19) [template = constants.%int_-1] +// CHECK:STDOUT: %int_0.loc26: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %.loc26_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_18 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_18.2: Core.IntLiteral = converted %int.snegate.loc26_18, %.loc26_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc26: init Core.IntLiteral = call %LeftShift.ref.loc26(%.loc26_18.2, %int_0.loc26) [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.ref.loc26: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc26_37: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc26_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc26_36: = bound_method %int_1.loc26_37, %impl.elem0.loc26_36 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc26_36: init Core.IntLiteral = call %Op.bound.loc26_36(%int_1.loc26_37) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_38.2: Core.IntLiteral = converted %int.snegate.loc26_36, %.loc26_38.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc26: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.7] +// CHECK:STDOUT: %Test.ref.loc27: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc27: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc27_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc27_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc27_18: = bound_method %int_1.loc27_19, %impl.elem0.loc27_18 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc27_18: init Core.IntLiteral = call %Op.bound.loc27_18(%int_1.loc27_19) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc27_22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc27_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc27_18 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc27_18.2: Core.IntLiteral = converted %int.snegate.loc27_18, %.loc27_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc27: init Core.IntLiteral = call %LeftShift.ref.loc27(%.loc27_18.2, %int_1.loc27_22) [template = constants.%int_-2] +// CHECK:STDOUT: %Expect.ref.loc27: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2.loc27: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %impl.elem0.loc27_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc27_36: = bound_method %int_2.loc27, %impl.elem0.loc27_36 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc27_36: init Core.IntLiteral = call %Op.bound.loc27_36(%int_2.loc27) [template = constants.%int_-2] +// CHECK:STDOUT: %.loc27_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc27_36 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc27_38.2: Core.IntLiteral = converted %int.snegate.loc27_36, %.loc27_38.1 [template = constants.%int_-2] +// CHECK:STDOUT: %Expect.loc27: type = class_type @Expect, @Expect(constants.%int_-2) [template = constants.%Expect.8] +// CHECK:STDOUT: %Test.ref.loc28: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc28: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_2.loc28: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %impl.elem0.loc28_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc28_18: = bound_method %int_2.loc28, %impl.elem0.loc28_18 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc28_18: init Core.IntLiteral = call %Op.bound.loc28_18(%int_2.loc28) [template = constants.%int_-2] +// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc28_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_18 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc28_18.2: Core.IntLiteral = converted %int.snegate.loc28_18, %.loc28_18.1 [template = constants.%int_-2] +// CHECK:STDOUT: %int.left_shift.loc28: init Core.IntLiteral = call %LeftShift.ref.loc28(%.loc28_18.2, %int_1.loc28) [template = constants.%int_-4] +// CHECK:STDOUT: %Expect.ref.loc28: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4.loc28: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %impl.elem0.loc28_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc28_36: = bound_method %int_4.loc28, %impl.elem0.loc28_36 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc28_36: init Core.IntLiteral = call %Op.bound.loc28_36(%int_4.loc28) [template = constants.%int_-4] +// CHECK:STDOUT: %.loc28_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_36 [template = constants.%int_-4] +// CHECK:STDOUT: %.loc28_38.2: Core.IntLiteral = converted %int.snegate.loc28_36, %.loc28_38.1 [template = constants.%int_-4] +// CHECK:STDOUT: %Expect.loc28: type = class_type @Expect, @Expect(constants.%int_-4) [template = constants.%Expect.9] +// CHECK:STDOUT: %Test.ref.loc29: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_3.loc29: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc29_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc29_18: = bound_method %int_3.loc29, %impl.elem0.loc29_18 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc29_18: init Core.IntLiteral = call %Op.bound.loc29_18(%int_3.loc29) [template = constants.%int_-3] +// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc29_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_18 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc29_18.2: Core.IntLiteral = converted %int.snegate.loc29_18, %.loc29_18.1 [template = constants.%int_-3] +// CHECK:STDOUT: %int.left_shift.loc29: init Core.IntLiteral = call %LeftShift.ref.loc29(%.loc29_18.2, %int_1.loc29) [template = constants.%int_-6] +// CHECK:STDOUT: %Expect.ref.loc29: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %impl.elem0.loc29_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc29_36: = bound_method %int_5, %impl.elem0.loc29_36 [template = constants.%Op.bound.5] +// CHECK:STDOUT: %int.snegate.loc29_36: init Core.IntLiteral = call %Op.bound.loc29_36(%int_5) [template = constants.%int_-5] +// CHECK:STDOUT: %.loc29_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_36 [template = constants.%int_-5] +// CHECK:STDOUT: %.loc29_38.2: Core.IntLiteral = converted %int.snegate.loc29_36, %.loc29_38.1 [template = constants.%int_-5] +// CHECK:STDOUT: %Expect.loc29: type = class_type @Expect, @Expect(constants.%int_-5) [template = constants.%Expect.10] +// CHECK:STDOUT: %Test.ref.loc32: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc32: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc32: init Core.IntLiteral = call %LeftShift.ref.loc32(%int_9223372036854775807, %int_1.loc32) [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %Expect.ref.loc32: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_18446744073709551614: Core.IntLiteral = int_value 18446744073709551614 [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %Expect.loc32: type = class_type @Expect, @Expect(constants.%int_18446744073709551614) [template = constants.%Expect.11] +// CHECK:STDOUT: %Test.ref.loc33: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc33: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template = constants.%int_18446744073709551615] +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc33: init Core.IntLiteral = call %LeftShift.ref.loc33(%int_18446744073709551615, %int_1.loc33) [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %Expect.ref.loc33: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_36893488147419103230: Core.IntLiteral = int_value 36893488147419103230 [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %Expect.loc33: type = class_type @Expect, @Expect(constants.%int_36893488147419103230) [template = constants.%Expect.12] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test() { +// CHECK:STDOUT: %N.patt.loc11_9.2 => +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_4) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_4 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_12) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_12 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-4) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-4 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-5) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-5 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_18446744073709551614) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_36893488147419103230) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal_negative.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] +// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.7(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.44 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LeftShift = %LeftShift.decl +// CHECK:STDOUT: .bad = @__global_init.%bad +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_33: init type = call %IntLiteral.ref.loc4_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type.loc4_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type.loc4_33, %.loc4_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_39: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_43: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_55: init type = call %IntLiteral.ref.loc4_43() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.1: type = value_of_initializer %int_literal.make_type.loc4_55 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.2: type = converted %int_literal.make_type.loc4_55, %.loc4_55.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_61: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_65: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_77: init type = call %IntLiteral.ref.loc4_65() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.1: type = value_of_initializer %int_literal.make_type.loc4_77 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.2: type = converted %int_literal.make_type.loc4_77, %.loc4_77.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc10_30: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc10_29: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.loc10_30, %impl.elem0.loc10_29 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_1.loc10_30) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_29.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_29.2: Core.IntLiteral = converted %int.snegate, %.loc10_29.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift: init Core.IntLiteral = call %LeftShift.ref(%int_1.loc10_26, %.loc10_29.2) [template = ] +// CHECK:STDOUT: %impl.elem0.loc10_32: %Convert.type.2 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound: = bound_method %int.left_shift, %impl.elem0.loc10_32 [template = ] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = ] +// CHECK:STDOUT: %.loc10_31.1: Core.IntLiteral = value_of_initializer %int.left_shift [template = ] +// CHECK:STDOUT: %.loc10_31.2: Core.IntLiteral = converted %int.left_shift, %.loc10_31.1 [template = ] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%.loc10_31.2) [template = ] +// CHECK:STDOUT: %.loc10_32.1: %i32 = value_of_initializer %int.convert_checked [template = ] +// CHECK:STDOUT: %.loc10_32.2: %i32 = converted %int.left_shift, %.loc10_32.1 [template = ] +// CHECK:STDOUT: %bad: %i32 = bind_name bad, %.loc10_32.2 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal_overflow.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] +// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_4000000000: Core.IntLiteral = int_value 4000000000 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .Negate = %import_ref.230 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LeftShift = %LeftShift.decl +// CHECK:STDOUT: .bad = @__global_init.%bad +// CHECK:STDOUT: .bad_negative = @__global_init.%bad_negative +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_33: init type = call %IntLiteral.ref.loc4_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type.loc4_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type.loc4_33, %.loc4_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_39: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_43: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_55: init type = call %IntLiteral.ref.loc4_43() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.1: type = value_of_initializer %int_literal.make_type.loc4_55 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_55.2: type = converted %int_literal.make_type.loc4_55, %.loc4_55.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_61: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_65: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_77: init type = call %IntLiteral.ref.loc4_65() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.1: type = value_of_initializer %int_literal.make_type.loc4_77 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_77.2: type = converted %int_literal.make_type.loc4_77, %.loc4_77.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %LeftShift.ref.loc10: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_4000000000.loc10: Core.IntLiteral = int_value 4000000000 [template = constants.%int_4000000000] +// CHECK:STDOUT: %int.left_shift.loc10: init Core.IntLiteral = call %LeftShift.ref.loc10(%int_1.loc10, %int_4000000000.loc10) [template = ] +// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int.left_shift.loc10, %impl.elem0.loc10 [template = ] +// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = ] +// CHECK:STDOUT: %.loc10_41.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc10 [template = ] +// CHECK:STDOUT: %.loc10_41.2: Core.IntLiteral = converted %int.left_shift.loc10, %.loc10_41.1 [template = ] +// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%.loc10_41.2) [template = ] +// CHECK:STDOUT: %.loc10_42.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = ] +// CHECK:STDOUT: %.loc10_42.2: %i32 = converted %int.left_shift.loc10, %.loc10_42.1 [template = ] +// CHECK:STDOUT: %bad: %i32 = bind_name bad, %.loc10_42.2 +// CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15_35: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.loc15, %impl.elem0.loc15_35 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_1.loc15) [template = constants.%int_-1] +// CHECK:STDOUT: %int_4000000000.loc15: Core.IntLiteral = int_value 4000000000 [template = constants.%int_4000000000] +// CHECK:STDOUT: %.loc15_35.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_35.2: Core.IntLiteral = converted %int.snegate, %.loc15_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc15: init Core.IntLiteral = call %LeftShift.ref.loc15(%.loc15_35.2, %int_4000000000.loc15) [template = ] +// CHECK:STDOUT: %impl.elem0.loc15_52: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.left_shift.loc15, %impl.elem0.loc15_52 [template = ] +// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = ] +// CHECK:STDOUT: %.loc15_51.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc15 [template = ] +// CHECK:STDOUT: %.loc15_51.2: Core.IntLiteral = converted %int.left_shift.loc15, %.loc15_51.1 [template = ] +// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_51.2) [template = ] +// CHECK:STDOUT: %.loc15_52.1: %i32 = value_of_initializer %int.convert_checked.loc15 [template = ] +// CHECK:STDOUT: %.loc15_52.2: %i32 = converted %int.left_shift.loc15, %.loc15_52.1 [template = ] +// CHECK:STDOUT: %bad_negative: %i32 = bind_name bad_negative, %.loc15_52.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 0febd2da77e53..8c0513e92989c 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -10,6 +10,8 @@ // --- int_less_eq.carbon +library "[[@TEST_NAME]]"; + fn LessEq(a: i32, b: i32) -> bool = "int.less_eq"; fn Negate(a: i32) -> i32 = "int.snegate"; @@ -28,6 +30,42 @@ fn RuntimeCall(a: i32, b: i32) -> bool { return LessEq(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(LessEq(5, 5)) as Expect(true); + Test(LessEq(5, 6)) as Expect(true); + Test(LessEq(6, 5)) as Expect(false); + Test(LessEq(-1, -1)) as Expect(true); + Test(LessEq(-1, 1)) as Expect(true); + Test(LessEq(1, -1)) as Expect(false); +} + +// --- mixed.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: i32) -> bool = "int.less_eq"; + +class Expect(B:! bool) {} +fn Test(B:! bool) -> Expect(B) { return {}; } + +fn F() { + Test(LessEq(5, 5)) as Expect(true); + Test(LessEq(5, 6)) as Expect(true); + Test(LessEq(6, 5)) as Expect(false); + Test(LessEq(-1, -1)) as Expect(true); + Test(LessEq(-1, 1)) as Expect(true); + Test(LessEq(1, -1)) as Expect(false); +} + // CHECK:STDOUT: --- int_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -97,13 +135,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc2_30.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc2_30.2: type = converted %bool.make_type, %.loc2_30.1 [template = bool] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_30.2: type = converted %bool.make_type, %.loc4_30.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -117,10 +155,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc3_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc3_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc3_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 @@ -134,8 +172,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.patt: %False = binding_pattern false_ // CHECK:STDOUT: %false_.param_patt: %False = value_param_pattern %false_.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %True.ref.loc8: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: %False.ref.loc8: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] // CHECK:STDOUT: %true_.param: %True = value_param runtime_param0 // CHECK:STDOUT: %true_: %True = bind_name true_, %true_.param // CHECK:STDOUT: %false_.param: %False = value_param runtime_param1 @@ -149,13 +187,13 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %return.patt: bool = return_slot_pattern // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc16_35.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc16_35.2: type = converted %bool.make_type, %.loc16_35.1 [template = bool] +// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc18_35.2: type = converted %bool.make_type, %.loc18_35.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -187,88 +225,26 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%true_.param_patt: %True, %false_.param_patt: %False) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true_.ref.loc9: %True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc9_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_23: = bound_method %int_1.loc9, %impl.elem0.loc9_23 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_23: = specific_function %Convert.bound.loc9_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_23: init %i32 = call %Convert.specific_fn.loc9_23(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_23.1: %i32 = value_of_initializer %int.convert_checked.loc9_23 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_23.2: %i32 = converted %int_1.loc9, %.loc9_23.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc9_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_26: = bound_method %int_2, %impl.elem0.loc9_26 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_26: = specific_function %Convert.bound.loc9_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_26: init %i32 = call %Convert.specific_fn.loc9_26(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_26.1: %i32 = value_of_initializer %int.convert_checked.loc9_26 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc9_26.2: %i32 = converted %int_2, %.loc9_26.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23.2, %.loc9_26.2) [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.1: bool = value_of_initializer %int.less_eq.loc9 [template = constants.%true] -// CHECK:STDOUT: %.loc9_13.2: bool = converted %int.less_eq.loc9, %.loc9_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc9_13.2 br !if.expr.then.loc9 else br !if.expr.else.loc9 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %True.ref.loc9: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc9(%True.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %False.ref.loc9: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc9(%False.ref.loc9) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] -// CHECK:STDOUT: %true_.ref.loc10: %True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_1.loc10_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_23: = bound_method %int_1.loc10_23, %impl.elem0.loc10_23 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_23: = specific_function %Convert.bound.loc10_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_23: init %i32 = call %Convert.specific_fn.loc10_23(%int_1.loc10_23) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.convert_checked.loc10_23 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int_1.loc10_23, %.loc10_23.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_26: = bound_method %int_1.loc10_26, %impl.elem0.loc10_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_26: = specific_function %Convert.bound.loc10_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_26: init %i32 = call %Convert.specific_fn.loc10_26(%int_1.loc10_26) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.1: %i32 = value_of_initializer %int.convert_checked.loc10_26 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_26.2: %i32 = converted %int_1.loc10_26, %.loc10_26.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23.2, %.loc10_26.2) [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%true] -// CHECK:STDOUT: %.loc10_13.2: bool = converted %int.less_eq.loc10, %.loc10_13.1 [template = constants.%true] -// CHECK:STDOUT: if %.loc10_13.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %True.ref.loc10: type = name_ref True, file.%True.decl [template = constants.%True] -// CHECK:STDOUT: br !if.expr.result.loc10(%True.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %False.ref.loc10: type = name_ref False, file.%False.decl [template = constants.%False] -// CHECK:STDOUT: br !if.expr.result.loc10(%False.ref.loc10) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] -// CHECK:STDOUT: %false_.ref.loc11: %False = name_ref false_, %false_ +// CHECK:STDOUT: %true_.ref.loc11: %True = name_ref true_, %true_ // CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] // CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc11_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_24: = bound_method %int_1.loc11, %impl.elem0.loc11_24 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc11_24: = specific_function %Convert.bound.loc11_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc11_24: init %i32 = call %Convert.specific_fn.loc11_24(%int_1.loc11) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.1: %i32 = value_of_initializer %int.convert_checked.loc11_24 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc11_24.2: %i32 = converted %int_1.loc11, %.loc11_24.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc11_27: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc11_27: = bound_method %int_0.loc11, %impl.elem0.loc11_27 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc11_27: = specific_function %Convert.bound.loc11_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc11_27: init %i32 = call %Convert.specific_fn.loc11_27(%int_0.loc11) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.1: %i32 = value_of_initializer %int.convert_checked.loc11_27 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc11_27.2: %i32 = converted %int_0.loc11, %.loc11_27.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24.2, %.loc11_27.2) [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%false] -// CHECK:STDOUT: %.loc11_14.2: bool = converted %int.less_eq.loc11, %.loc11_14.1 [template = constants.%false] -// CHECK:STDOUT: if %.loc11_14.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc11_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_23: = bound_method %int_1.loc11, %impl.elem0.loc11_23 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_23: = specific_function %Convert.bound.loc11_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_23: init %i32 = call %Convert.specific_fn.loc11_23(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_23.1: %i32 = value_of_initializer %int.convert_checked.loc11_23 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_23.2: %i32 = converted %int_1.loc11, %.loc11_23.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_26: = bound_method %int_2, %impl.elem0.loc11_26 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_26: = specific_function %Convert.bound.loc11_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_26: init %i32 = call %Convert.specific_fn.loc11_26(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_26.1: %i32 = value_of_initializer %int.convert_checked.loc11_26 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_26.2: %i32 = converted %int_2, %.loc11_26.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_23.2, %.loc11_26.2) [template = constants.%true] +// CHECK:STDOUT: %.loc11_13.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%true] +// CHECK:STDOUT: %.loc11_13.2: bool = converted %int.less_eq.loc11, %.loc11_13.1 [template = constants.%true] +// CHECK:STDOUT: if %.loc11_13.2 br !if.expr.then.loc11 else br !if.expr.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc11: // CHECK:STDOUT: %True.ref.loc11: type = name_ref True, file.%True.decl [template = constants.%True] @@ -279,28 +255,24 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: br !if.expr.result.loc11(%False.ref.loc11) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc11: -// CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] +// CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc12: %True = name_ref true_, %true_ // CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc12_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_30: = bound_method %int_1.loc12, %impl.elem0.loc12_30 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_30: = specific_function %Convert.bound.loc12_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_30: init %i32 = call %Convert.specific_fn.loc12_30(%int_1.loc12) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_30.1: %i32 = value_of_initializer %int.convert_checked.loc12_30 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_30.2: %i32 = converted %int_1.loc12, %.loc12_30.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_30.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc12_31.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc12_31.2: %i32 = converted %int.snegate.loc12, %.loc12_31.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc12_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_34: = bound_method %int_0.loc12, %impl.elem0.loc12_34 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc12_34: = specific_function %Convert.bound.loc12_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc12_34: init %i32 = call %Convert.specific_fn.loc12_34(%int_0.loc12) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_34.1: %i32 = value_of_initializer %int.convert_checked.loc12_34 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc12_34.2: %i32 = converted %int_0.loc12, %.loc12_34.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_31.2, %.loc12_34.2) [template = constants.%true] +// CHECK:STDOUT: %int_1.loc12_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc12_26: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_23: = bound_method %int_1.loc12_23, %impl.elem0.loc12_23 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_23: = specific_function %Convert.bound.loc12_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_23: init %i32 = call %Convert.specific_fn.loc12_23(%int_1.loc12_23) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_23.1: %i32 = value_of_initializer %int.convert_checked.loc12_23 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_23.2: %i32 = converted %int_1.loc12_23, %.loc12_23.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc12_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_26: = bound_method %int_1.loc12_26, %impl.elem0.loc12_26 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_26: = specific_function %Convert.bound.loc12_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_26: init %i32 = call %Convert.specific_fn.loc12_26(%int_1.loc12_26) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_26.1: %i32 = value_of_initializer %int.convert_checked.loc12_26 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_26.2: %i32 = converted %int_1.loc12_26, %.loc12_26.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%.loc12_23.2, %.loc12_26.2) [template = constants.%true] // CHECK:STDOUT: %.loc12_13.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%true] // CHECK:STDOUT: %.loc12_13.2: bool = converted %int.less_eq.loc12, %.loc12_13.1 [template = constants.%true] // CHECK:STDOUT: if %.loc12_13.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 @@ -317,25 +289,21 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: %False = name_ref false_, %false_ // CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] -// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %Negate.ref.loc13: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc13_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_34: = bound_method %int_1.loc13, %impl.elem0.loc13_34 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_34: = specific_function %Convert.bound.loc13_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_34: init %i32 = call %Convert.specific_fn.loc13_34(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.1: %i32 = value_of_initializer %int.convert_checked.loc13_34 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_34.2: %i32 = converted %int_1.loc13, %.loc13_34.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc13: init %i32 = call %Negate.ref.loc13(%.loc13_34.2) [template = constants.%int_-1] +// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] // CHECK:STDOUT: %impl.elem0.loc13_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_24: = bound_method %int_0.loc13, %impl.elem0.loc13_24 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_24: = specific_function %Convert.bound.loc13_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_24: init %i32 = call %Convert.specific_fn.loc13_24(%int_0.loc13) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int_0.loc13, %.loc13_24.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.snegate.loc13, %.loc13_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24.2, %.loc13_35.2) [template = constants.%false] +// CHECK:STDOUT: %Convert.bound.loc13_24: = bound_method %int_1.loc13, %impl.elem0.loc13_24 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc13_24: = specific_function %Convert.bound.loc13_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc13_24: init %i32 = call %Convert.specific_fn.loc13_24(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.convert_checked.loc13_24 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int_1.loc13, %.loc13_24.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_27: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_27: = bound_method %int_0.loc13, %impl.elem0.loc13_27 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_27: = specific_function %Convert.bound.loc13_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_27: init %i32 = call %Convert.specific_fn.loc13_27(%int_0.loc13) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_27.1: %i32 = value_of_initializer %int.convert_checked.loc13_27 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_27.2: %i32 = converted %int_0.loc13, %.loc13_27.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_24.2, %.loc13_27.2) [template = constants.%false] // CHECK:STDOUT: %.loc13_14.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%false] // CHECK:STDOUT: %.loc13_14.2: bool = converted %int.less_eq.loc13, %.loc13_14.1 [template = constants.%false] // CHECK:STDOUT: if %.loc13_14.2 br !if.expr.then.loc13 else br !if.expr.else.loc13 @@ -350,6 +318,76 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc13: // CHECK:STDOUT: %.loc13_14.3: type = block_arg !if.expr.result.loc13 [template = constants.%False] +// CHECK:STDOUT: %true_.ref.loc14: %True = name_ref true_, %true_ +// CHECK:STDOUT: %LessEq.ref.loc14: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %Negate.ref.loc14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc14_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_30: = bound_method %int_1.loc14, %impl.elem0.loc14_30 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc14_30: = specific_function %Convert.bound.loc14_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc14_30: init %i32 = call %Convert.specific_fn.loc14_30(%int_1.loc14) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_30.1: %i32 = value_of_initializer %int.convert_checked.loc14_30 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_30.2: %i32 = converted %int_1.loc14, %.loc14_30.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.snegate.loc14: init %i32 = call %Negate.ref.loc14(%.loc14_30.2) [template = constants.%int_-1] +// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc14_31.1: %i32 = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc14_31.2: %i32 = converted %int.snegate.loc14, %.loc14_31.1 [template = constants.%int_-1] +// CHECK:STDOUT: %impl.elem0.loc14_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_34: = bound_method %int_0.loc14, %impl.elem0.loc14_34 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc14_34: = specific_function %Convert.bound.loc14_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc14_34: init %i32 = call %Convert.specific_fn.loc14_34(%int_0.loc14) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc14_34.1: %i32 = value_of_initializer %int.convert_checked.loc14_34 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc14_34.2: %i32 = converted %int_0.loc14, %.loc14_34.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.less_eq.loc14: init bool = call %LessEq.ref.loc14(%.loc14_31.2, %.loc14_34.2) [template = constants.%true] +// CHECK:STDOUT: %.loc14_13.1: bool = value_of_initializer %int.less_eq.loc14 [template = constants.%true] +// CHECK:STDOUT: %.loc14_13.2: bool = converted %int.less_eq.loc14, %.loc14_13.1 [template = constants.%true] +// CHECK:STDOUT: if %.loc14_13.2 br !if.expr.then.loc14 else br !if.expr.else.loc14 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc14: +// CHECK:STDOUT: %True.ref.loc14: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc14(%True.ref.loc14) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc14: +// CHECK:STDOUT: %False.ref.loc14: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc14(%False.ref.loc14) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc14: +// CHECK:STDOUT: %.loc14_13.3: type = block_arg !if.expr.result.loc14 [template = constants.%True] +// CHECK:STDOUT: %false_.ref.loc15: %False = name_ref false_, %false_ +// CHECK:STDOUT: %LessEq.ref.loc15: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_0.loc15: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_34: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_34: = bound_method %int_1.loc15, %impl.elem0.loc15_34 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc15_34: = specific_function %Convert.bound.loc15_34, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc15_34: init %i32 = call %Convert.specific_fn.loc15_34(%int_1.loc15) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_34.1: %i32 = value_of_initializer %int.convert_checked.loc15_34 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_34.2: %i32 = converted %int_1.loc15, %.loc15_34.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.snegate.loc15: init %i32 = call %Negate.ref.loc15(%.loc15_34.2) [template = constants.%int_-1] +// CHECK:STDOUT: %impl.elem0.loc15_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_24: = bound_method %int_0.loc15, %impl.elem0.loc15_24 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15_24: = specific_function %Convert.bound.loc15_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc15_24: init %i32 = call %Convert.specific_fn.loc15_24(%int_0.loc15) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_24.1: %i32 = value_of_initializer %int.convert_checked.loc15_24 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_24.2: %i32 = converted %int_0.loc15, %.loc15_24.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc15_35.1: %i32 = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_35.2: %i32 = converted %int.snegate.loc15, %.loc15_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.less_eq.loc15: init bool = call %LessEq.ref.loc15(%.loc15_24.2, %.loc15_35.2) [template = constants.%false] +// CHECK:STDOUT: %.loc15_14.1: bool = value_of_initializer %int.less_eq.loc15 [template = constants.%false] +// CHECK:STDOUT: %.loc15_14.2: bool = converted %int.less_eq.loc15, %.loc15_14.1 [template = constants.%false] +// CHECK:STDOUT: if %.loc15_14.2 br !if.expr.then.loc15 else br !if.expr.else.loc15 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then.loc15: +// CHECK:STDOUT: %True.ref.loc15: type = name_ref True, file.%True.decl [template = constants.%True] +// CHECK:STDOUT: br !if.expr.result.loc15(%True.ref.loc15) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else.loc15: +// CHECK:STDOUT: %False.ref.loc15: type = name_ref False, file.%False.decl [template = constants.%False] +// CHECK:STDOUT: br !if.expr.result.loc15(%False.ref.loc15) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result.loc15: +// CHECK:STDOUT: %.loc15_14.3: type = block_arg !if.expr.result.loc15 [template = constants.%False] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -359,8 +397,685 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc17_22.1: bool = value_of_initializer %int.less_eq -// CHECK:STDOUT: %.loc17_22.2: bool = converted %int.less_eq, %.loc17_22.1 -// CHECK:STDOUT: return %.loc17_22.2 +// CHECK:STDOUT: %.loc19_22.1: bool = value_of_initializer %int.less_eq +// CHECK:STDOUT: %.loc19_22.2: bool = converted %int.less_eq, %.loc19_22.1 +// CHECK:STDOUT: return %.loc19_22.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %LessEq.type: type = fn_type @LessEq [template] +// CHECK:STDOUT: %LessEq: %LessEq.type = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: .Negate = %import_ref.3 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LessEq = %LessEq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_58.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_58.2: type = converted %bool.make_type, %.loc4_58.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LessEq(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> bool = "int.less_eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_5.loc10_15: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_5.loc10_18: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%int_5.loc10_15, %int_5.loc10_18) [template = constants.%true] +// CHECK:STDOUT: %.loc10_20.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_20.2: bool = converted %int.less_eq.loc10, %.loc10_20.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_20.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_20.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_20.4: ref %Expect.2 = temporary %.loc10_20.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_6.loc11: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%int_5.loc11, %int_6.loc11) [template = constants.%true] +// CHECK:STDOUT: %.loc11_20.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%true] +// CHECK:STDOUT: %.loc11_20.2: bool = converted %int.less_eq.loc11, %.loc11_20.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_20.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_20.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc11: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_20.4: ref %Expect.2 = temporary %.loc11_20.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_6.loc12: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %int_5.loc12: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%int_6.loc12, %int_5.loc12) [template = constants.%false] +// CHECK:STDOUT: %.loc12_20.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%false] +// CHECK:STDOUT: %.loc12_20.2: bool = converted %int.less_eq.loc12, %.loc12_20.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_20.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_20.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc12: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_20.4: ref %Expect.3 = temporary %.loc12_20.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc13_16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13_15: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_15: = bound_method %int_1.loc13_16, %impl.elem0.loc13_15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_15: init Core.IntLiteral = call %Op.bound.loc13_15(%int_1.loc13_16) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc13_20: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_19: = bound_method %int_1.loc13_20, %impl.elem0.loc13_19 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_19: init Core.IntLiteral = call %Op.bound.loc13_19(%int_1.loc13_20) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_15.2: Core.IntLiteral = converted %int.snegate.loc13_15, %.loc13_15.1 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_19 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_19.2: Core.IntLiteral = converted %int.snegate.loc13_19, %.loc13_19.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_15.2, %.loc13_19.2) [template = constants.%true] +// CHECK:STDOUT: %.loc13_22.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%true] +// CHECK:STDOUT: %.loc13_22.2: bool = converted %int.less_eq.loc13, %.loc13_22.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_22.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_22.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc13: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_22.4: ref %Expect.2 = temporary %.loc13_22.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc14: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc14_16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc14: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14: = bound_method %int_1.loc14_16, %impl.elem0.loc14 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc14: init Core.IntLiteral = call %Op.bound.loc14(%int_1.loc14_16) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc14_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc14_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc14_15.2: Core.IntLiteral = converted %int.snegate.loc14, %.loc14_15.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.less_eq.loc14: init bool = call %LessEq.ref.loc14(%.loc14_15.2, %int_1.loc14_19) [template = constants.%true] +// CHECK:STDOUT: %.loc14_21.1: bool = value_of_initializer %int.less_eq.loc14 [template = constants.%true] +// CHECK:STDOUT: %.loc14_21.2: bool = converted %int.less_eq.loc14, %.loc14_21.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc14_21.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.2 = call %Test.specific_fn.loc14() to %.loc14_21.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc14: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc14_21.4: ref %Expect.2 = temporary %.loc14_21.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc15: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc15_15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc15_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int_1.loc15_19, %impl.elem0.loc15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc15: init Core.IntLiteral = call %Op.bound.loc15(%int_1.loc15_19) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_18.2: Core.IntLiteral = converted %int.snegate.loc15, %.loc15_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.less_eq.loc15: init bool = call %LessEq.ref.loc15(%int_1.loc15_15, %.loc15_18.2) [template = constants.%false] +// CHECK:STDOUT: %.loc15_21.1: bool = value_of_initializer %int.less_eq.loc15 [template = constants.%false] +// CHECK:STDOUT: %.loc15_21.2: bool = converted %int.less_eq.loc15, %.loc15_21.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc15_21.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.3 = call %Test.specific_fn.loc15() to %.loc15_21.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc15: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc15_21.4: ref %Expect.3 = temporary %.loc15_21.3, %Test.call.loc15 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- mixed.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %LessEq.type: type = fn_type @LessEq [template] +// CHECK:STDOUT: %LessEq: %LessEq.type = struct_value () [template] +// CHECK:STDOUT: %B: bool = bind_symbolic_name B, 0 [symbolic] +// CHECK:STDOUT: %B.patt: bool = symbolic_binding_pattern B, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%B) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%true) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%true) [template] +// CHECK:STDOUT: %int_6.1: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_6.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_6.2: %i32 = int_value 6 [template] +// CHECK:STDOUT: %false: bool = bool_literal false [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%false) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%false) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Bool = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.7 +// CHECK:STDOUT: .Negate = %import_ref.231 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LessEq = %LessEq.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_44.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_44.2: type = converted %bool.make_type, %.loc4_44.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %B.patt.loc6_14.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc6_14.1, runtime_param [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc6_18.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc6_18.2: type = converted %bool.make_type, %.loc6_18.1 [template = bool] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc6_14.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %B.patt.loc7_9.1: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %B.param_patt: bool = value_param_pattern %B.patt.loc7_9.1, runtime_param [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc7_13.2: type = converted %bool.make_type, %.loc7_13.1 [template = bool] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %B.ref: bool = name_ref B, %B.loc7_9.1 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %Expect.loc7_30.1: type = class_type @Expect, @Expect(constants.%B) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: %B.param: bool = value_param runtime_param +// CHECK:STDOUT: %B.loc7_9.1: bool = bind_symbolic_name B, 0, %B.param [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_30.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_30.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%B.loc6_14.1: bool) { +// CHECK:STDOUT: %B.loc6_14.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc6_14.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc6_14.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc6_14.2 (constants.%B.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LessEq(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> bool = "int.less_eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%B.loc7_9.1: bool) { +// CHECK:STDOUT: %B.loc7_9.2: bool = bind_symbolic_name B, 0 [symbolic = %B.loc7_9.2 (constants.%B)] +// CHECK:STDOUT: %B.patt.loc7_9.2: bool = symbolic_binding_pattern B, 0 [symbolic = %B.patt.loc7_9.2 (constants.%B.patt)] +// CHECK:STDOUT: %Expect.loc7_30.2: type = class_type @Expect, @Expect(%B.loc7_9.2) [symbolic = %Expect.loc7_30.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_30.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_30.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%B.param_patt: bool) -> %return.param_patt: @Test.%Expect.loc7_30.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_42.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_42.2: init @Test.%Expect.loc7_30.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_43: init @Test.%Expect.loc7_30.2 (%Expect.1) = converted %.loc7_42.1, %.loc7_42.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_43 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc10: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_5.loc10_15: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_5.loc10_18: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int_5.loc10_18, %impl.elem0.loc10 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%int_5.loc10_18) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_5.loc10_18, %.loc10_18.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%int_5.loc10_15, %.loc10_18.2) [template = constants.%true] +// CHECK:STDOUT: %.loc10_20.1: bool = value_of_initializer %int.less_eq.loc10 [template = constants.%true] +// CHECK:STDOUT: %.loc10_20.2: bool = converted %int.less_eq.loc10, %.loc10_20.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_20.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_20.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc10: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_20.4: ref %Expect.2 = temporary %.loc10_20.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc11: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_5.loc11: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_6.loc11: Core.IntLiteral = int_value 6 [template = constants.%int_6.1] +// CHECK:STDOUT: %impl.elem0.loc11: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11: = bound_method %int_6.loc11, %impl.elem0.loc11 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11: = specific_function %Convert.bound.loc11, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11: init %i32 = call %Convert.specific_fn.loc11(%int_6.loc11) [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_18.1: %i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%int_6.2] +// CHECK:STDOUT: %.loc11_18.2: %i32 = converted %int_6.loc11, %.loc11_18.1 [template = constants.%int_6.2] +// CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%int_5.loc11, %.loc11_18.2) [template = constants.%true] +// CHECK:STDOUT: %.loc11_20.1: bool = value_of_initializer %int.less_eq.loc11 [template = constants.%true] +// CHECK:STDOUT: %.loc11_20.2: bool = converted %int.less_eq.loc11, %.loc11_20.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_20.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_20.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc11: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_20.4: ref %Expect.2 = temporary %.loc11_20.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc12: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_6.loc12: Core.IntLiteral = int_value 6 [template = constants.%int_6.1] +// CHECK:STDOUT: %int_5.loc12: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %impl.elem0.loc12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12: = bound_method %int_5.loc12, %impl.elem0.loc12 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12: = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %Convert.specific_fn.loc12(%int_5.loc12) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc12_18.1: %i32 = value_of_initializer %int.convert_checked.loc12 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc12_18.2: %i32 = converted %int_5.loc12, %.loc12_18.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %int.less_eq.loc12: init bool = call %LessEq.ref.loc12(%int_6.loc12, %.loc12_18.2) [template = constants.%false] +// CHECK:STDOUT: %.loc12_20.1: bool = value_of_initializer %int.less_eq.loc12 [template = constants.%false] +// CHECK:STDOUT: %.loc12_20.2: bool = converted %int.less_eq.loc12, %.loc12_20.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_20.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_20.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc12: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_20.4: ref %Expect.3 = temporary %.loc12_20.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc13: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc13_16: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc13_15: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_15: = bound_method %int_1.loc13_16, %impl.elem0.loc13_15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_15: init Core.IntLiteral = call %Op.bound.loc13_15(%int_1.loc13_16) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc13_20: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc13_19.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13_19: = bound_method %int_1.loc13_20, %impl.elem0.loc13_19.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc13_19: init Core.IntLiteral = call %Op.bound.loc13_19(%int_1.loc13_20) [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_15 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_15.2: Core.IntLiteral = converted %int.snegate.loc13_15, %.loc13_15.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc13_19.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13: = bound_method %int.snegate.loc13_19, %impl.elem0.loc13_19.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13: = specific_function %Convert.bound.loc13, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc13_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13_19 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc13_19.2: Core.IntLiteral = converted %int.snegate.loc13_19, %.loc13_19.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc13: init %i32 = call %Convert.specific_fn.loc13(%.loc13_19.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc13_19.3: %i32 = value_of_initializer %int.convert_checked.loc13 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc13_19.4: %i32 = converted %int.snegate.loc13_19, %.loc13_19.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.less_eq.loc13: init bool = call %LessEq.ref.loc13(%.loc13_15.2, %.loc13_19.4) [template = constants.%true] +// CHECK:STDOUT: %.loc13_22.1: bool = value_of_initializer %int.less_eq.loc13 [template = constants.%true] +// CHECK:STDOUT: %.loc13_22.2: bool = converted %int.less_eq.loc13, %.loc13_22.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_22.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_22.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc13: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_22.4: ref %Expect.2 = temporary %.loc13_22.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc14: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc14_16: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc14_15: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14: = bound_method %int_1.loc14_16, %impl.elem0.loc14_15 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc14: init Core.IntLiteral = call %Op.bound.loc14(%int_1.loc14_16) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc14_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %.loc14_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc14_15.2: Core.IntLiteral = converted %int.snegate.loc14, %.loc14_15.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc14_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14: = bound_method %int_1.loc14_19, %impl.elem0.loc14_19 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc14: = specific_function %Convert.bound.loc14, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc14: init %i32 = call %Convert.specific_fn.loc14(%int_1.loc14_19) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_19.1: %i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_19.2: %i32 = converted %int_1.loc14_19, %.loc14_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.less_eq.loc14: init bool = call %LessEq.ref.loc14(%.loc14_15.2, %.loc14_19.2) [template = constants.%true] +// CHECK:STDOUT: %.loc14_21.1: bool = value_of_initializer %int.less_eq.loc14 [template = constants.%true] +// CHECK:STDOUT: %.loc14_21.2: bool = converted %int.less_eq.loc14, %.loc14_21.1 [template = constants.%true] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%true) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc14_21.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.2 = call %Test.specific_fn.loc14() to %.loc14_21.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %true.loc14: bool = bool_literal true [template = constants.%true] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%true) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc14_21.4: ref %Expect.2 = temporary %.loc14_21.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LessEq.ref.loc15: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc15_15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc15_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_18.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15: = bound_method %int_1.loc15_19, %impl.elem0.loc15_18.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc15: init Core.IntLiteral = call %Op.bound.loc15(%int_1.loc15_19) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc15_18.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.snegate.loc15, %impl.elem0.loc15_18.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc15_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_18.2: Core.IntLiteral = converted %int.snegate.loc15, %.loc15_18.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_18.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_18.3: %i32 = value_of_initializer %int.convert_checked.loc15 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_18.4: %i32 = converted %int.snegate.loc15, %.loc15_18.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.less_eq.loc15: init bool = call %LessEq.ref.loc15(%int_1.loc15_15, %.loc15_18.4) [template = constants.%false] +// CHECK:STDOUT: %.loc15_21.1: bool = value_of_initializer %int.less_eq.loc15 [template = constants.%false] +// CHECK:STDOUT: %.loc15_21.2: bool = converted %int.less_eq.loc15, %.loc15_21.1 [template = constants.%false] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%false) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc15_21.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.3 = call %Test.specific_fn.loc15() to %.loc15_21.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %false.loc15: bool = bool_literal false [template = constants.%false] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%false) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc15_21.4: ref %Expect.3 = temporary %.loc15_21.3, %Test.call.loc15 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%B) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%B.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%B) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%B +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%B +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%true) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%true +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%true) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%true +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%true +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%false) { +// CHECK:STDOUT: %B.loc7_9.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc7_9.2 => constants.%false +// CHECK:STDOUT: %Expect.loc7_30.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%false) { +// CHECK:STDOUT: %B.loc6_14.2 => constants.%false +// CHECK:STDOUT: %B.patt.loc6_14.2 => constants.%false +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 654ed666db699..b3bf8cd10611f 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -47,19 +47,19 @@ fn Negate(a: i32) -> i32 = "int.snegate"; // Shift greater than size is disallowed. let size_1: i32 = RightShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 32 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 33 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); // Negative shifts aren't allowed either. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 >> -1 [CompileTimeShiftOutOfRange] +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ let negative: i32 = RightShift(1, Negate(1)); diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 2e9e4df436a39..69bd1b0f5ba27 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -84,7 +84,7 @@ package FailOverflow; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; let a: i32 = Add(0x7FFFFFFF, 0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 2147483647 + 1 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ let b: i32 = Add(0x7FFFFFFF, 1); diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index a834a6133611e..a03bbb08d8bac 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -34,7 +34,7 @@ let a: i32 = Div(Negate(0x7FFF_FFFF), Negate(1)); let b: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), 1); // -0x8000_0000 / -1 overflows. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 / -1 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 514490a086f0f..ed897dd484bcd 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -35,7 +35,7 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1); // -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though // its result is representable. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 % -1 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 28c34a728c36e..67f3241745af9 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -26,7 +26,7 @@ package FailOverflow; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; let a: i32 = Mul(0x7FFF, 0x10000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 32768 * 65536 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow] // CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ let b: i32 = Mul(0x8000, 0x10000); diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 946ff54e71424..117e379d1c0e5 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -27,7 +27,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Sub(0, 0x7FFFFFFF); let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation -2147483647 - 2 [CompileTimeIntegerOverflow] +// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow] // CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index 9359f9c78b4e8..5742f47bc6142 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -305,6 +305,7 @@ CARBON_DIAGNOSTIC_KIND(CompileTimeDivisionByZero) CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeIntegerNegateOverflow) CARBON_DIAGNOSTIC_KIND(CompileTimeFloatBitWidth) +CARBON_DIAGNOSTIC_KIND(CompileTimeShiftNegative) CARBON_DIAGNOSTIC_KIND(CompileTimeShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(CompileTimeUnsizedShiftOutOfRange) CARBON_DIAGNOSTIC_KIND(ContinueOutsideLoop) From 6fbd9b6ae1b21ca2d025641b5193a24a3c9328e3 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 18:46:19 +0000 Subject: [PATCH 04/13] Fix heterogeneous shift lowering. --- toolchain/lower/handle_call.cpp | 53 ++-- toolchain/lower/testdata/builtins/int.carbon | 318 ++++++++++++++----- 2 files changed, 275 insertions(+), 96 deletions(-) diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index 84ffa4653e138..e0f8aa87b54c9 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -84,6 +84,33 @@ static auto IsSignedInt(FunctionContext& context, SemIR::InstId int_id) context.sem_ir().insts().Get(int_id).type_id()); } +// Creates a zext or sext instruction depending on the signedness of the +// operand. +static auto CreateZExtOrSExt(FunctionContext& context, llvm::Value* value, + llvm::Type* type, bool is_signed, + const llvm::Twine& name = "") -> llvm::Value* { + return is_signed ? context.builder().CreateSExt(value, type, name) + : context.builder().CreateZExt(value, type, name); +} + +// Handles a call to a builtin integer bit shift operator. +static auto HandleIntShift(FunctionContext& context, SemIR::InstId inst_id, + llvm::Instruction::BinaryOps bin_op, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) -> void { + llvm::Value* lhs = context.GetValue(lhs_id); + llvm::Value* rhs = GetIntOrIntLiteralValue(context, rhs_id); + + // Weirdly, LLVM requires the operands of bit shift operators to be of the + // same type. We can always use the width of the LHS, because if the RHS + // doesn't fit in that then the cast is out of range anyway. + // + // TODO: In a development build we should trap in that case. + rhs = context.builder().CreateZExtOrTrunc(rhs, lhs->getType(), "rhs"); + + context.SetLocal(inst_id, context.builder().CreateBinOp(bin_op, lhs, rhs)); +} + +// Handles a call to a builtin integer comparison operator. static auto HandleIntComparison(FunctionContext& context, SemIR::InstId inst_id, SemIR::BuiltinFunctionKind builtin_kind, SemIR::InstId lhs_id, SemIR::InstId rhs_id) @@ -118,12 +145,8 @@ static auto HandleIntComparison(FunctionContext& context, SemIR::InstId inst_id, auto* cmp_type = llvm::IntegerType::get(context.llvm_context(), cmp_width); // Widen the operands as needed. - auto zext_or_sext = [&](llvm::Value* value, bool is_signed) { - return is_signed ? context.builder().CreateSExt(value, cmp_type) - : context.builder().CreateZExt(value, cmp_type); - }; - lhs = zext_or_sext(lhs, lhs_signed); - rhs = zext_or_sext(rhs, rhs_signed); + lhs = CreateZExtOrSExt(context, lhs, cmp_type, lhs_signed, "lhs"); + rhs = CreateZExtOrSExt(context, rhs, cmp_type, rhs_signed, "rhs"); context.SetLocal( inst_id, @@ -311,21 +334,15 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, return; } case SemIR::BuiltinFunctionKind::IntLeftShift: { - context.SetLocal(inst_id, - context.builder().CreateShl( - context.GetValue(arg_ids[0]), - GetIntOrIntLiteralValue(context, arg_ids[1]))); + HandleIntShift(context, inst_id, llvm::Instruction::Shl, arg_ids[0], + arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::IntRightShift: { - context.SetLocal(inst_id, - IsSignedInt(context, inst_id) - ? context.builder().CreateAShr( - context.GetValue(arg_ids[0]), - GetIntOrIntLiteralValue(context, arg_ids[1])) - : context.builder().CreateLShr( - context.GetValue(arg_ids[0]), - GetIntOrIntLiteralValue(context, arg_ids[1]))); + HandleIntShift(context, inst_id, + IsSignedInt(context, inst_id) ? llvm::Instruction::AShr + : llvm::Instruction::LShr, + arg_ids[0], arg_ids[1]); return; } case SemIR::BuiltinFunctionKind::IntEq: diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index 51ee33fd7c20f..12d0f65437fa0 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -8,6 +8,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/int.carbon +// --- basic.carbon + +library "[[@TEST_NAME]]"; + fn Negate(a: i32) -> i32 = "int.snegate"; fn TestNegate(a: i32) -> i32 { return Negate(a); } @@ -41,8 +45,11 @@ fn TestXor(a: i32, b: i32) -> i32 { return Xor(a, b); } fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; fn TestLeftShift(a: i32, b: i32) -> i32 { return LeftShift(a, b); } -fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn TestRightShift(a: i32, b: i32) -> i32 { return RightShift(a, b); } +fn ArithmeticRightShift(a: i32, b: i32) -> i32 = "int.right_shift"; +fn TestArithmeticRightShift(a: i32, b: i32) -> i32 { return ArithmeticRightShift(a, b); } + +fn LogicalRightShift(a: u32, b: u32) -> u32 = "int.right_shift"; +fn TestLogicalRightShift(a: u32, b: u32) -> u32 { return LogicalRightShift(a, b); } fn Eq(a: i32, b: i32) -> bool = "int.eq"; fn TestEq(a: i32, b: i32) -> bool { return Eq(a, b); } @@ -62,8 +69,42 @@ fn TestGreater(a: i32, b: i32) -> bool { return Greater(a, b); } fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq"; fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } -// CHECK:STDOUT: ; ModuleID = 'int.carbon' -// CHECK:STDOUT: source_filename = "int.carbon" +// --- mixed_shift.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShiftSmaller(a: i32, b: i16) -> i32 = "int.left_shift"; +fn TestLeftShiftSmaller(a: i32, b: i16) -> i32 { return LeftShiftSmaller(a, b); } + +fn RightShiftSmaller(a: i32, b: i16) -> i32 = "int.right_shift"; +fn TestRightShiftSmaller(a: i32, b: i16) -> i32 { return RightShiftSmaller(a, b); } + +fn LeftShiftLargerII(a: i16, b: i32) -> i16 = "int.left_shift"; +fn TestLeftShiftLargerII(a: i16, b: i32) -> i16 { return LeftShiftLargerII(a, b); } + +fn RightShiftLargerII(a: i16, b: i32) -> i16 = "int.right_shift"; +fn TestRightShiftLargerII(a: i16, b: i32) -> i16 { return RightShiftLargerII(a, b); } + +fn LeftShiftLargerIU(a: i16, b: u32) -> i16 = "int.left_shift"; +fn TestLeftShiftLargerIU(a: i16, b: u32) -> i16 { return LeftShiftLargerIU(a, b); } + +fn RightShiftLargerIU(a: i16, b: u32) -> i16 = "int.right_shift"; +fn TestRightShiftLargerIU(a: i16, b: u32) -> i16 { return RightShiftLargerIU(a, b); } + +fn LeftShiftLargerUI(a: u16, b: i32) -> u16 = "int.left_shift"; +fn TestLeftShiftLargerUI(a: u16, b: i32) -> u16 { return LeftShiftLargerUI(a, b); } + +fn RightShiftLargerUI(a: u16, b: i32) -> u16 = "int.right_shift"; +fn TestRightShiftLargerUI(a: u16, b: i32) -> u16 { return RightShiftLargerUI(a, b); } + +fn LeftShiftLargerUU(a: u16, b: u32) -> u16 = "int.left_shift"; +fn TestLeftShiftLargerUU(a: u16, b: u32) -> u16 { return LeftShiftLargerUU(a, b); } + +fn RightShiftLargerUU(a: u16, b: u32) -> u16 = "int.right_shift"; +fn TestRightShiftLargerUU(a: u16, b: u32) -> u16 { return RightShiftLargerUU(a, b); } + +// CHECK:STDOUT: ; ModuleID = 'basic.carbon' +// CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: // CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) !dbg !4 { // CHECK:STDOUT: entry: @@ -131,46 +172,191 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: ret i32 %int.left_shift, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestRightShift.Main(i32 %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %int.right_shift = ashr i32 %a, %b, !dbg !40 // CHECK:STDOUT: ret i32 %int.right_shift, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift = lshr i32 %a, %b, !dbg !43 +// CHECK:STDOUT: ret i32 %int.right_shift, !dbg !44 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !46 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !47 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !49 +// CHECK:STDOUT: ret i1 %int.neq, !dbg !50 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !52 +// CHECK:STDOUT: ret i1 %int.less, !dbg !53 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !54 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !55 +// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !56 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !57 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !58 +// CHECK:STDOUT: ret i1 %int.greater, !dbg !59 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !60 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !61 +// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !62 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "basic.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 5, column: 39, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 5, column: 32, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 8, column: 44, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 8, column: 37, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 44, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 11, column: 37, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 44, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 37, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 44, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 37, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 44, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 37, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 23, column: 43, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 23, column: 36, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 26, column: 44, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 26, column: 37, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 29, column: 43, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 36, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 32, column: 44, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 32, column: 37, scope: !33) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !37 = !DILocation(line: 35, column: 50, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 35, column: 43, scope: !36) +// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestArithmeticRightShift", linkageName: "_CTestArithmeticRightShift.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !40 = !DILocation(line: 38, column: 61, scope: !39) +// CHECK:STDOUT: !41 = !DILocation(line: 38, column: 54, scope: !39) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestLogicalRightShift", linkageName: "_CTestLogicalRightShift.Main", scope: null, file: !3, line: 41, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !43 = !DILocation(line: 41, column: 58, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 41, column: 51, scope: !42) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 44, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !46 = !DILocation(line: 44, column: 44, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 44, column: 37, scope: !45) +// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 47, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !49 = !DILocation(line: 47, column: 45, scope: !48) +// CHECK:STDOUT: !50 = !DILocation(line: 47, column: 38, scope: !48) +// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 50, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !52 = !DILocation(line: 50, column: 46, scope: !51) +// CHECK:STDOUT: !53 = !DILocation(line: 50, column: 39, scope: !51) +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 53, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !55 = !DILocation(line: 53, column: 48, scope: !54) +// CHECK:STDOUT: !56 = !DILocation(line: 53, column: 41, scope: !54) +// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 56, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !58 = !DILocation(line: 56, column: 49, scope: !57) +// CHECK:STDOUT: !59 = !DILocation(line: 56, column: 42, scope: !57) +// CHECK:STDOUT: !60 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 59, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !61 = !DILocation(line: 59, column: 51, scope: !60) +// CHECK:STDOUT: !62 = !DILocation(line: 59, column: 44, scope: !60) +// CHECK:STDOUT: ; ModuleID = 'mixed_shift.carbon' +// CHECK:STDOUT: source_filename = "mixed_shift.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = zext i16 %b to i32, !dbg !7 +// CHECK:STDOUT: %int.left_shift = shl i32 %a, %int.left_shift.rhs, !dbg !7 +// CHECK:STDOUT: ret i32 %int.left_shift, !dbg !8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) !dbg !9 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = zext i16 %b to i32, !dbg !10 +// CHECK:STDOUT: %int.right_shift = ashr i32 %a, %int.right_shift.rhs, !dbg !10 +// CHECK:STDOUT: ret i32 %int.right_shift, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !13 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !13 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !16 +// CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !16 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.eq = icmp eq i32 %a, %b, !dbg !43 -// CHECK:STDOUT: ret i1 %int.eq, !dbg !44 +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !19 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !19 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) !dbg !21 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.neq = icmp ne i32 %a, %b, !dbg !46 -// CHECK:STDOUT: ret i1 %int.neq, !dbg !47 +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !22 +// CHECK:STDOUT: %int.right_shift = ashr i16 %a, %int.right_shift.rhs, !dbg !22 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less = icmp slt i32 %a, %b, !dbg !49 -// CHECK:STDOUT: ret i1 %int.less, !dbg !50 +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !25 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !25 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) !dbg !27 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.less_eq = icmp sle i32 %a, %b, !dbg !52 -// CHECK:STDOUT: ret i1 %int.less_eq, !dbg !53 +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !28 +// CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !28 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !54 { +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) !dbg !30 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater = icmp sgt i32 %a, %b, !dbg !55 -// CHECK:STDOUT: ret i1 %int.greater, !dbg !56 +// CHECK:STDOUT: %int.left_shift.rhs = trunc i32 %b to i16, !dbg !31 +// CHECK:STDOUT: %int.left_shift = shl i16 %a, %int.left_shift.rhs, !dbg !31 +// CHECK:STDOUT: ret i16 %int.left_shift, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !57 { +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.greater_eq = icmp sge i32 %a, %b, !dbg !58 -// CHECK:STDOUT: ret i1 %int.greater_eq, !dbg !59 +// CHECK:STDOUT: %int.right_shift.rhs = trunc i32 %b to i16, !dbg !34 +// CHECK:STDOUT: %int.right_shift = lshr i16 %a, %int.right_shift.rhs, !dbg !34 +// CHECK:STDOUT: ret i16 %int.right_shift, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} @@ -179,60 +365,36 @@ fn TestGreaterEq(a: i32, b: i32) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "int.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", linkageName: "_CTestNegate.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !3 = !DIFile(filename: "mixed_shift.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestLeftShiftSmaller", linkageName: "_CTestLeftShiftSmaller.Main", scope: null, file: !3, line: 5, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 39, scope: !4) -// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 32, scope: !4) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestAdd", linkageName: "_CTestAdd.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 44, scope: !9) -// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 37, scope: !9) -// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestSub", linkageName: "_CTestSub.Main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !13 = !DILocation(line: 18, column: 44, scope: !12) -// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 37, scope: !12) -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestMul", linkageName: "_CTestMul.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !16 = !DILocation(line: 21, column: 44, scope: !15) -// CHECK:STDOUT: !17 = !DILocation(line: 21, column: 37, scope: !15) -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestDiv", linkageName: "_CTestDiv.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !19 = !DILocation(line: 24, column: 44, scope: !18) -// CHECK:STDOUT: !20 = !DILocation(line: 24, column: 37, scope: !18) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestMod", linkageName: "_CTestMod.Main", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 44, scope: !21) -// CHECK:STDOUT: !23 = !DILocation(line: 27, column: 37, scope: !21) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestComplement", linkageName: "_CTestComplement.Main", scope: null, file: !3, line: 30, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !25 = !DILocation(line: 30, column: 43, scope: !24) -// CHECK:STDOUT: !26 = !DILocation(line: 30, column: 36, scope: !24) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestAnd", linkageName: "_CTestAnd.Main", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 44, scope: !27) -// CHECK:STDOUT: !29 = !DILocation(line: 33, column: 37, scope: !27) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestOr", linkageName: "_CTestOr.Main", scope: null, file: !3, line: 36, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 43, scope: !30) -// CHECK:STDOUT: !32 = !DILocation(line: 36, column: 36, scope: !30) -// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestXor", linkageName: "_CTestXor.Main", scope: null, file: !3, line: 39, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !34 = !DILocation(line: 39, column: 44, scope: !33) -// CHECK:STDOUT: !35 = !DILocation(line: 39, column: 37, scope: !33) -// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "TestLeftShift", linkageName: "_CTestLeftShift.Main", scope: null, file: !3, line: 42, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !37 = !DILocation(line: 42, column: 50, scope: !36) -// CHECK:STDOUT: !38 = !DILocation(line: 42, column: 43, scope: !36) -// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "TestRightShift", linkageName: "_CTestRightShift.Main", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !40 = !DILocation(line: 45, column: 51, scope: !39) -// CHECK:STDOUT: !41 = !DILocation(line: 45, column: 44, scope: !39) -// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "TestEq", linkageName: "_CTestEq.Main", scope: null, file: !3, line: 48, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !43 = !DILocation(line: 48, column: 44, scope: !42) -// CHECK:STDOUT: !44 = !DILocation(line: 48, column: 37, scope: !42) -// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "TestNeq", linkageName: "_CTestNeq.Main", scope: null, file: !3, line: 51, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !46 = !DILocation(line: 51, column: 45, scope: !45) -// CHECK:STDOUT: !47 = !DILocation(line: 51, column: 38, scope: !45) -// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "TestLess", linkageName: "_CTestLess.Main", scope: null, file: !3, line: 54, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !49 = !DILocation(line: 54, column: 46, scope: !48) -// CHECK:STDOUT: !50 = !DILocation(line: 54, column: 39, scope: !48) -// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "TestLessEq", linkageName: "_CTestLessEq.Main", scope: null, file: !3, line: 57, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !52 = !DILocation(line: 57, column: 48, scope: !51) -// CHECK:STDOUT: !53 = !DILocation(line: 57, column: 41, scope: !51) -// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "TestGreater", linkageName: "_CTestGreater.Main", scope: null, file: !3, line: 60, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !55 = !DILocation(line: 60, column: 49, scope: !54) -// CHECK:STDOUT: !56 = !DILocation(line: 60, column: 42, scope: !54) -// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "TestGreaterEq", linkageName: "_CTestGreaterEq.Main", scope: null, file: !3, line: 63, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !58 = !DILocation(line: 63, column: 51, scope: !57) -// CHECK:STDOUT: !59 = !DILocation(line: 63, column: 44, scope: !57) +// CHECK:STDOUT: !7 = !DILocation(line: 5, column: 57, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 5, column: 50, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestRightShiftSmaller", linkageName: "_CTestRightShiftSmaller.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 8, column: 58, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 8, column: 51, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestLeftShiftLargerII", linkageName: "_CTestLeftShiftLargerII.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 11, column: 58, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 11, column: 51, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestRightShiftLargerII", linkageName: "_CTestRightShiftLargerII.Main", scope: null, file: !3, line: 14, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 59, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 52, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestLeftShiftLargerIU", linkageName: "_CTestLeftShiftLargerIU.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 58, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 51, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestRightShiftLargerIU", linkageName: "_CTestRightShiftLargerIU.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 59, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 52, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLeftShiftLargerUI", linkageName: "_CTestLeftShiftLargerUI.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 23, column: 58, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 23, column: 51, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestRightShiftLargerUI", linkageName: "_CTestRightShiftLargerUI.Main", scope: null, file: !3, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 26, column: 59, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 26, column: 52, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLeftShiftLargerUU", linkageName: "_CTestLeftShiftLargerUU.Main", scope: null, file: !3, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 29, column: 58, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 51, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestRightShiftLargerUU", linkageName: "_CTestRightShiftLargerUU.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 32, column: 59, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 32, column: 52, scope: !33) From d25730f47db83d987216c9e6e47de7159e61169a Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 19:55:18 +0000 Subject: [PATCH 05/13] More testing. Stop trying to allow operations on IntLiterals to be lowered. That's not possible in general because we don't necessarily have a value at runtime for the IntLiteral. --- toolchain/check/eval.cpp | 12 +- .../check/testdata/builtins/int/and.carbon | 478 ++- .../testdata/builtins/int/left_shift.carbon | 3079 +++++++++++++---- .../testdata/builtins/int/right_shift.carbon | 2211 ++++++++++-- .../check/testdata/builtins/int/sadd.carbon | 873 ++++- .../check/testdata/builtins/int/smul.carbon | 1122 +++++- .../testdata/builtins/int/snegate.carbon | 377 +- toolchain/lower/handle_call.cpp | 28 +- .../testdata/builtins/int_literal.carbon | 22 + toolchain/sem_ir/builtin_function_kind.cpp | 15 + toolchain/sem_ir/builtin_function_kind.h | 3 +- 11 files changed, 6996 insertions(+), 1224 deletions(-) diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 39556ed85f37a..9cb1f2989e2ea 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -1029,13 +1029,15 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, lhs_val.getSignificantBits() + *width)); } - result_val = lhs_val.shl(rhs_orig_val); + result_val = lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); } else if (lhs_is_signed) { - result_val = lhs_val.ashr(rhs_orig_val); + result_val = + lhs_val.ashr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); } else { CARBON_CHECK(lhs_bit_width_id.is_valid(), "Logical shift on unsized int"); - result_val = lhs_val.lshr(rhs_orig_val); + result_val = + lhs_val.lshr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); } return MakeIntResult(context, lhs.type_id, lhs_is_signed, std::move(result_val)); @@ -1428,7 +1430,9 @@ static auto MakeConstantForCall(EvalContext& eval_context, SemIRLoc loc, // If any operand of the call is non-constant, the call is non-constant. // TODO: Some builtin calls might allow some operands to be non-constant. if (!has_constant_operands) { - if (builtin_kind.IsCompTimeOnly(eval_context.sem_ir(), call.type_id)) { + if (builtin_kind.IsCompTimeOnly( + eval_context.sem_ir(), eval_context.inst_blocks().Get(call.args_id), + call.type_id)) { CARBON_DIAGNOSTIC(NonConstantCallToCompTimeOnlyFunction, Error, "non-constant call to compile-time-only function"); CARBON_DIAGNOSTIC(CompTimeOnlyFunctionHere, Note, diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 9cf404b1c7bf0..e1e6057da58f0 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -25,14 +25,21 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { library "[[@TEST_NAME]]"; -fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; +fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } -var arr_lit: [i32; AndLit(12, 10)]; -let arr_lit_p: [i32; 8]* = &arr_lit; +fn F() { + Test(And(1, 2)) as Expect(0); + Test(And(12, 10)) as Expect(8); -// & between a positive and negative literal should produce a positive value. -var arr_lit_large: [i32; AndLit(0x8000_0000_0000_0000, -1) >> 48]*; -let arr_lit_large_p: [i32; 0x8000]* = arr_lit_large; + Test(And(1, -1)) as Expect(1); + Test(And(-2, -3)) as Expect(-4); + // Ensure the sign bit is treated properly even for 64-bit numbers. + Test(And(0x7FFF_FFFF_FFFF_FFFF, -3)) as Expect(0x7FFF_FFFF_FFFF_FFFD); + Test(And(0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); +} // --- fail_literal_runtime.carbon @@ -205,40 +212,68 @@ fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %AndLit.type: type = fn_type @AndLit [template] -// CHECK:STDOUT: %AndLit: %AndLit.type = struct_value () [template] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %And.type: type = fn_type @And [template] +// CHECK:STDOUT: %And: %And.type = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template] -// CHECK:STDOUT: %array_type.1: type = array_type %int_8, %i32 [template] -// CHECK:STDOUT: %ptr.1: type = ptr_type %array_type.1 [template] -// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_8) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_8) [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] // CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] -// CHECK:STDOUT: %int_48: Core.IntLiteral = int_value 48 [template] -// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.3 [template] -// CHECK:STDOUT: %Op.type.4: type = fn_type @Op.4 [template] -// CHECK:STDOUT: %Op.4: %Op.type.4 = struct_value () [template] -// CHECK:STDOUT: %interface.2: = interface_witness (%Op.4) [template] -// CHECK:STDOUT: %Op.bound.2: = bound_method %int_9223372036854775808, %Op.4 [template] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template] -// CHECK:STDOUT: %array_type.2: type = array_type %int_32768, %i32 [template] -// CHECK:STDOUT: %ptr.2: type = ptr_type %array_type.2 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_1) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2, %Op.2 [template] +// CHECK:STDOUT: %int_-2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_3, %Op.2 [template] +// CHECK:STDOUT: %int_-3: Core.IntLiteral = int_value -3 [template] +// CHECK:STDOUT: %int_-4: Core.IntLiteral = int_value -4 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_-4) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_-4) [template] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_4, %Op.2 [template] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] +// CHECK:STDOUT: %int_9223372036854775805: Core.IntLiteral = int_value 9223372036854775805 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_9223372036854775805) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_9223372036854775805) [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .IntLiteral = %import_ref.1 -// CHECK:STDOUT: .Int = %import_ref.2 -// CHECK:STDOUT: .Negate = %import_ref.6 -// CHECK:STDOUT: .RightShift = %import_ref.44 +// CHECK:STDOUT: .Negate = %import_ref.2 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -248,14 +283,13 @@ fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .AndLit = %AndLit.decl -// CHECK:STDOUT: .arr_lit = %arr_lit -// CHECK:STDOUT: .arr_lit_p = @__global_init.%arr_lit_p -// CHECK:STDOUT: .arr_lit_large = %arr_lit_large -// CHECK:STDOUT: .arr_lit_large_p = @__global_init.%arr_lit_large_p +// CHECK:STDOUT: .And = %And.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %AndLit.decl: %AndLit.type = fn_decl @AndLit [template = constants.%AndLit] { +// CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] { // CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a // CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b @@ -263,21 +297,21 @@ fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %Core.ref.loc4_58: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_62: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_74: init type = call %IntLiteral.ref.loc4_62() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_74.1: type = value_of_initializer %int_literal.make_type.loc4_74 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_74.2: type = converted %int_literal.make_type.loc4_74, %.loc4_74.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_11: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_15: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_27: init type = call %IntLiteral.ref.loc4_15() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int_literal.make_type.loc4_27 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int_literal.make_type.loc4_27, %.loc4_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_33: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_37: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_49: init type = call %IntLiteral.ref.loc4_37() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.1: type = value_of_initializer %int_literal.make_type.loc4_49 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.2: type = converted %int_literal.make_type.loc4_49, %.loc4_49.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_55: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_59: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_71: init type = call %IntLiteral.ref.loc4_59() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.1: type = value_of_initializer %int_literal.make_type.loc4_71 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.2: type = converted %int_literal.make_type.loc4_71, %.loc4_71.1 [template = Core.IntLiteral] // CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 // CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param // CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 @@ -285,63 +319,309 @@ fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %AndLit.ref.loc6: %AndLit.type = name_ref AndLit, %AndLit.decl [template = constants.%AndLit] +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @And(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc10: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_2.loc10: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.and.loc10: init Core.IntLiteral = call %And.ref.loc10(%int_1.loc10, %int_2.loc10) [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.1: Core.IntLiteral = value_of_initializer %int.and.loc10 [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.2: Core.IntLiteral = converted %int.and.loc10, %.loc10_17.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc11: %And.type = name_ref And, file.%And.decl [template = constants.%And] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] -// CHECK:STDOUT: %int.and.loc6: init Core.IntLiteral = call %AndLit.ref.loc6(%int_12, %int_10) [template = constants.%int_8] -// CHECK:STDOUT: %.loc6_33.1: Core.IntLiteral = value_of_initializer %int.and.loc6 [template = constants.%int_8] -// CHECK:STDOUT: %.loc6_33.2: Core.IntLiteral = converted %int.and.loc6, %.loc6_33.1 [template = constants.%int_8] -// CHECK:STDOUT: %array_type.loc6: type = array_type %.loc6_33.2, %i32 [template = constants.%array_type.1] -// CHECK:STDOUT: %arr_lit.var: ref %array_type.1 = var arr_lit -// CHECK:STDOUT: %arr_lit: ref %array_type.1 = bind_name arr_lit, %arr_lit.var -// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int.and.loc11: init Core.IntLiteral = call %And.ref.loc11(%int_12, %int_10) [template = constants.%int_8] +// CHECK:STDOUT: %.loc11_19.1: Core.IntLiteral = value_of_initializer %int.and.loc11 [template = constants.%int_8] +// CHECK:STDOUT: %.loc11_19.2: Core.IntLiteral = converted %int.and.loc11, %.loc11_19.1 [template = constants.%int_8] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_8) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_19.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_19.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8] -// CHECK:STDOUT: %array_type.loc7: type = array_type %int_8, %i32 [template = constants.%array_type.1] -// CHECK:STDOUT: %ptr.loc7: type = ptr_type %array_type.1 [template = constants.%ptr.1] -// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %AndLit.ref.loc10: %AndLit.type = name_ref AndLit, %AndLit.decl [template = constants.%AndLit] -// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %impl.elem0.loc10_56: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc10_56: = bound_method %int_1, %impl.elem0.loc10_56 [template = constants.%Op.bound.1] -// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound.loc10_56(%int_1) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_56.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_56.2: Core.IntLiteral = converted %int.snegate, %.loc10_56.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.and.loc10: init Core.IntLiteral = call %AndLit.ref.loc10(%int_9223372036854775808, %.loc10_56.2) [template = constants.%int_9223372036854775808] -// CHECK:STDOUT: %int_48: Core.IntLiteral = int_value 48 [template = constants.%int_48] -// CHECK:STDOUT: %impl.elem0.loc10_60: %Op.type.3 = interface_witness_access constants.%interface.2, element0 [template = constants.%Op.4] -// CHECK:STDOUT: %Op.bound.loc10_60: = bound_method %int.and.loc10, %impl.elem0.loc10_60 [template = constants.%Op.bound.2] -// CHECK:STDOUT: %.loc10_58.1: Core.IntLiteral = value_of_initializer %int.and.loc10 [template = constants.%int_9223372036854775808] -// CHECK:STDOUT: %.loc10_58.2: Core.IntLiteral = converted %int.and.loc10, %.loc10_58.1 [template = constants.%int_9223372036854775808] -// CHECK:STDOUT: %int.right_shift: init Core.IntLiteral = call %Op.bound.loc10_60(%.loc10_58.2, %int_48) [template = constants.%int_32768] -// CHECK:STDOUT: %.loc10_60.1: Core.IntLiteral = value_of_initializer %int.right_shift [template = constants.%int_32768] -// CHECK:STDOUT: %.loc10_60.2: Core.IntLiteral = converted %int.right_shift, %.loc10_60.1 [template = constants.%int_32768] -// CHECK:STDOUT: %array_type.loc10: type = array_type %.loc10_60.2, %i32 [template = constants.%array_type.2] -// CHECK:STDOUT: %ptr.loc10: type = ptr_type %array_type.2 [template = constants.%ptr.2] -// CHECK:STDOUT: %arr_lit_large.var: ref %ptr.2 = var arr_lit_large -// CHECK:STDOUT: %arr_lit_large: ref %ptr.2 = bind_name arr_lit_large, %arr_lit_large.var -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [template = constants.%int_32768] -// CHECK:STDOUT: %array_type.loc11: type = array_type %int_32768, %i32 [template = constants.%array_type.2] -// CHECK:STDOUT: %ptr.loc11: type = ptr_type %array_type.2 [template = constants.%ptr.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_8) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_19.4: ref %Expect.3 = temporary %.loc11_19.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc13: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_1.loc13_12: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc13_16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc13: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc13: = bound_method %int_1.loc13_16, %impl.elem0.loc13 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc13: init Core.IntLiteral = call %Op.bound.loc13(%int_1.loc13_16) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_15.1: Core.IntLiteral = value_of_initializer %int.snegate.loc13 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc13_15.2: Core.IntLiteral = converted %int.snegate.loc13, %.loc13_15.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.and.loc13: init Core.IntLiteral = call %And.ref.loc13(%int_1.loc13_12, %.loc13_15.2) [template = constants.%int_1] +// CHECK:STDOUT: %.loc13_18.1: Core.IntLiteral = value_of_initializer %int.and.loc13 [template = constants.%int_1] +// CHECK:STDOUT: %.loc13_18.2: Core.IntLiteral = converted %int.and.loc13, %.loc13_18.1 [template = constants.%int_1] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc13_18.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.4 = call %Test.specific_fn.loc13() to %.loc13_18.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc13_30: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc13_18.4: ref %Expect.4 = temporary %.loc13_18.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc14: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %impl.elem0.loc14_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14_12: = bound_method %int_2.loc14, %impl.elem0.loc14_12 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc14_12: init Core.IntLiteral = call %Op.bound.loc14_12(%int_2.loc14) [template = constants.%int_-2] +// CHECK:STDOUT: %int_3.loc14: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc14_16: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14_16: = bound_method %int_3.loc14, %impl.elem0.loc14_16 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc14_16: init Core.IntLiteral = call %Op.bound.loc14_16(%int_3.loc14) [template = constants.%int_-3] +// CHECK:STDOUT: %.loc14_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14_12 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc14_12.2: Core.IntLiteral = converted %int.snegate.loc14_12, %.loc14_12.1 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc14_16.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14_16 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc14_16.2: Core.IntLiteral = converted %int.snegate.loc14_16, %.loc14_16.1 [template = constants.%int_-3] +// CHECK:STDOUT: %int.and.loc14: init Core.IntLiteral = call %And.ref.loc14(%.loc14_12.2, %.loc14_16.2) [template = constants.%int_-4] +// CHECK:STDOUT: %.loc14_19.1: Core.IntLiteral = value_of_initializer %int.and.loc14 [template = constants.%int_-4] +// CHECK:STDOUT: %.loc14_19.2: Core.IntLiteral = converted %int.and.loc14, %.loc14_19.1 [template = constants.%int_-4] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_-4) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc14_19.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.5 = call %Test.specific_fn.loc14() to %.loc14_19.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %impl.elem0.loc14_31: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc14_31: = bound_method %int_4, %impl.elem0.loc14_31 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc14_31: init Core.IntLiteral = call %Op.bound.loc14_31(%int_4) [template = constants.%int_-4] +// CHECK:STDOUT: %.loc14_33.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14_31 [template = constants.%int_-4] +// CHECK:STDOUT: %.loc14_33.2: Core.IntLiteral = converted %int.snegate.loc14_31, %.loc14_33.1 [template = constants.%int_-4] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_-4) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc14_19.4: ref %Expect.5 = temporary %.loc14_19.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc16: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int_3.loc16: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc16: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16: = bound_method %int_3.loc16, %impl.elem0.loc16 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc16: init Core.IntLiteral = call %Op.bound.loc16(%int_3.loc16) [template = constants.%int_-3] +// CHECK:STDOUT: %.loc16_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc16_35.2: Core.IntLiteral = converted %int.snegate.loc16, %.loc16_35.1 [template = constants.%int_-3] +// CHECK:STDOUT: %int.and.loc16: init Core.IntLiteral = call %And.ref.loc16(%int_9223372036854775807, %.loc16_35.2) [template = constants.%int_9223372036854775805] +// CHECK:STDOUT: %.loc16_38.1: Core.IntLiteral = value_of_initializer %int.and.loc16 [template = constants.%int_9223372036854775805] +// CHECK:STDOUT: %.loc16_38.2: Core.IntLiteral = converted %int.and.loc16, %.loc16_38.1 [template = constants.%int_9223372036854775805] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_9223372036854775805) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc16_38.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.6 = call %Test.specific_fn.loc16() to %.loc16_38.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775805: Core.IntLiteral = int_value 9223372036854775805 [template = constants.%int_9223372036854775805] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_9223372036854775805) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc16_38.4: ref %Expect.6 = temporary %.loc16_38.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %And.ref.loc17: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_9223372036854775808.loc17_12: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc17: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17: = bound_method %int_1.loc17, %impl.elem0.loc17 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc17: init Core.IntLiteral = call %Op.bound.loc17(%int_1.loc17) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc17_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc17_35.2: Core.IntLiteral = converted %int.snegate.loc17, %.loc17_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.and.loc17: init Core.IntLiteral = call %And.ref.loc17(%int_9223372036854775808.loc17_12, %.loc17_35.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc17_38.1: Core.IntLiteral = value_of_initializer %int.and.loc17 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc17_38.2: Core.IntLiteral = converted %int.and.loc17, %.loc17_38.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc17_38.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.7 = call %Test.specific_fn.loc17() to %.loc17_38.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc17_50: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc17_38.4: ref %Expect.7 = temporary %.loc17_38.3, %Test.call.loc17 +// CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @AndLit(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr_lit.ref: ref %array_type.1 = name_ref arr_lit, file.%arr_lit -// CHECK:STDOUT: %addr: %ptr.1 = addr_of %arr_lit.ref -// CHECK:STDOUT: %arr_lit_p: %ptr.1 = bind_name arr_lit_p, %addr -// CHECK:STDOUT: %arr_lit_large.ref: ref %ptr.2 = name_ref arr_lit_large, file.%arr_lit_large -// CHECK:STDOUT: %.loc11: %ptr.2 = bind_value %arr_lit_large.ref -// CHECK:STDOUT: %arr_lit_large_p: %ptr.2 = bind_name arr_lit_large_p, %.loc11 -// CHECK:STDOUT: return +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_8) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_8 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_8 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_8) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_8 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-4) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-4 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-4 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-4) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-4 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775805) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775805 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775805 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775805) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775805 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775805 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_literal_runtime.carbon diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 0b0c0216418ad..d7d963753ec3b 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -8,29 +8,102 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/left_shift.carbon -// --- int_left_shift.carbon +// --- i32.carbon library "[[@TEST_NAME]]"; +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } + fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; -var arr: [i32; LeftShift(5, 2)]; -let arr_p: [i32; 20]* = &arr; +fn F() { + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + Test(LeftShift(-1, 1)) as Expect(-2); + Test(LeftShift(-2, 1)) as Expect(-4); + Test(LeftShift(-3, 1)) as Expect(-6); +} fn RuntimeCall(a: i32, b: i32) -> i32 { return LeftShift(a, b); } -// TODO: Test mixed types for LHS and RHS. +// --- u32.carbon + +library "[[@TEST_NAME]]"; + +class Expect(N:! u32) {} +fn Test(N:! u32) -> Expect(N) { return {}; } + +fn LeftShift(a: u32, b: i32) -> u32 = "int.left_shift"; + +fn F() { + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + Test(LeftShift(0xFFFF_FFFF, 1)) as Expect(0xFFFF_FFFE); + Test(LeftShift(0xFFFF_FFFE, 1)) as Expect(0xFFFF_FFFC); + Test(LeftShift(0xABCD_EF01, 8)) as Expect(0xCDEF_0100); +} + +fn RuntimeCall(a: u32, b: i32) -> u32 { + return LeftShift(a, b); +} + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + // Zero can be shifted by any amount. + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 0)) as Expect(0); + Test(LeftShift(0, 1)) as Expect(0); + Test(LeftShift(0, 30)) as Expect(0); + Test(LeftShift(0, 1_000_000_000)) as Expect(0); + + // Positive numbers can be shifted. + Test(LeftShift(1, 0)) as Expect(1); + Test(LeftShift(1, 1)) as Expect(2); + Test(LeftShift(2, 1)) as Expect(4); + Test(LeftShift(1, 2)) as Expect(4); + Test(LeftShift(3, 2)) as Expect(12); + Test(LeftShift(1, 30)) as Expect(0x4000_0000); + Test(LeftShift(5, 2)) as Expect(20); + + // Negative numbers can be shifted too. + Test(LeftShift(-1, 0)) as Expect(-1); + Test(LeftShift(-1, 1)) as Expect(-2); + Test(LeftShift(-2, 1)) as Expect(-4); + Test(LeftShift(-3, 1)) as Expect(-6); + + // Large numbers can be shifted losslessly. + Test(LeftShift(0xFFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFE); + Test(LeftShift(0xFFFF_FFFE, 1)) as Expect(0x1_FFFF_FFFC); + Test(LeftShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF_0100); + Test(LeftShift(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0xFFFF_FFFF_FFFF_FFFE); + Test(LeftShift(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFF_FFFF_FFFE); +} // --- fail_bad_shift.carbon -package BadShift; +library "[[@TEST_NAME]]"; fn LeftShift(a: i32, b: i32) -> i32 = "int.left_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn LeftShiftLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; -// Shift greater than size is disallowed. +// Shift greater than size is disallowed for sized types. let size_1: i32 = LeftShift(1, 31); // CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); @@ -59,114 +132,206 @@ let no_overflow_1: i32 = LeftShift(0, 31); // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); -// Negative shifts aren't allowed either. +// Negative shifts aren't allowed either, even for literals, even if the lhs is zero. // CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: let negative: i32 = LeftShift(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative: i32 = LeftShift(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative_zero: i32 = LeftShift(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~ // CHECK:STDERR: -let negative: i32 = LeftShift(1, Negate(1)); +let negative_zero: i32 = LeftShift(0, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:39: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit: Core.IntLiteral() = LeftShiftLit(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit: Core.IntLiteral() = LeftShiftLit(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:44: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral() = LeftShiftLit(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit_zero: Core.IntLiteral() = LeftShiftLit(0, -1); -// --- literal.carbon +// --- fail_literal_overflow.carbon library "[[@TEST_NAME]]"; fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; -class Expect(N:! Core.IntLiteral()) {} -// CHECK:STDERR: literal.carbon:[[@LINE+4]]:13: error: expression cannot be used as a value [UseOfNonExprAsValue] -// CHECK:STDERR: fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; } -// CHECK:STDERR: ^~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:16: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad: i32 = LeftShift(1, 1_000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -fn Test(N:! Core.IntLiteral) -> Expect(N) { return {}; } - -fn F() { - // Zero can be shifted by any amount. - Test(LeftShift(0, 0)) as Expect(0); - Test(LeftShift(0, 1000000000000)) as Expect(0); +let bad: i32 = LeftShift(1, 1_000_000_000); - // Positive numbers can be shifted. - Test(LeftShift(1, 0)) as Expect(1); - Test(LeftShift(1, 1)) as Expect(2); - Test(LeftShift(2, 1)) as Expect(4); - Test(LeftShift(1, 2)) as Expect(4); - Test(LeftShift(3, 1)) as Expect(12); - - // Negative numbers can be shifted too. - Test(LeftShift(-1, 0)) as Expect(-1); - Test(LeftShift(-1, 1)) as Expect(-2); - Test(LeftShift(-2, 1)) as Expect(-4); - Test(LeftShift(-3, 1)) as Expect(-5); +// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+4]]:25: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 1_000_000_000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad_negative: i32 = LeftShift(-1, 1_000_000_000); - // Large numbers can be shifted. - Test(LeftShift(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0xFFFF_FFFF_FFFF_FFFE); - Test(LeftShift(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_FFFF_FFFF_FFFF_FFFE); -} -// --- literal_negative.carbon +// --- fail_comp_time_only_shift.carbon library "[[@TEST_NAME]]"; -fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; - -// CHECK:STDERR: literal_negative.carbon:[[@LINE+4]]:16: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] -// CHECK:STDERR: let bad: i32 = LeftShift(1, -1); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~ -// CHECK:STDERR: -let bad: i32 = LeftShift(1, -1); +fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; -// --- literal_overflow.carbon +var a_lit: Core.IntLiteral() = 12; +var an_i32: i32 = 34; -library "[[@TEST_NAME]]"; +// This can't be valid: we don't have a compile-time or runtime integer value for `n`. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-10]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad1: i32 = LeftShiftByLit(an_i32, a_lit); -fn LeftShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.left_shift"; +// TODO: This could be valid because we don't actually need the return value at runtime. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:31: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad2: Core.IntLiteral() = LeftShiftOfLit(a_lit, an_i32); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-19]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let bad2: Core.IntLiteral() = LeftShiftOfLit(a_lit, an_i32); -// CHECK:STDERR: literal_overflow.carbon:[[@LINE+4]]:16: error: shift distance of 4000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] -// CHECK:STDERR: let bad: i32 = LeftShift(1, 4000_000_000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// TODO: This could be valid because the literal argument has a constant value. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad3: i32 = LeftShiftByLit(an_i32, 12); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-30]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftByLit(a: i32, b: Core.IntLiteral()) -> i32 = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -let bad: i32 = LeftShift(1, 4000_000_000); +let bad3: i32 = LeftShiftByLit(an_i32, 12); -// CHECK:STDERR: literal_overflow.carbon:[[@LINE+3]]:25: error: shift distance of 4000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] -// CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 4000_000_000); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ -let bad_negative: i32 = LeftShift(-1, 4000_000_000); +// TODO: This could be valid because we don't actually need the return value at runtime. +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+6]]:31: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: let bad4: Core.IntLiteral() = LeftShiftOfLit(12, an_i32); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-39]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left_shift"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +let bad4: Core.IntLiteral() = LeftShiftOfLit(12, an_i32); -// CHECK:STDOUT: --- int_left_shift.carbon +// CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %N.2: %i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.2: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] // CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] // CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %int_30.1: Core.IntLiteral = int_value 30 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_30.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_30.2: %i32 = int_value 30 [template] +// CHECK:STDOUT: %int_1073741824.1: %i32 = int_value 1073741824 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1073741824.1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1073741824.1) [template] +// CHECK:STDOUT: %int_1073741824.2: Core.IntLiteral = int_value 1073741824 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_1073741824.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] // CHECK:STDOUT: %int_20.1: %i32 = int_value 20 [template] -// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.3, @impl.2(%int_32) [template] -// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.11) [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_20.1, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.3(%int_32) [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_20.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_20.1) [template] // CHECK:STDOUT: %int_20.2: Core.IntLiteral = int_value 20 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_20.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_20.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.8: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.8: = specific_function %Convert.bound.8, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_-2.1: %i32 = int_value -2 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_-2.1) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_-2.1) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2.1, %Op.2 [template] +// CHECK:STDOUT: %int_-2.2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %Convert.bound.9: = bound_method %int_-2.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.9: = specific_function %Convert.bound.9, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-4.1: %i32 = int_value -4 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_-4.1) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_-4.1) [template] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_4, %Op.2 [template] +// CHECK:STDOUT: %int_-4.2: Core.IntLiteral = int_value -4 [template] +// CHECK:STDOUT: %Convert.bound.10: = bound_method %int_-4.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.10: = specific_function %Convert.bound.10, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_3, %Op.2 [template] +// CHECK:STDOUT: %int_-3.1: Core.IntLiteral = int_value -3 [template] +// CHECK:STDOUT: %Convert.bound.11: = bound_method %int_-3.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.11: = specific_function %Convert.bound.11, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-3.2: %i32 = int_value -3 [template] +// CHECK:STDOUT: %int_-6.1: %i32 = int_value -6 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_-6.1) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_-6.1) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Op.bound.5: = bound_method %int_6, %Op.2 [template] +// CHECK:STDOUT: %int_-6.2: Core.IntLiteral = int_value -6 [template] +// CHECK:STDOUT: %Convert.bound.12: = bound_method %int_-6.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.12: = specific_function %Convert.bound.12, @Convert.2(%int_32) [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -175,12 +340,38 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: .LeftShift = %LeftShift.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc4_14.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc4_14.1, runtime_param [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc4_14.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc5_9.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc5_9.1, runtime_param [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc5_9.1 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc5_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc5_9.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc5_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -189,12 +380,12 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc4_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -202,40 +393,7 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, %LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc6_26: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_26: = bound_method %int_5, %impl.elem0.loc6_26 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc6_26: = specific_function %Convert.bound.loc6_26, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc6_26: init %i32 = call %Convert.specific_fn.loc6_26(%int_5) [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc6_26.1: %i32 = value_of_initializer %int.convert_checked.loc6_26 [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc6_26.2: %i32 = converted %int_5, %.loc6_26.1 [template = constants.%int_5.2] -// CHECK:STDOUT: %impl.elem0.loc6_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc6_29: = bound_method %int_2, %impl.elem0.loc6_29 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc6_29: = specific_function %Convert.bound.loc6_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc6_29: init %i32 = call %Convert.specific_fn.loc6_29(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc6_29.1: %i32 = value_of_initializer %int.convert_checked.loc6_29 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc6_29.2: %i32 = converted %int_2, %.loc6_29.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%.loc6_26.2, %.loc6_29.2) [template = constants.%int_20.1] -// CHECK:STDOUT: %impl.elem0.loc6_30: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc6_30: = bound_method %int.left_shift, %impl.elem0.loc6_30 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc6_30: = specific_function %Convert.bound.loc6_30, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc6_30.1: %i32 = value_of_initializer %int.left_shift [template = constants.%int_20.1] -// CHECK:STDOUT: %.loc6_30.2: %i32 = converted %int.left_shift, %.loc6_30.1 [template = constants.%int_20.1] -// CHECK:STDOUT: %int.convert_checked.loc6_30: init Core.IntLiteral = call %Convert.specific_fn.loc6_30(%.loc6_30.2) [template = constants.%int_20.2] -// CHECK:STDOUT: %.loc6_30.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6_30 [template = constants.%int_20.2] -// CHECK:STDOUT: %.loc6_30.4: Core.IntLiteral = converted %int.left_shift, %.loc6_30.3 [template = constants.%int_20.2] -// CHECK:STDOUT: %array_type.loc6: type = array_type %.loc6_30.4, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template = constants.%int_20.2] -// CHECK:STDOUT: %array_type.loc7: type = array_type %int_20, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -244,12 +402,12 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc9_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc9_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc9_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc9_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -259,71 +417,574 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc4_14.1: %i32) { +// CHECK:STDOUT: %N.loc4_14.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc4_14.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.2] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc5_9.1: %i32) { +// CHECK:STDOUT: %N.loc5_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc5_9.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc5_29.2: type = class_type @Expect, @Expect(%N.loc5_9.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc5_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc5_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %i32) -> %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc5_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc5_41.2: init @Test.%Expect.loc5_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc5_42: init @Test.%Expect.loc5_29.2 (%Expect.1) = converted %.loc5_41.1, %.loc5_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc5_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc10: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc10_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc10_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_0.loc10_18, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_0.loc10_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_0.loc10_18, %.loc10_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_21: = bound_method %int_0.loc10_21, %impl.elem0.loc10_21 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_21: = specific_function %Convert.bound.loc10_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_21: init %i32 = call %Convert.specific_fn.loc10_21(%int_0.loc10_21) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_0.loc10_21, %.loc10_21.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.left_shift.loc10: init %i32 = call %LeftShift.ref.loc10(%.loc10_18.2, %.loc10_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.left_shift.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int.left_shift.loc10, %.loc10_23.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_23.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_35: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_36: = bound_method %int_0.loc10_35, %impl.elem0.loc10_36 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_36: = specific_function %Convert.bound.loc10_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_36: init %i32 = call %Convert.specific_fn.loc10_36(%int_0.loc10_35) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_36.1: %i32 = value_of_initializer %int.convert_checked.loc10_36 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_36.2: %i32 = converted %int_0.loc10_35, %.loc10_36.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_23.4: ref %Expect.2 = temporary %.loc10_23.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc11: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc11_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc11_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_18: = bound_method %int_0.loc11_18, %impl.elem0.loc11_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_18: = specific_function %Convert.bound.loc11_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_18: init %i32 = call %Convert.specific_fn.loc11_18(%int_0.loc11_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_18.1: %i32 = value_of_initializer %int.convert_checked.loc11_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_18.2: %i32 = converted %int_0.loc11_18, %.loc11_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc11_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_21: = bound_method %int_1.loc11, %impl.elem0.loc11_21 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_21: = specific_function %Convert.bound.loc11_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_21: init %i32 = call %Convert.specific_fn.loc11_21(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_21.1: %i32 = value_of_initializer %int.convert_checked.loc11_21 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_1.loc11, %.loc11_21.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc11: init %i32 = call %LeftShift.ref.loc11(%.loc11_18.2, %.loc11_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_23.1: %i32 = value_of_initializer %int.left_shift.loc11 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_23.2: %i32 = converted %int.left_shift.loc11, %.loc11_23.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_23.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11_35: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_36: = bound_method %int_0.loc11_35, %impl.elem0.loc11_36 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_36: = specific_function %Convert.bound.loc11_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_36: init %i32 = call %Convert.specific_fn.loc11_36(%int_0.loc11_35) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_36.1: %i32 = value_of_initializer %int.convert_checked.loc11_36 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_36.2: %i32 = converted %int_0.loc11_35, %.loc11_36.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_23.4: ref %Expect.2 = temporary %.loc11_23.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc12: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc12_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_30.loc12: Core.IntLiteral = int_value 30 [template = constants.%int_30.1] +// CHECK:STDOUT: %impl.elem0.loc12_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_18: = bound_method %int_0.loc12_18, %impl.elem0.loc12_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_18: = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_18: init %i32 = call %Convert.specific_fn.loc12_18(%int_0.loc12_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_18.1: %i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_18.2: %i32 = converted %int_0.loc12_18, %.loc12_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc12_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_21: = bound_method %int_30.loc12, %impl.elem0.loc12_21 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_21: = specific_function %Convert.bound.loc12_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_21: init %i32 = call %Convert.specific_fn.loc12_21(%int_30.loc12) [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_30.loc12, %.loc12_21.1 [template = constants.%int_30.2] +// CHECK:STDOUT: %int.left_shift.loc12: init %i32 = call %LeftShift.ref.loc12(%.loc12_18.2, %.loc12_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_24.1: %i32 = value_of_initializer %int.left_shift.loc12 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_24.2: %i32 = converted %int.left_shift.loc12, %.loc12_24.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_24.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc12_36: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc12_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_37: = bound_method %int_0.loc12_36, %impl.elem0.loc12_37 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_37: = specific_function %Convert.bound.loc12_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_37: init %i32 = call %Convert.specific_fn.loc12_37(%int_0.loc12_36) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_37.1: %i32 = value_of_initializer %int.convert_checked.loc12_37 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_37.2: %i32 = converted %int_0.loc12_36, %.loc12_37.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_24.4: ref %Expect.2 = temporary %.loc12_24.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_30.loc13: Core.IntLiteral = int_value 30 [template = constants.%int_30.1] +// CHECK:STDOUT: %impl.elem0.loc13_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_18: = bound_method %int_1.loc13, %impl.elem0.loc13_18 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc13_18: = specific_function %Convert.bound.loc13_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc13_18: init %i32 = call %Convert.specific_fn.loc13_18(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_18.1: %i32 = value_of_initializer %int.convert_checked.loc13_18 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_18.2: %i32 = converted %int_1.loc13, %.loc13_18.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_21: = bound_method %int_30.loc13, %impl.elem0.loc13_21 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_21: = specific_function %Convert.bound.loc13_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_21: init %i32 = call %Convert.specific_fn.loc13_21(%int_30.loc13) [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc13_21.1: %i32 = value_of_initializer %int.convert_checked.loc13_21 [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc13_21.2: %i32 = converted %int_30.loc13, %.loc13_21.1 [template = constants.%int_30.2] +// CHECK:STDOUT: %int.left_shift.loc13: init %i32 = call %LeftShift.ref.loc13(%.loc13_18.2, %.loc13_21.2) [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.left_shift.loc13 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int.left_shift.loc13, %.loc13_24.1 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_1073741824.1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc13_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.3 = call %Test.specific_fn.loc13() to %.loc13_24.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1073741824: Core.IntLiteral = int_value 1073741824 [template = constants.%int_1073741824.2] +// CHECK:STDOUT: %impl.elem0.loc13_47: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_47: = bound_method %int_1073741824, %impl.elem0.loc13_47 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc13_47: = specific_function %Convert.bound.loc13_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc13_47: init %i32 = call %Convert.specific_fn.loc13_47(%int_1073741824) [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_47.1: %i32 = value_of_initializer %int.convert_checked.loc13_47 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_47.2: %i32 = converted %int_1073741824, %.loc13_47.1 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_1073741824.1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc13_24.4: ref %Expect.3 = temporary %.loc13_24.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc14: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc14_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_18: = bound_method %int_5, %impl.elem0.loc14_18 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc14_18: = specific_function %Convert.bound.loc14_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc14_18: init %i32 = call %Convert.specific_fn.loc14_18(%int_5) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc14_18.1: %i32 = value_of_initializer %int.convert_checked.loc14_18 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc14_18.2: %i32 = converted %int_5, %.loc14_18.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %impl.elem0.loc14_21: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_21: = bound_method %int_2.loc14, %impl.elem0.loc14_21 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc14_21: = specific_function %Convert.bound.loc14_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc14_21: init %i32 = call %Convert.specific_fn.loc14_21(%int_2.loc14) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_21.1: %i32 = value_of_initializer %int.convert_checked.loc14_21 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_21.2: %i32 = converted %int_2.loc14, %.loc14_21.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.left_shift.loc14: init %i32 = call %LeftShift.ref.loc14(%.loc14_18.2, %.loc14_21.2) [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_23.1: %i32 = value_of_initializer %int.left_shift.loc14 [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_23.2: %i32 = converted %int.left_shift.loc14, %.loc14_23.1 [template = constants.%int_20.1] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_20.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_23.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_23.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template = constants.%int_20.2] +// CHECK:STDOUT: %impl.elem0.loc14_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_37: = bound_method %int_20, %impl.elem0.loc14_37 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc14_37: = specific_function %Convert.bound.loc14_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %int.convert_checked.loc14_37: init %i32 = call %Convert.specific_fn.loc14_37(%int_20) [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_37.1: %i32 = value_of_initializer %int.convert_checked.loc14_37 [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_37.2: %i32 = converted %int_20, %.loc14_37.1 [template = constants.%int_20.1] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_20.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_23.4: ref %Expect.4 = temporary %.loc14_23.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc15_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_18.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_18: = bound_method %int_1.loc15_19, %impl.elem0.loc15_18.1 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_18: init Core.IntLiteral = call %Op.bound.loc15_18(%int_1.loc15_19) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc15_22: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_18.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_18: = bound_method %int.snegate.loc15_18, %impl.elem0.loc15_18.2 [template = constants.%Convert.bound.8] +// CHECK:STDOUT: %Convert.specific_fn.loc15_18: = specific_function %Convert.bound.loc15_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.8] +// CHECK:STDOUT: %.loc15_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_18 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_18.2: Core.IntLiteral = converted %int.snegate.loc15_18, %.loc15_18.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15_18: init %i32 = call %Convert.specific_fn.loc15_18(%.loc15_18.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_18.3: %i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_18.4: %i32 = converted %int.snegate.loc15_18, %.loc15_18.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %impl.elem0.loc15_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_22: = bound_method %int_1.loc15_22, %impl.elem0.loc15_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc15_22: = specific_function %Convert.bound.loc15_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc15_22: init %i32 = call %Convert.specific_fn.loc15_22(%int_1.loc15_22) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_22.1: %i32 = value_of_initializer %int.convert_checked.loc15_22 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_22.2: %i32 = converted %int_1.loc15_22, %.loc15_22.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc15: init %i32 = call %LeftShift.ref.loc15(%.loc15_18.4, %.loc15_22.2) [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc15_24.1: %i32 = value_of_initializer %int.left_shift.loc15 [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc15_24.2: %i32 = converted %int.left_shift.loc15, %.loc15_24.1 [template = constants.%int_-2.1] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-2.1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_24.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_24.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2.loc15: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc15_36: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_36: = bound_method %int_2.loc15, %impl.elem0.loc15_36 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc15_36: init Core.IntLiteral = call %Op.bound.loc15_36(%int_2.loc15) [template = constants.%int_-2.2] +// CHECK:STDOUT: %impl.elem0.loc15_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_38: = bound_method %int.snegate.loc15_36, %impl.elem0.loc15_38 [template = constants.%Convert.bound.9] +// CHECK:STDOUT: %Convert.specific_fn.loc15_38: = specific_function %Convert.bound.loc15_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.9] +// CHECK:STDOUT: %.loc15_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_36 [template = constants.%int_-2.2] +// CHECK:STDOUT: %.loc15_36.2: Core.IntLiteral = converted %int.snegate.loc15_36, %.loc15_36.1 [template = constants.%int_-2.2] +// CHECK:STDOUT: %int.convert_checked.loc15_38: init %i32 = call %Convert.specific_fn.loc15_38(%.loc15_36.2) [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc15_38.1: %i32 = value_of_initializer %int.convert_checked.loc15_38 [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc15_38.2: %i32 = converted %int.snegate.loc15_36, %.loc15_38.1 [template = constants.%int_-2.1] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-2.1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_24.4: ref %Expect.5 = temporary %.loc15_24.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc16: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_2.loc16: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc16_18.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_18: = bound_method %int_2.loc16, %impl.elem0.loc16_18.1 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc16_18: init Core.IntLiteral = call %Op.bound.loc16_18(%int_2.loc16) [template = constants.%int_-2.2] +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc16_18.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_18: = bound_method %int.snegate.loc16_18, %impl.elem0.loc16_18.2 [template = constants.%Convert.bound.9] +// CHECK:STDOUT: %Convert.specific_fn.loc16_18: = specific_function %Convert.bound.loc16_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.9] +// CHECK:STDOUT: %.loc16_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_18 [template = constants.%int_-2.2] +// CHECK:STDOUT: %.loc16_18.2: Core.IntLiteral = converted %int.snegate.loc16_18, %.loc16_18.1 [template = constants.%int_-2.2] +// CHECK:STDOUT: %int.convert_checked.loc16_18: init %i32 = call %Convert.specific_fn.loc16_18(%.loc16_18.2) [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc16_18.3: %i32 = value_of_initializer %int.convert_checked.loc16_18 [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc16_18.4: %i32 = converted %int.snegate.loc16_18, %.loc16_18.3 [template = constants.%int_-2.1] +// CHECK:STDOUT: %impl.elem0.loc16_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_22: = bound_method %int_1.loc16, %impl.elem0.loc16_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc16_22: = specific_function %Convert.bound.loc16_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc16_22: init %i32 = call %Convert.specific_fn.loc16_22(%int_1.loc16) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_22.1: %i32 = value_of_initializer %int.convert_checked.loc16_22 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_22.2: %i32 = converted %int_1.loc16, %.loc16_22.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc16: init %i32 = call %LeftShift.ref.loc16(%.loc16_18.4, %.loc16_22.2) [template = constants.%int_-4.1] +// CHECK:STDOUT: %.loc16_24.1: %i32 = value_of_initializer %int.left_shift.loc16 [template = constants.%int_-4.1] +// CHECK:STDOUT: %.loc16_24.2: %i32 = converted %int.left_shift.loc16, %.loc16_24.1 [template = constants.%int_-4.1] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_-4.1) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc16_24.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.6 = call %Test.specific_fn.loc16() to %.loc16_24.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %impl.elem0.loc16_36: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_36: = bound_method %int_4, %impl.elem0.loc16_36 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc16_36: init Core.IntLiteral = call %Op.bound.loc16_36(%int_4) [template = constants.%int_-4.2] +// CHECK:STDOUT: %impl.elem0.loc16_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_38: = bound_method %int.snegate.loc16_36, %impl.elem0.loc16_38 [template = constants.%Convert.bound.10] +// CHECK:STDOUT: %Convert.specific_fn.loc16_38: = specific_function %Convert.bound.loc16_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.10] +// CHECK:STDOUT: %.loc16_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_36 [template = constants.%int_-4.2] +// CHECK:STDOUT: %.loc16_36.2: Core.IntLiteral = converted %int.snegate.loc16_36, %.loc16_36.1 [template = constants.%int_-4.2] +// CHECK:STDOUT: %int.convert_checked.loc16_38: init %i32 = call %Convert.specific_fn.loc16_38(%.loc16_36.2) [template = constants.%int_-4.1] +// CHECK:STDOUT: %.loc16_38.1: %i32 = value_of_initializer %int.convert_checked.loc16_38 [template = constants.%int_-4.1] +// CHECK:STDOUT: %.loc16_38.2: %i32 = converted %int.snegate.loc16_36, %.loc16_38.1 [template = constants.%int_-4.1] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_-4.1) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc16_24.4: ref %Expect.6 = temporary %.loc16_24.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc17: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc17_18.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_18: = bound_method %int_3, %impl.elem0.loc17_18.1 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc17_18: init Core.IntLiteral = call %Op.bound.loc17_18(%int_3) [template = constants.%int_-3.1] +// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc17_18.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_18: = bound_method %int.snegate.loc17_18, %impl.elem0.loc17_18.2 [template = constants.%Convert.bound.11] +// CHECK:STDOUT: %Convert.specific_fn.loc17_18: = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.11] +// CHECK:STDOUT: %.loc17_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_18 [template = constants.%int_-3.1] +// CHECK:STDOUT: %.loc17_18.2: Core.IntLiteral = converted %int.snegate.loc17_18, %.loc17_18.1 [template = constants.%int_-3.1] +// CHECK:STDOUT: %int.convert_checked.loc17_18: init %i32 = call %Convert.specific_fn.loc17_18(%.loc17_18.2) [template = constants.%int_-3.2] +// CHECK:STDOUT: %.loc17_18.3: %i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_-3.2] +// CHECK:STDOUT: %.loc17_18.4: %i32 = converted %int.snegate.loc17_18, %.loc17_18.3 [template = constants.%int_-3.2] +// CHECK:STDOUT: %impl.elem0.loc17_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_22: = bound_method %int_1.loc17, %impl.elem0.loc17_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc17_22: = specific_function %Convert.bound.loc17_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc17_22: init %i32 = call %Convert.specific_fn.loc17_22(%int_1.loc17) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc17_22.1: %i32 = value_of_initializer %int.convert_checked.loc17_22 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc17_22.2: %i32 = converted %int_1.loc17, %.loc17_22.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc17: init %i32 = call %LeftShift.ref.loc17(%.loc17_18.4, %.loc17_22.2) [template = constants.%int_-6.1] +// CHECK:STDOUT: %.loc17_24.1: %i32 = value_of_initializer %int.left_shift.loc17 [template = constants.%int_-6.1] +// CHECK:STDOUT: %.loc17_24.2: %i32 = converted %int.left_shift.loc17, %.loc17_24.1 [template = constants.%int_-6.1] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_-6.1) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc17_24.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.7 = call %Test.specific_fn.loc17() to %.loc17_24.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %impl.elem0.loc17_36: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_36: = bound_method %int_6, %impl.elem0.loc17_36 [template = constants.%Op.bound.5] +// CHECK:STDOUT: %int.snegate.loc17_36: init Core.IntLiteral = call %Op.bound.loc17_36(%int_6) [template = constants.%int_-6.2] +// CHECK:STDOUT: %impl.elem0.loc17_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_38: = bound_method %int.snegate.loc17_36, %impl.elem0.loc17_38 [template = constants.%Convert.bound.12] +// CHECK:STDOUT: %Convert.specific_fn.loc17_38: = specific_function %Convert.bound.loc17_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.12] +// CHECK:STDOUT: %.loc17_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_36 [template = constants.%int_-6.2] +// CHECK:STDOUT: %.loc17_36.2: Core.IntLiteral = converted %int.snegate.loc17_36, %.loc17_36.1 [template = constants.%int_-6.2] +// CHECK:STDOUT: %int.convert_checked.loc17_38: init %i32 = call %Convert.specific_fn.loc17_38(%.loc17_36.2) [template = constants.%int_-6.1] +// CHECK:STDOUT: %.loc17_38.1: %i32 = value_of_initializer %int.convert_checked.loc17_38 [template = constants.%int_-6.1] +// CHECK:STDOUT: %.loc17_38.2: %i32 = converted %int.snegate.loc17_36, %.loc17_38.1 [template = constants.%int_-6.1] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_-6.1) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc17_24.4: ref %Expect.7 = temporary %.loc17_24.3, %Test.call.loc17 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.left_shift: init %i32 = call %LeftShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc10_25.1: %i32 = value_of_initializer %int.left_shift -// CHECK:STDOUT: %.loc10_25.2: %i32 = converted %int.left_shift, %.loc10_25.1 -// CHECK:STDOUT: return %.loc10_25.2 +// CHECK:STDOUT: %.loc21_25.1: %i32 = value_of_initializer %int.left_shift +// CHECK:STDOUT: %.loc21_25.2: %i32 = converted %int.left_shift, %.loc21_25.1 +// CHECK:STDOUT: return %.loc21_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_bad_shift.carbon +// CHECK:STDOUT: specific @Expect(@Test.%N.loc5_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1073741824.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1073741824.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_20.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_20.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_20.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_20.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_20.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_20.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-2.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_-2.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_-2.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-2.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_-2.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_-2.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-4.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_-4.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_-4.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-4.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_-4.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_-4.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-6.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_-6.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_-6.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-6.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_-6.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_-6.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- u32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [template] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32.1) [template] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] +// CHECK:STDOUT: %N.2: %u32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %u32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.2: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] // CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32.1) [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_0.2: %u32 = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.7, @impl.5(%int_32) [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %interface.10: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_0.3: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.7(%int_32) [template] // CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_32.2: %i32 = int_value 32 [template] -// CHECK:STDOUT: %int_33.1: Core.IntLiteral = int_value 33 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_33.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_33.2: %i32 = int_value 33 [template] -// CHECK:STDOUT: %int_1000.1: Core.IntLiteral = int_value 1000 [template] -// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_1000.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_1000.2: %i32 = int_value 1000 [template] -// CHECK:STDOUT: %int_0.1: %i32 = int_value 0 [template] -// CHECK:STDOUT: %int_0.2: Core.IntLiteral = int_value 0 [template] -// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_0.2, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32.1) [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_30.1: Core.IntLiteral = int_value 30 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_30.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_30.2: %i32 = int_value 30 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.3: %u32 = int_value 1 [template] +// CHECK:STDOUT: %int_1073741824.1: %u32 = int_value 1073741824 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1073741824.1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1073741824.1) [template] +// CHECK:STDOUT: %int_1073741824.2: Core.IntLiteral = int_value 1073741824 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_1073741824.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_5.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_5.2: %u32 = int_value 5 [template] +// CHECK:STDOUT: %Convert.bound.8: = bound_method %int_2.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.8: = specific_function %Convert.bound.8, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] +// CHECK:STDOUT: %int_20.1: %u32 = int_value 20 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_20.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_20.1) [template] +// CHECK:STDOUT: %int_20.2: Core.IntLiteral = int_value 20 [template] +// CHECK:STDOUT: %Convert.bound.9: = bound_method %int_20.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.9: = specific_function %Convert.bound.9, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_4294967295.1: Core.IntLiteral = int_value 4294967295 [template] +// CHECK:STDOUT: %Convert.bound.10: = bound_method %int_4294967295.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.10: = specific_function %Convert.bound.10, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_4294967295.2: %u32 = int_value 4294967295 [template] +// CHECK:STDOUT: %int_4294967294.1: %u32 = int_value 4294967294 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_4294967294.1) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_4294967294.1) [template] +// CHECK:STDOUT: %int_4294967294.2: Core.IntLiteral = int_value 4294967294 [template] +// CHECK:STDOUT: %Convert.bound.11: = bound_method %int_4294967294.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.11: = specific_function %Convert.bound.11, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_4294967292.1: %u32 = int_value 4294967292 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_4294967292.1) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_4294967292.1) [template] +// CHECK:STDOUT: %int_4294967292.2: Core.IntLiteral = int_value 4294967292 [template] +// CHECK:STDOUT: %Convert.bound.12: = bound_method %int_4294967292.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.12: = specific_function %Convert.bound.12, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2882400001.1: Core.IntLiteral = int_value 2882400001 [template] +// CHECK:STDOUT: %int_8.1: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %Convert.bound.13: = bound_method %int_2882400001.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.13: = specific_function %Convert.bound.13, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2882400001.2: %u32 = int_value 2882400001 [template] +// CHECK:STDOUT: %Convert.bound.14: = bound_method %int_8.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.14: = specific_function %Convert.bound.14, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_8.2: %i32 = int_value 8 [template] +// CHECK:STDOUT: %int_3454992640.1: %u32 = int_value 3454992640 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_3454992640.1) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_3454992640.1) [template] +// CHECK:STDOUT: %int_3454992640.2: Core.IntLiteral = int_value 3454992640 [template] +// CHECK:STDOUT: %Convert.bound.15: = bound_method %int_3454992640.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.15: = specific_function %Convert.bound.15, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .UInt = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.9 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -332,237 +993,507 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: .LeftShift = %LeftShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .size_1 = @__global_init.%size_1 -// CHECK:STDOUT: .size_2 = @__global_init.%size_2 -// CHECK:STDOUT: .size_3 = @__global_init.%size_3 -// CHECK:STDOUT: .overflow_1 = @__global_init.%overflow_1 -// CHECK:STDOUT: .overflow_2 = @__global_init.%overflow_2 -// CHECK:STDOUT: .no_overflow_1 = @__global_init.%no_overflow_1 -// CHECK:STDOUT: .no_overflow_2 = @__global_init.%no_overflow_2 -// CHECK:STDOUT: .negative = @__global_init.%negative +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc4_14.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc4_14.1, runtime_param [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %N.loc4_14.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc5_9.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc5_9.1, runtime_param [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %u32 = name_ref N, %N.loc5_9.1 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc5_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %N.loc5_9.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc5_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc4_33: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc4_33: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %int_32.loc7_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc7_17: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %int_32.loc7_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc7_33: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %int_32.loc20_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc20_19: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %int_32.loc20_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc20_35: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc29: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc29: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc34: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc41: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc41: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; +// CHECK:STDOUT: generic class @Expect(%N.loc4_14.1: %u32) { +// CHECK:STDOUT: %N.loc4_14.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc4_14.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; +// CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.2] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc5_9.1: %u32) { +// CHECK:STDOUT: %N.loc5_9.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc5_9.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc5_29.2: type = class_type @Expect, @Expect(%N.loc5_9.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc5_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc5_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %u32) -> %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc5_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc5_41.2: init @Test.%Expect.loc5_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc5_42: init @Test.%Expect.loc5_29.2 (%Expect.1) = converted %.loc5_41.1, %.loc5_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc5_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %u32, %b.param_patt: %i32) -> %u32 = "int.left_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref.loc8: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_31.loc8: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc8_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_29: = bound_method %int_1.loc8, %impl.elem0.loc8_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc8_29: = specific_function %Convert.bound.loc8_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8_29: init %i32 = call %Convert.specific_fn.loc8_29(%int_1.loc8) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_29.1: %i32 = value_of_initializer %int.convert_checked.loc8_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc8_29.2: %i32 = converted %int_1.loc8, %.loc8_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc8_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8_32: = bound_method %int_31.loc8, %impl.elem0.loc8_32 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc8_32: = specific_function %Convert.bound.loc8_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc8_32: init %i32 = call %Convert.specific_fn.loc8_32(%int_31.loc8) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_32.1: %i32 = value_of_initializer %int.convert_checked.loc8_32 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc8_32.2: %i32 = converted %int_31.loc8, %.loc8_32.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc8: init %i32 = call %LeftShift.ref.loc8(%.loc8_29.2, %.loc8_32.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_35.1: %i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc8_35.2: %i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %size_1: %i32 = bind_name size_1, %.loc8_35.2 +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc10: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc10_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc10_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_0.loc10_18, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_18: init %u32 = call %Convert.specific_fn.loc10_18(%int_0.loc10_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_18.1: %u32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_18.2: %u32 = converted %int_0.loc10_18, %.loc10_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_21: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc10_21: = bound_method %int_0.loc10_21, %impl.elem0.loc10_21 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc10_21: = specific_function %Convert.bound.loc10_21, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc10_21: init %i32 = call %Convert.specific_fn.loc10_21(%int_0.loc10_21) [template = constants.%int_0.3] +// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%int_0.3] +// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_0.loc10_21, %.loc10_21.1 [template = constants.%int_0.3] +// CHECK:STDOUT: %int.left_shift.loc10: init %u32 = call %LeftShift.ref.loc10(%.loc10_18.2, %.loc10_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_23.1: %u32 = value_of_initializer %int.left_shift.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_23.2: %u32 = converted %int.left_shift.loc10, %.loc10_23.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_23.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_35: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_36: = bound_method %int_0.loc10_35, %impl.elem0.loc10_36 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_36: = specific_function %Convert.bound.loc10_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_36: init %u32 = call %Convert.specific_fn.loc10_36(%int_0.loc10_35) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_36.1: %u32 = value_of_initializer %int.convert_checked.loc10_36 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_36.2: %u32 = converted %int_0.loc10_35, %.loc10_36.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_23.4: ref %Expect.2 = temporary %.loc10_23.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc11: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc11_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc11_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_18: = bound_method %int_0.loc11_18, %impl.elem0.loc11_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_18: = specific_function %Convert.bound.loc11_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_18: init %u32 = call %Convert.specific_fn.loc11_18(%int_0.loc11_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_18.1: %u32 = value_of_initializer %int.convert_checked.loc11_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_18.2: %u32 = converted %int_0.loc11_18, %.loc11_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc11_21: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc11_21: = bound_method %int_1.loc11, %impl.elem0.loc11_21 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc11_21: = specific_function %Convert.bound.loc11_21, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc11_21: init %i32 = call %Convert.specific_fn.loc11_21(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_21.1: %i32 = value_of_initializer %int.convert_checked.loc11_21 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_1.loc11, %.loc11_21.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc11: init %u32 = call %LeftShift.ref.loc11(%.loc11_18.2, %.loc11_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_23.1: %u32 = value_of_initializer %int.left_shift.loc11 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_23.2: %u32 = converted %int.left_shift.loc11, %.loc11_23.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_23.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11_35: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_36: = bound_method %int_0.loc11_35, %impl.elem0.loc11_36 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_36: = specific_function %Convert.bound.loc11_36, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_36: init %u32 = call %Convert.specific_fn.loc11_36(%int_0.loc11_35) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_36.1: %u32 = value_of_initializer %int.convert_checked.loc11_36 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_36.2: %u32 = converted %int_0.loc11_35, %.loc11_36.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_23.4: ref %Expect.2 = temporary %.loc11_23.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc12: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc12_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_30.loc12: Core.IntLiteral = int_value 30 [template = constants.%int_30.1] +// CHECK:STDOUT: %impl.elem0.loc12_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_18: = bound_method %int_0.loc12_18, %impl.elem0.loc12_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_18: = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_18: init %u32 = call %Convert.specific_fn.loc12_18(%int_0.loc12_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_18.1: %u32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_18.2: %u32 = converted %int_0.loc12_18, %.loc12_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc12_21: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc12_21: = bound_method %int_30.loc12, %impl.elem0.loc12_21 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc12_21: = specific_function %Convert.bound.loc12_21, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc12_21: init %i32 = call %Convert.specific_fn.loc12_21(%int_30.loc12) [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc12_21.1: %i32 = value_of_initializer %int.convert_checked.loc12_21 [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc12_21.2: %i32 = converted %int_30.loc12, %.loc12_21.1 [template = constants.%int_30.2] +// CHECK:STDOUT: %int.left_shift.loc12: init %u32 = call %LeftShift.ref.loc12(%.loc12_18.2, %.loc12_21.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_24.1: %u32 = value_of_initializer %int.left_shift.loc12 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_24.2: %u32 = converted %int.left_shift.loc12, %.loc12_24.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_24.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc12_36: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc12_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_37: = bound_method %int_0.loc12_36, %impl.elem0.loc12_37 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_37: = specific_function %Convert.bound.loc12_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_37: init %u32 = call %Convert.specific_fn.loc12_37(%int_0.loc12_36) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_37.1: %u32 = value_of_initializer %int.convert_checked.loc12_37 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_37.2: %u32 = converted %int_0.loc12_36, %.loc12_37.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_24.4: ref %Expect.2 = temporary %.loc12_24.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc13_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_29: = bound_method %int_1.loc13, %impl.elem0.loc13_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc13_29: = specific_function %Convert.bound.loc13_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc13_29: init %i32 = call %Convert.specific_fn.loc13_29(%int_1.loc13) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_29.1: %i32 = value_of_initializer %int.convert_checked.loc13_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc13_29.2: %i32 = converted %int_1.loc13, %.loc13_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc13_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc13_32: = bound_method %int_32.loc13, %impl.elem0.loc13_32 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc13_32: = specific_function %Convert.bound.loc13_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc13_32: init %i32 = call %Convert.specific_fn.loc13_32(%int_32.loc13) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_32.1: %i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc13_32.2: %i32 = converted %int_32.loc13, %.loc13_32.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc13: init %i32 = call %LeftShift.ref.loc13(%.loc13_29.2, %.loc13_32.2) [template = ] -// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.left_shift.loc13 [template = ] -// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] -// CHECK:STDOUT: %size_2: %i32 = bind_name size_2, %.loc13_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc18: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [template = constants.%int_33.1] -// CHECK:STDOUT: %impl.elem0.loc18_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_29: = bound_method %int_1.loc18, %impl.elem0.loc18_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc18_29: = specific_function %Convert.bound.loc18_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc18_29: init %i32 = call %Convert.specific_fn.loc18_29(%int_1.loc18) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_29.1: %i32 = value_of_initializer %int.convert_checked.loc18_29 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc18_29.2: %i32 = converted %int_1.loc18, %.loc18_29.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc18_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc18_32: = bound_method %int_33, %impl.elem0.loc18_32 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc18_32: = specific_function %Convert.bound.loc18_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc18_32: init %i32 = call %Convert.specific_fn.loc18_32(%int_33) [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_32.1: %i32 = value_of_initializer %int.convert_checked.loc18_32 [template = constants.%int_33.2] -// CHECK:STDOUT: %.loc18_32.2: %i32 = converted %int_33, %.loc18_32.1 [template = constants.%int_33.2] -// CHECK:STDOUT: %int.left_shift.loc18: init %i32 = call %LeftShift.ref.loc18(%.loc18_29.2, %.loc18_32.2) [template = ] -// CHECK:STDOUT: %.loc18_35.1: %i32 = value_of_initializer %int.left_shift.loc18 [template = ] -// CHECK:STDOUT: %.loc18_35.2: %i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] -// CHECK:STDOUT: %size_3: %i32 = bind_name size_3, %.loc18_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1000.loc21: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] -// CHECK:STDOUT: %int_31.loc21: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc21_33: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc21_33: = bound_method %int_1000.loc21, %impl.elem0.loc21_33 [template = constants.%Convert.bound.5] -// CHECK:STDOUT: %Convert.specific_fn.loc21_33: = specific_function %Convert.bound.loc21_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] -// CHECK:STDOUT: %int.convert_checked.loc21_33: init %i32 = call %Convert.specific_fn.loc21_33(%int_1000.loc21) [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc21_33.1: %i32 = value_of_initializer %int.convert_checked.loc21_33 [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc21_33.2: %i32 = converted %int_1000.loc21, %.loc21_33.1 [template = constants.%int_1000.2] -// CHECK:STDOUT: %impl.elem0.loc21_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc21_39: = bound_method %int_31.loc21, %impl.elem0.loc21_39 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc21_39: = specific_function %Convert.bound.loc21_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc21_39: init %i32 = call %Convert.specific_fn.loc21_39(%int_31.loc21) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc21_39.1: %i32 = value_of_initializer %int.convert_checked.loc21_39 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc21_39.2: %i32 = converted %int_31.loc21, %.loc21_39.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc21: init %i32 = call %LeftShift.ref.loc21(%.loc21_33.2, %.loc21_39.2) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc21_42.1: %i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc21_42.2: %i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %overflow_1: %i32 = bind_name overflow_1, %.loc21_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1000.loc26: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] -// CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc26_33: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc26_33: = bound_method %int_1000.loc26, %impl.elem0.loc26_33 [template = constants.%Convert.bound.5] -// CHECK:STDOUT: %Convert.specific_fn.loc26_33: = specific_function %Convert.bound.loc26_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] -// CHECK:STDOUT: %int.convert_checked.loc26_33: init %i32 = call %Convert.specific_fn.loc26_33(%int_1000.loc26) [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc26_33.1: %i32 = value_of_initializer %int.convert_checked.loc26_33 [template = constants.%int_1000.2] -// CHECK:STDOUT: %.loc26_33.2: %i32 = converted %int_1000.loc26, %.loc26_33.1 [template = constants.%int_1000.2] -// CHECK:STDOUT: %impl.elem0.loc26_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc26_39: = bound_method %int_32.loc26, %impl.elem0.loc26_39 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc26_39: = specific_function %Convert.bound.loc26_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc26_39: init %i32 = call %Convert.specific_fn.loc26_39(%int_32.loc26) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc26_39.1: %i32 = value_of_initializer %int.convert_checked.loc26_39 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc26_39.2: %i32 = converted %int_32.loc26, %.loc26_39.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc26: init %i32 = call %LeftShift.ref.loc26(%.loc26_33.2, %.loc26_39.2) [template = ] -// CHECK:STDOUT: %.loc26_42.1: %i32 = value_of_initializer %int.left_shift.loc26 [template = ] -// CHECK:STDOUT: %.loc26_42.2: %i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] -// CHECK:STDOUT: %overflow_2: %i32 = bind_name overflow_2, %.loc26_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] -// CHECK:STDOUT: %int_31.loc29: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] -// CHECK:STDOUT: %impl.elem0.loc29_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc29_36: = bound_method %int_0.loc29, %impl.elem0.loc29_36 [template = constants.%Convert.bound.6] -// CHECK:STDOUT: %Convert.specific_fn.loc29_36: = specific_function %Convert.bound.loc29_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] -// CHECK:STDOUT: %int.convert_checked.loc29_36: init %i32 = call %Convert.specific_fn.loc29_36(%int_0.loc29) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_36.1: %i32 = value_of_initializer %int.convert_checked.loc29_36 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_36.2: %i32 = converted %int_0.loc29, %.loc29_36.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc29_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc29_39: = bound_method %int_31.loc29, %impl.elem0.loc29_39 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc29_39: = specific_function %Convert.bound.loc29_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc29_39: init %i32 = call %Convert.specific_fn.loc29_39(%int_31.loc29) [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc29_39.1: %i32 = value_of_initializer %int.convert_checked.loc29_39 [template = constants.%int_31.2] -// CHECK:STDOUT: %.loc29_39.2: %i32 = converted %int_31.loc29, %.loc29_39.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.left_shift.loc29: init %i32 = call %LeftShift.ref.loc29(%.loc29_36.2, %.loc29_39.2) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_42.1: %i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc29_42.2: %i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %no_overflow_1: %i32 = bind_name no_overflow_1, %.loc29_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc34: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_0.loc34: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] -// CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %impl.elem0.loc34_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc34_36: = bound_method %int_0.loc34, %impl.elem0.loc34_36 [template = constants.%Convert.bound.6] -// CHECK:STDOUT: %Convert.specific_fn.loc34_36: = specific_function %Convert.bound.loc34_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] -// CHECK:STDOUT: %int.convert_checked.loc34_36: init %i32 = call %Convert.specific_fn.loc34_36(%int_0.loc34) [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc34_36.1: %i32 = value_of_initializer %int.convert_checked.loc34_36 [template = constants.%int_0.1] -// CHECK:STDOUT: %.loc34_36.2: %i32 = converted %int_0.loc34, %.loc34_36.1 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc34_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc34_39: = bound_method %int_32.loc34, %impl.elem0.loc34_39 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc34_39: = specific_function %Convert.bound.loc34_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc34_39: init %i32 = call %Convert.specific_fn.loc34_39(%int_32.loc34) [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc34_39.1: %i32 = value_of_initializer %int.convert_checked.loc34_39 [template = constants.%int_32.2] -// CHECK:STDOUT: %.loc34_39.2: %i32 = converted %int_32.loc34, %.loc34_39.1 [template = constants.%int_32.2] -// CHECK:STDOUT: %int.left_shift.loc34: init %i32 = call %LeftShift.ref.loc34(%.loc34_36.2, %.loc34_39.2) [template = ] -// CHECK:STDOUT: %.loc34_42.1: %i32 = value_of_initializer %int.left_shift.loc34 [template = ] -// CHECK:STDOUT: %.loc34_42.2: %i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] -// CHECK:STDOUT: %no_overflow_2: %i32 = bind_name no_overflow_2, %.loc34_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc41: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc41_31: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc41_41: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc41_41: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc41_41: = bound_method %int_1.loc41_41, %impl.elem0.loc41_41 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc41_41: = specific_function %Convert.bound.loc41_41, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc41_41: init %i32 = call %Convert.specific_fn.loc41_41(%int_1.loc41_41) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc41_41.1: %i32 = value_of_initializer %int.convert_checked.loc41_41 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc41_41.2: %i32 = converted %int_1.loc41_41, %.loc41_41.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc41_41.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc41_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc41_31: = bound_method %int_1.loc41_31, %impl.elem0.loc41_31 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc41_31: = specific_function %Convert.bound.loc41_31, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc41_31: init %i32 = call %Convert.specific_fn.loc41_31(%int_1.loc41_31) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc41_31.1: %i32 = value_of_initializer %int.convert_checked.loc41_31 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc41_31.2: %i32 = converted %int_1.loc41_31, %.loc41_31.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc41_42.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc41_42.2: %i32 = converted %int.snegate, %.loc41_42.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc41: init %i32 = call %LeftShift.ref.loc41(%.loc41_31.2, %.loc41_42.2) [template = ] -// CHECK:STDOUT: %.loc41_44.1: %i32 = value_of_initializer %int.left_shift.loc41 [template = ] -// CHECK:STDOUT: %.loc41_44.2: %i32 = converted %int.left_shift.loc41, %.loc41_44.1 [template = ] -// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc41_44.2 +// CHECK:STDOUT: %int_30.loc13: Core.IntLiteral = int_value 30 [template = constants.%int_30.1] +// CHECK:STDOUT: %impl.elem0.loc13_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_18: = bound_method %int_1.loc13, %impl.elem0.loc13_18 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc13_18: = specific_function %Convert.bound.loc13_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc13_18: init %u32 = call %Convert.specific_fn.loc13_18(%int_1.loc13) [template = constants.%int_1.3] +// CHECK:STDOUT: %.loc13_18.1: %u32 = value_of_initializer %int.convert_checked.loc13_18 [template = constants.%int_1.3] +// CHECK:STDOUT: %.loc13_18.2: %u32 = converted %int_1.loc13, %.loc13_18.1 [template = constants.%int_1.3] +// CHECK:STDOUT: %impl.elem0.loc13_21: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc13_21: = bound_method %int_30.loc13, %impl.elem0.loc13_21 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc13_21: = specific_function %Convert.bound.loc13_21, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc13_21: init %i32 = call %Convert.specific_fn.loc13_21(%int_30.loc13) [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc13_21.1: %i32 = value_of_initializer %int.convert_checked.loc13_21 [template = constants.%int_30.2] +// CHECK:STDOUT: %.loc13_21.2: %i32 = converted %int_30.loc13, %.loc13_21.1 [template = constants.%int_30.2] +// CHECK:STDOUT: %int.left_shift.loc13: init %u32 = call %LeftShift.ref.loc13(%.loc13_18.2, %.loc13_21.2) [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_24.1: %u32 = value_of_initializer %int.left_shift.loc13 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_24.2: %u32 = converted %int.left_shift.loc13, %.loc13_24.1 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_1073741824.1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc13_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.3 = call %Test.specific_fn.loc13() to %.loc13_24.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1073741824: Core.IntLiteral = int_value 1073741824 [template = constants.%int_1073741824.2] +// CHECK:STDOUT: %impl.elem0.loc13_47: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_47: = bound_method %int_1073741824, %impl.elem0.loc13_47 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc13_47: = specific_function %Convert.bound.loc13_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc13_47: init %u32 = call %Convert.specific_fn.loc13_47(%int_1073741824) [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_47.1: %u32 = value_of_initializer %int.convert_checked.loc13_47 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %.loc13_47.2: %u32 = converted %int_1073741824, %.loc13_47.1 [template = constants.%int_1073741824.1] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_1073741824.1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc13_24.4: ref %Expect.3 = temporary %.loc13_24.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc14: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc14_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_18: = bound_method %int_5, %impl.elem0.loc14_18 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc14_18: = specific_function %Convert.bound.loc14_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %int.convert_checked.loc14_18: init %u32 = call %Convert.specific_fn.loc14_18(%int_5) [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc14_18.1: %u32 = value_of_initializer %int.convert_checked.loc14_18 [template = constants.%int_5.2] +// CHECK:STDOUT: %.loc14_18.2: %u32 = converted %int_5, %.loc14_18.1 [template = constants.%int_5.2] +// CHECK:STDOUT: %impl.elem0.loc14_21: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc14_21: = bound_method %int_2, %impl.elem0.loc14_21 [template = constants.%Convert.bound.8] +// CHECK:STDOUT: %Convert.specific_fn.loc14_21: = specific_function %Convert.bound.loc14_21, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.8] +// CHECK:STDOUT: %int.convert_checked.loc14_21: init %i32 = call %Convert.specific_fn.loc14_21(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_21.1: %i32 = value_of_initializer %int.convert_checked.loc14_21 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_21.2: %i32 = converted %int_2, %.loc14_21.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.left_shift.loc14: init %u32 = call %LeftShift.ref.loc14(%.loc14_18.2, %.loc14_21.2) [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_23.1: %u32 = value_of_initializer %int.left_shift.loc14 [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_23.2: %u32 = converted %int.left_shift.loc14, %.loc14_23.1 [template = constants.%int_20.1] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_20.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_23.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_23.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template = constants.%int_20.2] +// CHECK:STDOUT: %impl.elem0.loc14_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_37: = bound_method %int_20, %impl.elem0.loc14_37 [template = constants.%Convert.bound.9] +// CHECK:STDOUT: %Convert.specific_fn.loc14_37: = specific_function %Convert.bound.loc14_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.9] +// CHECK:STDOUT: %int.convert_checked.loc14_37: init %u32 = call %Convert.specific_fn.loc14_37(%int_20) [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_37.1: %u32 = value_of_initializer %int.convert_checked.loc14_37 [template = constants.%int_20.1] +// CHECK:STDOUT: %.loc14_37.2: %u32 = converted %int_20, %.loc14_37.1 [template = constants.%int_20.1] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_20.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_23.4: ref %Expect.4 = temporary %.loc14_23.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template = constants.%int_4294967295.1] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_18: = bound_method %int_4294967295, %impl.elem0.loc15_18 [template = constants.%Convert.bound.10] +// CHECK:STDOUT: %Convert.specific_fn.loc15_18: = specific_function %Convert.bound.loc15_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.10] +// CHECK:STDOUT: %int.convert_checked.loc15_18: init %u32 = call %Convert.specific_fn.loc15_18(%int_4294967295) [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %.loc15_18.1: %u32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %.loc15_18.2: %u32 = converted %int_4294967295, %.loc15_18.1 [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %impl.elem0.loc15_31: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc15_31: = bound_method %int_1.loc15, %impl.elem0.loc15_31 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15_31: = specific_function %Convert.bound.loc15_31, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc15_31: init %i32 = call %Convert.specific_fn.loc15_31(%int_1.loc15) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_31.1: %i32 = value_of_initializer %int.convert_checked.loc15_31 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_31.2: %i32 = converted %int_1.loc15, %.loc15_31.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc15: init %u32 = call %LeftShift.ref.loc15(%.loc15_18.2, %.loc15_31.2) [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc15_33.1: %u32 = value_of_initializer %int.left_shift.loc15 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc15_33.2: %u32 = converted %int.left_shift.loc15, %.loc15_33.1 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_4294967294.1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_33.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_33.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4294967294.loc15: Core.IntLiteral = int_value 4294967294 [template = constants.%int_4294967294.2] +// CHECK:STDOUT: %impl.elem0.loc15_56: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_56: = bound_method %int_4294967294.loc15, %impl.elem0.loc15_56 [template = constants.%Convert.bound.11] +// CHECK:STDOUT: %Convert.specific_fn.loc15_56: = specific_function %Convert.bound.loc15_56, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.11] +// CHECK:STDOUT: %int.convert_checked.loc15_56: init %u32 = call %Convert.specific_fn.loc15_56(%int_4294967294.loc15) [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc15_56.1: %u32 = value_of_initializer %int.convert_checked.loc15_56 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc15_56.2: %u32 = converted %int_4294967294.loc15, %.loc15_56.1 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_4294967294.1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_33.4: ref %Expect.5 = temporary %.loc15_33.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc16: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_4294967294.loc16: Core.IntLiteral = int_value 4294967294 [template = constants.%int_4294967294.2] +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc16_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_18: = bound_method %int_4294967294.loc16, %impl.elem0.loc16_18 [template = constants.%Convert.bound.11] +// CHECK:STDOUT: %Convert.specific_fn.loc16_18: = specific_function %Convert.bound.loc16_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.11] +// CHECK:STDOUT: %int.convert_checked.loc16_18: init %u32 = call %Convert.specific_fn.loc16_18(%int_4294967294.loc16) [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc16_18.1: %u32 = value_of_initializer %int.convert_checked.loc16_18 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %.loc16_18.2: %u32 = converted %int_4294967294.loc16, %.loc16_18.1 [template = constants.%int_4294967294.1] +// CHECK:STDOUT: %impl.elem0.loc16_31: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc16_31: = bound_method %int_1.loc16, %impl.elem0.loc16_31 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc16_31: = specific_function %Convert.bound.loc16_31, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc16_31: init %i32 = call %Convert.specific_fn.loc16_31(%int_1.loc16) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_31.1: %i32 = value_of_initializer %int.convert_checked.loc16_31 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_31.2: %i32 = converted %int_1.loc16, %.loc16_31.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.left_shift.loc16: init %u32 = call %LeftShift.ref.loc16(%.loc16_18.2, %.loc16_31.2) [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %.loc16_33.1: %u32 = value_of_initializer %int.left_shift.loc16 [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %.loc16_33.2: %u32 = converted %int.left_shift.loc16, %.loc16_33.1 [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_4294967292.1) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc16_33.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.6 = call %Test.specific_fn.loc16() to %.loc16_33.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4294967292: Core.IntLiteral = int_value 4294967292 [template = constants.%int_4294967292.2] +// CHECK:STDOUT: %impl.elem0.loc16_56: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_56: = bound_method %int_4294967292, %impl.elem0.loc16_56 [template = constants.%Convert.bound.12] +// CHECK:STDOUT: %Convert.specific_fn.loc16_56: = specific_function %Convert.bound.loc16_56, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.12] +// CHECK:STDOUT: %int.convert_checked.loc16_56: init %u32 = call %Convert.specific_fn.loc16_56(%int_4294967292) [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %.loc16_56.1: %u32 = value_of_initializer %int.convert_checked.loc16_56 [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %.loc16_56.2: %u32 = converted %int_4294967292, %.loc16_56.1 [template = constants.%int_4294967292.1] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_4294967292.1) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc16_33.4: ref %Expect.6 = temporary %.loc16_33.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc17: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template = constants.%int_2882400001.1] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8.1] +// CHECK:STDOUT: %impl.elem0.loc17_18: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_18: = bound_method %int_2882400001, %impl.elem0.loc17_18 [template = constants.%Convert.bound.13] +// CHECK:STDOUT: %Convert.specific_fn.loc17_18: = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.13] +// CHECK:STDOUT: %int.convert_checked.loc17_18: init %u32 = call %Convert.specific_fn.loc17_18(%int_2882400001) [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %.loc17_18.1: %u32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %.loc17_18.2: %u32 = converted %int_2882400001, %.loc17_18.1 [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %impl.elem0.loc17_31: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc17_31: = bound_method %int_8, %impl.elem0.loc17_31 [template = constants.%Convert.bound.14] +// CHECK:STDOUT: %Convert.specific_fn.loc17_31: = specific_function %Convert.bound.loc17_31, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.14] +// CHECK:STDOUT: %int.convert_checked.loc17_31: init %i32 = call %Convert.specific_fn.loc17_31(%int_8) [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc17_31.1: %i32 = value_of_initializer %int.convert_checked.loc17_31 [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc17_31.2: %i32 = converted %int_8, %.loc17_31.1 [template = constants.%int_8.2] +// CHECK:STDOUT: %int.left_shift.loc17: init %u32 = call %LeftShift.ref.loc17(%.loc17_18.2, %.loc17_31.2) [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %.loc17_33.1: %u32 = value_of_initializer %int.left_shift.loc17 [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %.loc17_33.2: %u32 = converted %int.left_shift.loc17, %.loc17_33.1 [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_3454992640.1) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc17_33.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.7 = call %Test.specific_fn.loc17() to %.loc17_33.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_3454992640: Core.IntLiteral = int_value 3454992640 [template = constants.%int_3454992640.2] +// CHECK:STDOUT: %impl.elem0.loc17_56: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_56: = bound_method %int_3454992640, %impl.elem0.loc17_56 [template = constants.%Convert.bound.15] +// CHECK:STDOUT: %Convert.specific_fn.loc17_56: = specific_function %Convert.bound.loc17_56, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.15] +// CHECK:STDOUT: %int.convert_checked.loc17_56: init %u32 = call %Convert.specific_fn.loc17_56(%int_3454992640) [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %.loc17_56.1: %u32 = value_of_initializer %int.convert_checked.loc17_56 [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %.loc17_56.2: %u32 = converted %int_3454992640, %.loc17_56.1 [template = constants.%int_3454992640.1] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_3454992640.1) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc17_33.4: ref %Expect.7 = temporary %.loc17_33.3, %Test.call.loc17 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %u32, %b.param_patt: %i32) -> %u32 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a +// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b +// CHECK:STDOUT: %int.left_shift: init %u32 = call %LeftShift.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc21_25.1: %u32 = value_of_initializer %int.left_shift +// CHECK:STDOUT: %.loc21_25.2: %u32 = converted %int.left_shift, %.loc21_25.1 +// CHECK:STDOUT: return %.loc21_25.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc5_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1073741824.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1073741824.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_1073741824.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_20.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_20.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_20.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_20.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_20.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_20.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_4294967294.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_4294967294.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_4294967294.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_4294967294.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_4294967294.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_4294967294.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_4294967292.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_4294967292.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_4294967292.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_4294967292.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_4294967292.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_4294967292.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_3454992640.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_3454992640.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_3454992640.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_3454992640.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_3454992640.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_3454992640.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- literal.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -571,56 +1502,103 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %LeftShift.type: type = fn_type @LeftShift [template] // CHECK:STDOUT: %LeftShift: %LeftShift.type = struct_value () [template] // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] -// CHECK:STDOUT: %N.patt.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] // CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] // CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] // CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %N.patt.2: = symbolic_binding_pattern N, 0 [symbolic] // CHECK:STDOUT: %Test.type: type = fn_type @Test [template] // CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] -// CHECK:STDOUT: %int_1000000000000: Core.IntLiteral = int_value 1000000000000 [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_30: Core.IntLiteral = int_value 30 [template] +// CHECK:STDOUT: %int_1000000000: Core.IntLiteral = int_value 1000000000 [template] // CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1) [template] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_2) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_2) [template] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template] // CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_4) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_4) [template] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] // CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_12) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_12) [template] +// CHECK:STDOUT: %int_1073741824: Core.IntLiteral = int_value 1073741824 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_1073741824) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_1073741824) [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_20) [template] +// CHECK:STDOUT: %Test.specific_fn.7: = specific_function %Test, @Test(%int_20) [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] // CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] // CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] -// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %Expect.9: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %Test.specific_fn.8: = specific_function %Test, @Test(%int_-1) [template] // CHECK:STDOUT: %int_-2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %Expect.10: type = class_type @Expect, @Expect(%int_-2) [template] +// CHECK:STDOUT: %Test.specific_fn.9: = specific_function %Test, @Test(%int_-2) [template] // CHECK:STDOUT: %Op.bound.2: = bound_method %int_2, %Op.2 [template] -// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_-2) [template] // CHECK:STDOUT: %int_-4: Core.IntLiteral = int_value -4 [template] +// CHECK:STDOUT: %Expect.11: type = class_type @Expect, @Expect(%int_-4) [template] +// CHECK:STDOUT: %Test.specific_fn.10: = specific_function %Test, @Test(%int_-4) [template] // CHECK:STDOUT: %Op.bound.3: = bound_method %int_4, %Op.2 [template] -// CHECK:STDOUT: %Expect.9: type = class_type @Expect, @Expect(%int_-4) [template] // CHECK:STDOUT: %Op.bound.4: = bound_method %int_3, %Op.2 [template] // CHECK:STDOUT: %int_-3: Core.IntLiteral = int_value -3 [template] // CHECK:STDOUT: %int_-6: Core.IntLiteral = int_value -6 [template] -// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %Op.bound.5: = bound_method %int_5, %Op.2 [template] -// CHECK:STDOUT: %int_-5: Core.IntLiteral = int_value -5 [template] -// CHECK:STDOUT: %Expect.10: type = class_type @Expect, @Expect(%int_-5) [template] +// CHECK:STDOUT: %Expect.12: type = class_type @Expect, @Expect(%int_-6) [template] +// CHECK:STDOUT: %Test.specific_fn.11: = specific_function %Test, @Test(%int_-6) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Op.bound.5: = bound_method %int_6, %Op.2 [template] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template] +// CHECK:STDOUT: %int_8589934590: Core.IntLiteral = int_value 8589934590 [template] +// CHECK:STDOUT: %Expect.13: type = class_type @Expect, @Expect(%int_8589934590) [template] +// CHECK:STDOUT: %Test.specific_fn.12: = specific_function %Test, @Test(%int_8589934590) [template] +// CHECK:STDOUT: %int_4294967294: Core.IntLiteral = int_value 4294967294 [template] +// CHECK:STDOUT: %int_8589934588: Core.IntLiteral = int_value 8589934588 [template] +// CHECK:STDOUT: %Expect.14: type = class_type @Expect, @Expect(%int_8589934588) [template] +// CHECK:STDOUT: %Test.specific_fn.13: = specific_function %Test, @Test(%int_8589934588) [template] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %int_737894400256: Core.IntLiteral = int_value 737894400256 [template] +// CHECK:STDOUT: %Expect.15: type = class_type @Expect, @Expect(%int_737894400256) [template] +// CHECK:STDOUT: %Test.specific_fn.14: = specific_function %Test, @Test(%int_737894400256) [template] // CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] // CHECK:STDOUT: %int_18446744073709551614: Core.IntLiteral = int_value 18446744073709551614 [template] -// CHECK:STDOUT: %Expect.11: type = class_type @Expect, @Expect(%int_18446744073709551614) [template] +// CHECK:STDOUT: %Expect.16: type = class_type @Expect, @Expect(%int_18446744073709551614) [template] +// CHECK:STDOUT: %Test.specific_fn.15: = specific_function %Test, @Test(%int_18446744073709551614) [template] // CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template] // CHECK:STDOUT: %int_36893488147419103230: Core.IntLiteral = int_value 36893488147419103230 [template] -// CHECK:STDOUT: %Expect.12: type = class_type @Expect, @Expect(%int_36893488147419103230) [template] +// CHECK:STDOUT: %Expect.17: type = class_type @Expect, @Expect(%int_36893488147419103230) [template] +// CHECK:STDOUT: %Test.specific_fn.16: = specific_function %Test, @Test(%int_36893488147419103230) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.8: %Expect.8 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.9: %Expect.9 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.10: %Expect.10 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.11: %Expect.11 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.12: %Expect.12 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.13: %Expect.13 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.14: %Expect.14 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.15: %Expect.15 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.16: %Expect.16 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.17: %Expect.17 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -673,8 +1651,8 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { -// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] -// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] @@ -685,26 +1663,30 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] // CHECK:STDOUT: } // CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { -// CHECK:STDOUT: %N.patt.loc11_9.1: = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %N.param_patt: = value_param_pattern %N.patt.loc11_9.1, runtime_param [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] -// CHECK:STDOUT: %return.patt: = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] // CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %N.ref: = name_ref N, %N [template = ] -// CHECK:STDOUT: %N.param: = value_param runtime_param -// CHECK:STDOUT: %N: = bind_symbolic_name N, 0, %N.param [template = ] -// CHECK:STDOUT: %return.param: ref = out_param runtime_param0 -// CHECK:STDOUT: %return: ref = return_slot %return.param +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { // CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] -// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.1)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -719,232 +1701,1035 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%N: ) { -// CHECK:STDOUT: %N.patt.loc11_9.2: = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%N.param_patt: ) -> { +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: %empty_struct_type = struct_literal () -// CHECK:STDOUT: return +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc11: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc11_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc11_21: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.left_shift.loc11: init Core.IntLiteral = call %LeftShift.ref.loc11(%int_0.loc11_18, %int_0.loc11_21) [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc11 [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_23.2: Core.IntLiteral = converted %int.left_shift.loc11, %.loc11_23.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_23.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11_35: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_23.4: ref %Expect.2 = temporary %.loc11_23.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc12: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc12_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc12_21: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.left_shift.loc12: init Core.IntLiteral = call %LeftShift.ref.loc12(%int_0.loc12_18, %int_0.loc12_21) [template = constants.%int_0] +// CHECK:STDOUT: %.loc12_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc12 [template = constants.%int_0] +// CHECK:STDOUT: %.loc12_23.2: Core.IntLiteral = converted %int.left_shift.loc12, %.loc12_23.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc12_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.2 = call %Test.specific_fn.loc12() to %.loc12_23.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc12_35: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc12_23.4: ref %Expect.2 = temporary %.loc12_23.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc13_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc13: init Core.IntLiteral = call %LeftShift.ref.loc13(%int_0.loc13_18, %int_1.loc13) [template = constants.%int_0] +// CHECK:STDOUT: %.loc13_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc13 [template = constants.%int_0] +// CHECK:STDOUT: %.loc13_23.2: Core.IntLiteral = converted %int.left_shift.loc13, %.loc13_23.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_23.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_23.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc13_35: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_23.4: ref %Expect.2 = temporary %.loc13_23.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc14: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc14_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_30.loc14: Core.IntLiteral = int_value 30 [template = constants.%int_30] +// CHECK:STDOUT: %int.left_shift.loc14: init Core.IntLiteral = call %LeftShift.ref.loc14(%int_0.loc14_18, %int_30.loc14) [template = constants.%int_0] +// CHECK:STDOUT: %.loc14_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc14 [template = constants.%int_0] +// CHECK:STDOUT: %.loc14_24.2: Core.IntLiteral = converted %int.left_shift.loc14, %.loc14_24.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc14_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.2 = call %Test.specific_fn.loc14() to %.loc14_24.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc14_36: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc14_24.4: ref %Expect.2 = temporary %.loc14_24.3, %Test.call.loc14 // CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %int_0.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %int_0.loc15_21: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %int.left_shift.loc15: init Core.IntLiteral = call %LeftShift.ref.loc15(%int_0.loc15_18, %int_0.loc15_21) [template = constants.%int_0] +// CHECK:STDOUT: %int_1000000000: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %int.left_shift.loc15: init Core.IntLiteral = call %LeftShift.ref.loc15(%int_0.loc15_18, %int_1000000000) [template = constants.%int_0] +// CHECK:STDOUT: %.loc15_35.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc15 [template = constants.%int_0] +// CHECK:STDOUT: %.loc15_35.2: Core.IntLiteral = converted %int.left_shift.loc15, %.loc15_35.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc15_35.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.2 = call %Test.specific_fn.loc15() to %.loc15_35.3 // CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_0.loc15_35: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc15_47: Core.IntLiteral = int_value 0 [template = constants.%int_0] // CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] -// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %LeftShift.ref.loc16: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_0.loc16_18: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %int_1000000000000: Core.IntLiteral = int_value 1000000000000 [template = constants.%int_1000000000000] -// CHECK:STDOUT: %int.left_shift.loc16: init Core.IntLiteral = call %LeftShift.ref.loc16(%int_0.loc16_18, %int_1000000000000) [template = constants.%int_0] -// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_0.loc16_47: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc15_35.4: ref %Expect.2 = temporary %.loc15_35.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc18: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc18: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc18_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_0.loc18: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.left_shift.loc18: init Core.IntLiteral = call %LeftShift.ref.loc18(%int_1.loc18_18, %int_0.loc18) [template = constants.%int_1] +// CHECK:STDOUT: %.loc18_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc18 [template = constants.%int_1] +// CHECK:STDOUT: %.loc18_23.2: Core.IntLiteral = converted %int.left_shift.loc18, %.loc18_23.1 [template = constants.%int_1] +// CHECK:STDOUT: %Test.specific_fn.loc18: = specific_function %Test.ref.loc18, @Test(constants.%int_1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc18_23.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc18: init %Expect.3 = call %Test.specific_fn.loc18() to %.loc18_23.3 +// CHECK:STDOUT: %Expect.ref.loc18: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc18_35: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %Expect.loc18: type = class_type @Expect, @Expect(constants.%int_1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc18_23.4: ref %Expect.3 = temporary %.loc18_23.3, %Test.call.loc18 // CHECK:STDOUT: %Test.ref.loc19: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc19: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %int_1.loc19_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int_0.loc19: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %int.left_shift.loc19: init Core.IntLiteral = call %LeftShift.ref.loc19(%int_1.loc19_18, %int_0.loc19) [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc19_21: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc19: init Core.IntLiteral = call %LeftShift.ref.loc19(%int_1.loc19_18, %int_1.loc19_21) [template = constants.%int_2] +// CHECK:STDOUT: %.loc19_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc19 [template = constants.%int_2] +// CHECK:STDOUT: %.loc19_23.2: Core.IntLiteral = converted %int.left_shift.loc19, %.loc19_23.1 [template = constants.%int_2] +// CHECK:STDOUT: %Test.specific_fn.loc19: = specific_function %Test.ref.loc19, @Test(constants.%int_2) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc19_23.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc19: init %Expect.4 = call %Test.specific_fn.loc19() to %.loc19_23.3 // CHECK:STDOUT: %Expect.ref.loc19: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_1.loc19_35: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_1) [template = constants.%Expect.3] +// CHECK:STDOUT: %int_2.loc19: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_2) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc19_23.4: ref %Expect.4 = temporary %.loc19_23.3, %Test.call.loc19 // CHECK:STDOUT: %Test.ref.loc20: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc20: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc20_18: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int_1.loc20_21: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int.left_shift.loc20: init Core.IntLiteral = call %LeftShift.ref.loc20(%int_1.loc20_18, %int_1.loc20_21) [template = constants.%int_2] -// CHECK:STDOUT: %Expect.ref.loc20: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] // CHECK:STDOUT: %int_2.loc20: Core.IntLiteral = int_value 2 [template = constants.%int_2] -// CHECK:STDOUT: %Expect.loc20: type = class_type @Expect, @Expect(constants.%int_2) [template = constants.%Expect.4] +// CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc20: init Core.IntLiteral = call %LeftShift.ref.loc20(%int_2.loc20, %int_1.loc20) [template = constants.%int_4] +// CHECK:STDOUT: %.loc20_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc20 [template = constants.%int_4] +// CHECK:STDOUT: %.loc20_23.2: Core.IntLiteral = converted %int.left_shift.loc20, %.loc20_23.1 [template = constants.%int_4] +// CHECK:STDOUT: %Test.specific_fn.loc20: = specific_function %Test.ref.loc20, @Test(constants.%int_4) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc20_23.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc20: init %Expect.5 = call %Test.specific_fn.loc20() to %.loc20_23.3 +// CHECK:STDOUT: %Expect.ref.loc20: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_4.loc20: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %Expect.loc20: type = class_type @Expect, @Expect(constants.%int_4) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc20_23.4: ref %Expect.5 = temporary %.loc20_23.3, %Test.call.loc20 // CHECK:STDOUT: %Test.ref.loc21: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_2.loc21: Core.IntLiteral = int_value 2 [template = constants.%int_2] // CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int.left_shift.loc21: init Core.IntLiteral = call %LeftShift.ref.loc21(%int_2.loc21, %int_1.loc21) [template = constants.%int_4] +// CHECK:STDOUT: %int_2.loc21: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.left_shift.loc21: init Core.IntLiteral = call %LeftShift.ref.loc21(%int_1.loc21, %int_2.loc21) [template = constants.%int_4] +// CHECK:STDOUT: %.loc21_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc21 [template = constants.%int_4] +// CHECK:STDOUT: %.loc21_23.2: Core.IntLiteral = converted %int.left_shift.loc21, %.loc21_23.1 [template = constants.%int_4] +// CHECK:STDOUT: %Test.specific_fn.loc21: = specific_function %Test.ref.loc21, @Test(constants.%int_4) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc21_23.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc21: init %Expect.5 = call %Test.specific_fn.loc21() to %.loc21_23.3 // CHECK:STDOUT: %Expect.ref.loc21: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] // CHECK:STDOUT: %int_4.loc21: Core.IntLiteral = int_value 4 [template = constants.%int_4] // CHECK:STDOUT: %Expect.loc21: type = class_type @Expect, @Expect(constants.%int_4) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc21_23.4: ref %Expect.5 = temporary %.loc21_23.3, %Test.call.loc21 // CHECK:STDOUT: %Test.ref.loc22: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc22: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_3.loc22: Core.IntLiteral = int_value 3 [template = constants.%int_3] // CHECK:STDOUT: %int_2.loc22: Core.IntLiteral = int_value 2 [template = constants.%int_2] -// CHECK:STDOUT: %int.left_shift.loc22: init Core.IntLiteral = call %LeftShift.ref.loc22(%int_1.loc22, %int_2.loc22) [template = constants.%int_4] +// CHECK:STDOUT: %int.left_shift.loc22: init Core.IntLiteral = call %LeftShift.ref.loc22(%int_3.loc22, %int_2.loc22) [template = constants.%int_12] +// CHECK:STDOUT: %.loc22_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc22 [template = constants.%int_12] +// CHECK:STDOUT: %.loc22_23.2: Core.IntLiteral = converted %int.left_shift.loc22, %.loc22_23.1 [template = constants.%int_12] +// CHECK:STDOUT: %Test.specific_fn.loc22: = specific_function %Test.ref.loc22, @Test(constants.%int_12) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc22_23.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc22: init %Expect.6 = call %Test.specific_fn.loc22() to %.loc22_23.3 // CHECK:STDOUT: %Expect.ref.loc22: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_4.loc22: Core.IntLiteral = int_value 4 [template = constants.%int_4] -// CHECK:STDOUT: %Expect.loc22: type = class_type @Expect, @Expect(constants.%int_4) [template = constants.%Expect.5] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %Expect.loc22: type = class_type @Expect, @Expect(constants.%int_12) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc22_23.4: ref %Expect.6 = temporary %.loc22_23.3, %Test.call.loc22 // CHECK:STDOUT: %Test.ref.loc23: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc23: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_3.loc23: Core.IntLiteral = int_value 3 [template = constants.%int_3] // CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int.left_shift.loc23: init Core.IntLiteral = call %LeftShift.ref.loc23(%int_3.loc23, %int_1.loc23) [template = constants.%int_6] +// CHECK:STDOUT: %int_30.loc23: Core.IntLiteral = int_value 30 [template = constants.%int_30] +// CHECK:STDOUT: %int.left_shift.loc23: init Core.IntLiteral = call %LeftShift.ref.loc23(%int_1.loc23, %int_30.loc23) [template = constants.%int_1073741824] +// CHECK:STDOUT: %.loc23_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc23 [template = constants.%int_1073741824] +// CHECK:STDOUT: %.loc23_24.2: Core.IntLiteral = converted %int.left_shift.loc23, %.loc23_24.1 [template = constants.%int_1073741824] +// CHECK:STDOUT: %Test.specific_fn.loc23: = specific_function %Test.ref.loc23, @Test(constants.%int_1073741824) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc23_24.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc23: init %Expect.7 = call %Test.specific_fn.loc23() to %.loc23_24.3 // CHECK:STDOUT: %Expect.ref.loc23: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template = constants.%int_12] -// CHECK:STDOUT: %Expect.loc23: type = class_type @Expect, @Expect(constants.%int_12) [template = constants.%Expect.6] -// CHECK:STDOUT: %Test.ref.loc26: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc26_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %impl.elem0.loc26_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc26_18: = bound_method %int_1.loc26_19, %impl.elem0.loc26_18 [template = constants.%Op.bound.1] -// CHECK:STDOUT: %int.snegate.loc26_18: init Core.IntLiteral = call %Op.bound.loc26_18(%int_1.loc26_19) [template = constants.%int_-1] -// CHECK:STDOUT: %int_0.loc26: Core.IntLiteral = int_value 0 [template = constants.%int_0] -// CHECK:STDOUT: %.loc26_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_18 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc26_18.2: Core.IntLiteral = converted %int.snegate.loc26_18, %.loc26_18.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc26: init Core.IntLiteral = call %LeftShift.ref.loc26(%.loc26_18.2, %int_0.loc26) [template = constants.%int_-1] -// CHECK:STDOUT: %Expect.ref.loc26: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_1.loc26_37: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %impl.elem0.loc26_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc26_36: = bound_method %int_1.loc26_37, %impl.elem0.loc26_36 [template = constants.%Op.bound.1] -// CHECK:STDOUT: %int.snegate.loc26_36: init Core.IntLiteral = call %Op.bound.loc26_36(%int_1.loc26_37) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc26_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_36 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc26_38.2: Core.IntLiteral = converted %int.snegate.loc26_36, %.loc26_38.1 [template = constants.%int_-1] -// CHECK:STDOUT: %Expect.loc26: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.7] +// CHECK:STDOUT: %int_1073741824: Core.IntLiteral = int_value 1073741824 [template = constants.%int_1073741824] +// CHECK:STDOUT: %Expect.loc23: type = class_type @Expect, @Expect(constants.%int_1073741824) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc23_24.4: ref %Expect.7 = temporary %.loc23_24.3, %Test.call.loc23 +// CHECK:STDOUT: %Test.ref.loc24: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc24: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_2.loc24: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.left_shift.loc24: init Core.IntLiteral = call %LeftShift.ref.loc24(%int_5, %int_2.loc24) [template = constants.%int_20] +// CHECK:STDOUT: %.loc24_23.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc24 [template = constants.%int_20] +// CHECK:STDOUT: %.loc24_23.2: Core.IntLiteral = converted %int.left_shift.loc24, %.loc24_23.1 [template = constants.%int_20] +// CHECK:STDOUT: %Test.specific_fn.loc24: = specific_function %Test.ref.loc24, @Test(constants.%int_20) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc24_23.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc24: init %Expect.8 = call %Test.specific_fn.loc24() to %.loc24_23.3 +// CHECK:STDOUT: %Expect.ref.loc24: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [template = constants.%int_20] +// CHECK:STDOUT: %Expect.loc24: type = class_type @Expect, @Expect(constants.%int_20) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc24_23.4: ref %Expect.8 = temporary %.loc24_23.3, %Test.call.loc24 // CHECK:STDOUT: %Test.ref.loc27: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc27: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] // CHECK:STDOUT: %int_1.loc27_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] // CHECK:STDOUT: %impl.elem0.loc27_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] // CHECK:STDOUT: %Op.bound.loc27_18: = bound_method %int_1.loc27_19, %impl.elem0.loc27_18 [template = constants.%Op.bound.1] // CHECK:STDOUT: %int.snegate.loc27_18: init Core.IntLiteral = call %Op.bound.loc27_18(%int_1.loc27_19) [template = constants.%int_-1] -// CHECK:STDOUT: %int_1.loc27_22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_0.loc27: Core.IntLiteral = int_value 0 [template = constants.%int_0] // CHECK:STDOUT: %.loc27_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc27_18 [template = constants.%int_-1] // CHECK:STDOUT: %.loc27_18.2: Core.IntLiteral = converted %int.snegate.loc27_18, %.loc27_18.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc27: init Core.IntLiteral = call %LeftShift.ref.loc27(%.loc27_18.2, %int_1.loc27_22) [template = constants.%int_-2] +// CHECK:STDOUT: %int.left_shift.loc27: init Core.IntLiteral = call %LeftShift.ref.loc27(%.loc27_18.2, %int_0.loc27) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc27_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc27 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc27_24.2: Core.IntLiteral = converted %int.left_shift.loc27, %.loc27_24.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc27: = specific_function %Test.ref.loc27, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.8] +// CHECK:STDOUT: %.loc27_24.3: ref %Expect.9 = temporary_storage +// CHECK:STDOUT: %Test.call.loc27: init %Expect.9 = call %Test.specific_fn.loc27() to %.loc27_24.3 // CHECK:STDOUT: %Expect.ref.loc27: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_2.loc27: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int_1.loc27_37: Core.IntLiteral = int_value 1 [template = constants.%int_1] // CHECK:STDOUT: %impl.elem0.loc27_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc27_36: = bound_method %int_2.loc27, %impl.elem0.loc27_36 [template = constants.%Op.bound.2] -// CHECK:STDOUT: %int.snegate.loc27_36: init Core.IntLiteral = call %Op.bound.loc27_36(%int_2.loc27) [template = constants.%int_-2] -// CHECK:STDOUT: %.loc27_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc27_36 [template = constants.%int_-2] -// CHECK:STDOUT: %.loc27_38.2: Core.IntLiteral = converted %int.snegate.loc27_36, %.loc27_38.1 [template = constants.%int_-2] -// CHECK:STDOUT: %Expect.loc27: type = class_type @Expect, @Expect(constants.%int_-2) [template = constants.%Expect.8] +// CHECK:STDOUT: %Op.bound.loc27_36: = bound_method %int_1.loc27_37, %impl.elem0.loc27_36 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc27_36: init Core.IntLiteral = call %Op.bound.loc27_36(%int_1.loc27_37) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc27_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc27_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc27_38.2: Core.IntLiteral = converted %int.snegate.loc27_36, %.loc27_38.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc27: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.9] +// CHECK:STDOUT: %.loc27_24.4: ref %Expect.9 = temporary %.loc27_24.3, %Test.call.loc27 // CHECK:STDOUT: %Test.ref.loc28: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc28: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_2.loc28: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int_1.loc28_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] // CHECK:STDOUT: %impl.elem0.loc28_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc28_18: = bound_method %int_2.loc28, %impl.elem0.loc28_18 [template = constants.%Op.bound.2] -// CHECK:STDOUT: %int.snegate.loc28_18: init Core.IntLiteral = call %Op.bound.loc28_18(%int_2.loc28) [template = constants.%int_-2] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %.loc28_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_18 [template = constants.%int_-2] -// CHECK:STDOUT: %.loc28_18.2: Core.IntLiteral = converted %int.snegate.loc28_18, %.loc28_18.1 [template = constants.%int_-2] -// CHECK:STDOUT: %int.left_shift.loc28: init Core.IntLiteral = call %LeftShift.ref.loc28(%.loc28_18.2, %int_1.loc28) [template = constants.%int_-4] +// CHECK:STDOUT: %Op.bound.loc28_18: = bound_method %int_1.loc28_19, %impl.elem0.loc28_18 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc28_18: init Core.IntLiteral = call %Op.bound.loc28_18(%int_1.loc28_19) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc28_22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc28_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_18 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc28_18.2: Core.IntLiteral = converted %int.snegate.loc28_18, %.loc28_18.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc28: init Core.IntLiteral = call %LeftShift.ref.loc28(%.loc28_18.2, %int_1.loc28_22) [template = constants.%int_-2] +// CHECK:STDOUT: %.loc28_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc28 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc28_24.2: Core.IntLiteral = converted %int.left_shift.loc28, %.loc28_24.1 [template = constants.%int_-2] +// CHECK:STDOUT: %Test.specific_fn.loc28: = specific_function %Test.ref.loc28, @Test(constants.%int_-2) [template = constants.%Test.specific_fn.9] +// CHECK:STDOUT: %.loc28_24.3: ref %Expect.10 = temporary_storage +// CHECK:STDOUT: %Test.call.loc28: init %Expect.10 = call %Test.specific_fn.loc28() to %.loc28_24.3 // CHECK:STDOUT: %Expect.ref.loc28: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_4.loc28: Core.IntLiteral = int_value 4 [template = constants.%int_4] +// CHECK:STDOUT: %int_2.loc28: Core.IntLiteral = int_value 2 [template = constants.%int_2] // CHECK:STDOUT: %impl.elem0.loc28_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc28_36: = bound_method %int_4.loc28, %impl.elem0.loc28_36 [template = constants.%Op.bound.3] -// CHECK:STDOUT: %int.snegate.loc28_36: init Core.IntLiteral = call %Op.bound.loc28_36(%int_4.loc28) [template = constants.%int_-4] -// CHECK:STDOUT: %.loc28_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_36 [template = constants.%int_-4] -// CHECK:STDOUT: %.loc28_38.2: Core.IntLiteral = converted %int.snegate.loc28_36, %.loc28_38.1 [template = constants.%int_-4] -// CHECK:STDOUT: %Expect.loc28: type = class_type @Expect, @Expect(constants.%int_-4) [template = constants.%Expect.9] +// CHECK:STDOUT: %Op.bound.loc28_36: = bound_method %int_2.loc28, %impl.elem0.loc28_36 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc28_36: init Core.IntLiteral = call %Op.bound.loc28_36(%int_2.loc28) [template = constants.%int_-2] +// CHECK:STDOUT: %.loc28_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc28_36 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc28_38.2: Core.IntLiteral = converted %int.snegate.loc28_36, %.loc28_38.1 [template = constants.%int_-2] +// CHECK:STDOUT: %Expect.loc28: type = class_type @Expect, @Expect(constants.%int_-2) [template = constants.%Expect.10] +// CHECK:STDOUT: %.loc28_24.4: ref %Expect.10 = temporary %.loc28_24.3, %Test.call.loc28 // CHECK:STDOUT: %Test.ref.loc29: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_3.loc29: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %int_2.loc29: Core.IntLiteral = int_value 2 [template = constants.%int_2] // CHECK:STDOUT: %impl.elem0.loc29_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc29_18: = bound_method %int_3.loc29, %impl.elem0.loc29_18 [template = constants.%Op.bound.4] -// CHECK:STDOUT: %int.snegate.loc29_18: init Core.IntLiteral = call %Op.bound.loc29_18(%int_3.loc29) [template = constants.%int_-3] +// CHECK:STDOUT: %Op.bound.loc29_18: = bound_method %int_2.loc29, %impl.elem0.loc29_18 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc29_18: init Core.IntLiteral = call %Op.bound.loc29_18(%int_2.loc29) [template = constants.%int_-2] // CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %.loc29_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_18 [template = constants.%int_-3] -// CHECK:STDOUT: %.loc29_18.2: Core.IntLiteral = converted %int.snegate.loc29_18, %.loc29_18.1 [template = constants.%int_-3] -// CHECK:STDOUT: %int.left_shift.loc29: init Core.IntLiteral = call %LeftShift.ref.loc29(%.loc29_18.2, %int_1.loc29) [template = constants.%int_-6] +// CHECK:STDOUT: %.loc29_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_18 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc29_18.2: Core.IntLiteral = converted %int.snegate.loc29_18, %.loc29_18.1 [template = constants.%int_-2] +// CHECK:STDOUT: %int.left_shift.loc29: init Core.IntLiteral = call %LeftShift.ref.loc29(%.loc29_18.2, %int_1.loc29) [template = constants.%int_-4] +// CHECK:STDOUT: %.loc29_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc29 [template = constants.%int_-4] +// CHECK:STDOUT: %.loc29_24.2: Core.IntLiteral = converted %int.left_shift.loc29, %.loc29_24.1 [template = constants.%int_-4] +// CHECK:STDOUT: %Test.specific_fn.loc29: = specific_function %Test.ref.loc29, @Test(constants.%int_-4) [template = constants.%Test.specific_fn.10] +// CHECK:STDOUT: %.loc29_24.3: ref %Expect.11 = temporary_storage +// CHECK:STDOUT: %Test.call.loc29: init %Expect.11 = call %Test.specific_fn.loc29() to %.loc29_24.3 // CHECK:STDOUT: %Expect.ref.loc29: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %int_4.loc29: Core.IntLiteral = int_value 4 [template = constants.%int_4] // CHECK:STDOUT: %impl.elem0.loc29_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound.loc29_36: = bound_method %int_5, %impl.elem0.loc29_36 [template = constants.%Op.bound.5] -// CHECK:STDOUT: %int.snegate.loc29_36: init Core.IntLiteral = call %Op.bound.loc29_36(%int_5) [template = constants.%int_-5] -// CHECK:STDOUT: %.loc29_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_36 [template = constants.%int_-5] -// CHECK:STDOUT: %.loc29_38.2: Core.IntLiteral = converted %int.snegate.loc29_36, %.loc29_38.1 [template = constants.%int_-5] -// CHECK:STDOUT: %Expect.loc29: type = class_type @Expect, @Expect(constants.%int_-5) [template = constants.%Expect.10] -// CHECK:STDOUT: %Test.ref.loc32: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] -// CHECK:STDOUT: %LeftShift.ref.loc32: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] -// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int.left_shift.loc32: init Core.IntLiteral = call %LeftShift.ref.loc32(%int_9223372036854775807, %int_1.loc32) [template = constants.%int_18446744073709551614] -// CHECK:STDOUT: %Expect.ref.loc32: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] -// CHECK:STDOUT: %int_18446744073709551614: Core.IntLiteral = int_value 18446744073709551614 [template = constants.%int_18446744073709551614] -// CHECK:STDOUT: %Expect.loc32: type = class_type @Expect, @Expect(constants.%int_18446744073709551614) [template = constants.%Expect.11] +// CHECK:STDOUT: %Op.bound.loc29_36: = bound_method %int_4.loc29, %impl.elem0.loc29_36 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc29_36: init Core.IntLiteral = call %Op.bound.loc29_36(%int_4.loc29) [template = constants.%int_-4] +// CHECK:STDOUT: %.loc29_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc29_36 [template = constants.%int_-4] +// CHECK:STDOUT: %.loc29_38.2: Core.IntLiteral = converted %int.snegate.loc29_36, %.loc29_38.1 [template = constants.%int_-4] +// CHECK:STDOUT: %Expect.loc29: type = class_type @Expect, @Expect(constants.%int_-4) [template = constants.%Expect.11] +// CHECK:STDOUT: %.loc29_24.4: ref %Expect.11 = temporary %.loc29_24.3, %Test.call.loc29 +// CHECK:STDOUT: %Test.ref.loc30: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc30: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_3.loc30: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc30_18: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc30_18: = bound_method %int_3.loc30, %impl.elem0.loc30_18 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc30_18: init Core.IntLiteral = call %Op.bound.loc30_18(%int_3.loc30) [template = constants.%int_-3] +// CHECK:STDOUT: %int_1.loc30: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc30_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc30_18 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc30_18.2: Core.IntLiteral = converted %int.snegate.loc30_18, %.loc30_18.1 [template = constants.%int_-3] +// CHECK:STDOUT: %int.left_shift.loc30: init Core.IntLiteral = call %LeftShift.ref.loc30(%.loc30_18.2, %int_1.loc30) [template = constants.%int_-6] +// CHECK:STDOUT: %.loc30_24.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc30 [template = constants.%int_-6] +// CHECK:STDOUT: %.loc30_24.2: Core.IntLiteral = converted %int.left_shift.loc30, %.loc30_24.1 [template = constants.%int_-6] +// CHECK:STDOUT: %Test.specific_fn.loc30: = specific_function %Test.ref.loc30, @Test(constants.%int_-6) [template = constants.%Test.specific_fn.11] +// CHECK:STDOUT: %.loc30_24.3: ref %Expect.12 = temporary_storage +// CHECK:STDOUT: %Test.call.loc30: init %Expect.12 = call %Test.specific_fn.loc30() to %.loc30_24.3 +// CHECK:STDOUT: %Expect.ref.loc30: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %impl.elem0.loc30_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc30_36: = bound_method %int_6, %impl.elem0.loc30_36 [template = constants.%Op.bound.5] +// CHECK:STDOUT: %int.snegate.loc30_36: init Core.IntLiteral = call %Op.bound.loc30_36(%int_6) [template = constants.%int_-6] +// CHECK:STDOUT: %.loc30_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc30_36 [template = constants.%int_-6] +// CHECK:STDOUT: %.loc30_38.2: Core.IntLiteral = converted %int.snegate.loc30_36, %.loc30_38.1 [template = constants.%int_-6] +// CHECK:STDOUT: %Expect.loc30: type = class_type @Expect, @Expect(constants.%int_-6) [template = constants.%Expect.12] +// CHECK:STDOUT: %.loc30_24.4: ref %Expect.12 = temporary %.loc30_24.3, %Test.call.loc30 // CHECK:STDOUT: %Test.ref.loc33: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] // CHECK:STDOUT: %LeftShift.ref.loc33: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template = constants.%int_18446744073709551615] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template = constants.%int_4294967295] // CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int.left_shift.loc33: init Core.IntLiteral = call %LeftShift.ref.loc33(%int_18446744073709551615, %int_1.loc33) [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %int.left_shift.loc33: init Core.IntLiteral = call %LeftShift.ref.loc33(%int_4294967295, %int_1.loc33) [template = constants.%int_8589934590] +// CHECK:STDOUT: %.loc33_33.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc33 [template = constants.%int_8589934590] +// CHECK:STDOUT: %.loc33_33.2: Core.IntLiteral = converted %int.left_shift.loc33, %.loc33_33.1 [template = constants.%int_8589934590] +// CHECK:STDOUT: %Test.specific_fn.loc33: = specific_function %Test.ref.loc33, @Test(constants.%int_8589934590) [template = constants.%Test.specific_fn.12] +// CHECK:STDOUT: %.loc33_33.3: ref %Expect.13 = temporary_storage +// CHECK:STDOUT: %Test.call.loc33: init %Expect.13 = call %Test.specific_fn.loc33() to %.loc33_33.3 // CHECK:STDOUT: %Expect.ref.loc33: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_8589934590: Core.IntLiteral = int_value 8589934590 [template = constants.%int_8589934590] +// CHECK:STDOUT: %Expect.loc33: type = class_type @Expect, @Expect(constants.%int_8589934590) [template = constants.%Expect.13] +// CHECK:STDOUT: %.loc33_33.4: ref %Expect.13 = temporary %.loc33_33.3, %Test.call.loc33 +// CHECK:STDOUT: %Test.ref.loc34: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc34: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_4294967294: Core.IntLiteral = int_value 4294967294 [template = constants.%int_4294967294] +// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc34: init Core.IntLiteral = call %LeftShift.ref.loc34(%int_4294967294, %int_1.loc34) [template = constants.%int_8589934588] +// CHECK:STDOUT: %.loc34_33.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc34 [template = constants.%int_8589934588] +// CHECK:STDOUT: %.loc34_33.2: Core.IntLiteral = converted %int.left_shift.loc34, %.loc34_33.1 [template = constants.%int_8589934588] +// CHECK:STDOUT: %Test.specific_fn.loc34: = specific_function %Test.ref.loc34, @Test(constants.%int_8589934588) [template = constants.%Test.specific_fn.13] +// CHECK:STDOUT: %.loc34_33.3: ref %Expect.14 = temporary_storage +// CHECK:STDOUT: %Test.call.loc34: init %Expect.14 = call %Test.specific_fn.loc34() to %.loc34_33.3 +// CHECK:STDOUT: %Expect.ref.loc34: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_8589934588: Core.IntLiteral = int_value 8589934588 [template = constants.%int_8589934588] +// CHECK:STDOUT: %Expect.loc34: type = class_type @Expect, @Expect(constants.%int_8589934588) [template = constants.%Expect.14] +// CHECK:STDOUT: %.loc34_33.4: ref %Expect.14 = temporary %.loc34_33.3, %Test.call.loc34 +// CHECK:STDOUT: %Test.ref.loc35: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc35: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template = constants.%int_2882400001] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8] +// CHECK:STDOUT: %int.left_shift.loc35: init Core.IntLiteral = call %LeftShift.ref.loc35(%int_2882400001, %int_8) [template = constants.%int_737894400256] +// CHECK:STDOUT: %.loc35_33.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc35 [template = constants.%int_737894400256] +// CHECK:STDOUT: %.loc35_33.2: Core.IntLiteral = converted %int.left_shift.loc35, %.loc35_33.1 [template = constants.%int_737894400256] +// CHECK:STDOUT: %Test.specific_fn.loc35: = specific_function %Test.ref.loc35, @Test(constants.%int_737894400256) [template = constants.%Test.specific_fn.14] +// CHECK:STDOUT: %.loc35_33.3: ref %Expect.15 = temporary_storage +// CHECK:STDOUT: %Test.call.loc35: init %Expect.15 = call %Test.specific_fn.loc35() to %.loc35_33.3 +// CHECK:STDOUT: %Expect.ref.loc35: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_737894400256: Core.IntLiteral = int_value 737894400256 [template = constants.%int_737894400256] +// CHECK:STDOUT: %Expect.loc35: type = class_type @Expect, @Expect(constants.%int_737894400256) [template = constants.%Expect.15] +// CHECK:STDOUT: %.loc35_33.4: ref %Expect.15 = temporary %.loc35_33.3, %Test.call.loc35 +// CHECK:STDOUT: %Test.ref.loc36: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc36: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc36: init Core.IntLiteral = call %LeftShift.ref.loc36(%int_9223372036854775807, %int_1.loc36) [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %.loc36_43.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc36 [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %.loc36_43.2: Core.IntLiteral = converted %int.left_shift.loc36, %.loc36_43.1 [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %Test.specific_fn.loc36: = specific_function %Test.ref.loc36, @Test(constants.%int_18446744073709551614) [template = constants.%Test.specific_fn.15] +// CHECK:STDOUT: %.loc36_43.3: ref %Expect.16 = temporary_storage +// CHECK:STDOUT: %Test.call.loc36: init %Expect.16 = call %Test.specific_fn.loc36() to %.loc36_43.3 +// CHECK:STDOUT: %Expect.ref.loc36: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_18446744073709551614: Core.IntLiteral = int_value 18446744073709551614 [template = constants.%int_18446744073709551614] +// CHECK:STDOUT: %Expect.loc36: type = class_type @Expect, @Expect(constants.%int_18446744073709551614) [template = constants.%Expect.16] +// CHECK:STDOUT: %.loc36_43.4: ref %Expect.16 = temporary %.loc36_43.3, %Test.call.loc36 +// CHECK:STDOUT: %Test.ref.loc37: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %LeftShift.ref.loc37: %LeftShift.type = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template = constants.%int_18446744073709551615] +// CHECK:STDOUT: %int_1.loc37: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.left_shift.loc37: init Core.IntLiteral = call %LeftShift.ref.loc37(%int_18446744073709551615, %int_1.loc37) [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %.loc37_43.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc37 [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %.loc37_43.2: Core.IntLiteral = converted %int.left_shift.loc37, %.loc37_43.1 [template = constants.%int_36893488147419103230] +// CHECK:STDOUT: %Test.specific_fn.loc37: = specific_function %Test.ref.loc37, @Test(constants.%int_36893488147419103230) [template = constants.%Test.specific_fn.16] +// CHECK:STDOUT: %.loc37_43.3: ref %Expect.17 = temporary_storage +// CHECK:STDOUT: %Test.call.loc37: init %Expect.17 = call %Test.specific_fn.loc37() to %.loc37_43.3 +// CHECK:STDOUT: %Expect.ref.loc37: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] // CHECK:STDOUT: %int_36893488147419103230: Core.IntLiteral = int_value 36893488147419103230 [template = constants.%int_36893488147419103230] -// CHECK:STDOUT: %Expect.loc33: type = class_type @Expect, @Expect(constants.%int_36893488147419103230) [template = constants.%Expect.12] +// CHECK:STDOUT: %Expect.loc37: type = class_type @Expect, @Expect(constants.%int_36893488147419103230) [template = constants.%Expect.17] +// CHECK:STDOUT: %.loc37_43.4: ref %Expect.17 = temporary %.loc37_43.3, %Test.call.loc37 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%N) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%N // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test() { -// CHECK:STDOUT: %N.patt.loc11_9.2 => +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_0) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_1) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_1 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_2) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_4) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_4 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_4 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_4) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_4 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_12) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_12 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_12 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_12) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_12 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_12 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1073741824) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_1073741824 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_1073741824 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1073741824) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_1073741824 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_1073741824 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_20) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_20 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_20 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_20) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_20 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_20 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.9 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_-1) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-1 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-2 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.10 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_-2) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-2 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-4) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-4 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-4 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.11 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Expect(constants.%int_-4) { // CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-4 // CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-6) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-6 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-6 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.12 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-6) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-6 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_8589934590) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_8589934590 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_8589934590 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.13 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.13 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_8589934590) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_8589934590 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_8589934590 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_8589934588) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_8589934588 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_8589934588 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.14 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_8589934588) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_8589934588 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_8589934588 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_737894400256) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_737894400256 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_737894400256 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.15 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_737894400256) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_737894400256 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_737894400256 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_18446744073709551614) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.16 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.16 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_18446744073709551614) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_18446744073709551614 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_36893488147419103230) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.17 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_36893488147419103230) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_bad_shift.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32.1) [template] +// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] +// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %LeftShiftLit.type: type = fn_type @LeftShiftLit [template] +// CHECK:STDOUT: %LeftShiftLit: %LeftShiftLit.type = struct_value () [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32.1) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] +// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_32.2: %i32 = int_value 32 [template] +// CHECK:STDOUT: %int_33.1: Core.IntLiteral = int_value 33 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_33.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_33.2: %i32 = int_value 33 [template] +// CHECK:STDOUT: %int_1000.1: Core.IntLiteral = int_value 1000 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_1000.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_1000.2: %i32 = int_value 1000 [template] +// CHECK:STDOUT: %int_0.1: %i32 = int_value 0 [template] +// CHECK:STDOUT: %int_0.2: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_0.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .IntLiteral = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .Negate = %import_ref.230 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LeftShift = %LeftShift.decl +// CHECK:STDOUT: .LeftShiftLit = %LeftShiftLit.decl +// CHECK:STDOUT: .size_1 = @__global_init.%size_1 +// CHECK:STDOUT: .size_2 = @__global_init.%size_2 +// CHECK:STDOUT: .size_3 = @__global_init.%size_3 +// CHECK:STDOUT: .overflow_1 = @__global_init.%overflow_1 +// CHECK:STDOUT: .overflow_2 = @__global_init.%overflow_2 +// CHECK:STDOUT: .no_overflow_1 = @__global_init.%no_overflow_1 +// CHECK:STDOUT: .no_overflow_2 = @__global_init.%no_overflow_2 +// CHECK:STDOUT: .negative = @__global_init.%negative +// CHECK:STDOUT: .negative_zero = @__global_init.%negative_zero +// CHECK:STDOUT: .negative_lit = @__global_init.%negative_lit +// CHECK:STDOUT: .negative_lit_zero = @__global_init.%negative_lit_zero +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc4_17: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc4_17: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_25: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc4_25: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_33: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc4_33: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %LeftShiftLit.decl: %LeftShiftLit.type = fn_decl @LeftShiftLit [template = constants.%LeftShiftLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc5_20: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_24: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_36: init type = call %IntLiteral.ref.loc5_24() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_36.1: type = value_of_initializer %int_literal.make_type.loc5_36 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_36.2: type = converted %int_literal.make_type.loc5_36, %.loc5_36.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc5_50: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_54: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_66: init type = call %IntLiteral.ref.loc5_54() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_66.1: type = value_of_initializer %int_literal.make_type.loc5_66 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_66.2: type = converted %int_literal.make_type.loc5_66, %.loc5_66.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc29: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc29: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc34: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc41: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc41: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc46: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc46: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc51: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc51: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc51: init type = call %IntLiteral.ref.loc51() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc51_35.1: type = value_of_initializer %int_literal.make_type.loc51 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc51_35.2: type = converted %int_literal.make_type.loc51, %.loc51_35.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc56: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc56: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc56: init type = call %IntLiteral.ref.loc56() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc56_40.1: type = value_of_initializer %int_literal.make_type.loc56 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc56_40.2: type = converted %int_literal.make_type.loc56, %.loc56_40.1 [template = Core.IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%int_-5) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-5 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-5 -// CHECK:STDOUT: } +// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.left_shift"; // CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%int_18446744073709551614) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_18446744073709551614 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_18446744073709551614 -// CHECK:STDOUT: } +// CHECK:STDOUT: fn @LeftShiftLit(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> Core.IntLiteral = "int.left_shift"; // CHECK:STDOUT: -// CHECK:STDOUT: specific @Expect(constants.%int_36893488147419103230) { -// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_36893488147419103230 -// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_36893488147419103230 +// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %LeftShift.ref.loc8: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_31.loc8: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc8_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc8_29: = bound_method %int_1.loc8, %impl.elem0.loc8_29 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc8_29: = specific_function %Convert.bound.loc8_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc8_29: init %i32 = call %Convert.specific_fn.loc8_29(%int_1.loc8) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc8_29.1: %i32 = value_of_initializer %int.convert_checked.loc8_29 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc8_29.2: %i32 = converted %int_1.loc8, %.loc8_29.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc8_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc8_32: = bound_method %int_31.loc8, %impl.elem0.loc8_32 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc8_32: = specific_function %Convert.bound.loc8_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc8_32: init %i32 = call %Convert.specific_fn.loc8_32(%int_31.loc8) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc8_32.1: %i32 = value_of_initializer %int.convert_checked.loc8_32 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc8_32.2: %i32 = converted %int_31.loc8, %.loc8_32.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.left_shift.loc8: init %i32 = call %LeftShift.ref.loc8(%.loc8_29.2, %.loc8_32.2) [template = constants.%int_-2147483648] +// CHECK:STDOUT: %.loc8_35.1: %i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%int_-2147483648] +// CHECK:STDOUT: %.loc8_35.2: %i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%int_-2147483648] +// CHECK:STDOUT: %size_1: %i32 = bind_name size_1, %.loc8_35.2 +// CHECK:STDOUT: %LeftShift.ref.loc13: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %impl.elem0.loc13_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_29: = bound_method %int_1.loc13, %impl.elem0.loc13_29 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc13_29: = specific_function %Convert.bound.loc13_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc13_29: init %i32 = call %Convert.specific_fn.loc13_29(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_29.1: %i32 = value_of_initializer %int.convert_checked.loc13_29 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_29.2: %i32 = converted %int_1.loc13, %.loc13_29.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_32: = bound_method %int_32.loc13, %impl.elem0.loc13_32 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_32: = specific_function %Convert.bound.loc13_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_32: init %i32 = call %Convert.specific_fn.loc13_32(%int_32.loc13) [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc13_32.1: %i32 = value_of_initializer %int.convert_checked.loc13_32 [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc13_32.2: %i32 = converted %int_32.loc13, %.loc13_32.1 [template = constants.%int_32.2] +// CHECK:STDOUT: %int.left_shift.loc13: init %i32 = call %LeftShift.ref.loc13(%.loc13_29.2, %.loc13_32.2) [template = ] +// CHECK:STDOUT: %.loc13_35.1: %i32 = value_of_initializer %int.left_shift.loc13 [template = ] +// CHECK:STDOUT: %.loc13_35.2: %i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] +// CHECK:STDOUT: %size_2: %i32 = bind_name size_2, %.loc13_35.2 +// CHECK:STDOUT: %LeftShift.ref.loc18: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [template = constants.%int_33.1] +// CHECK:STDOUT: %impl.elem0.loc18_29: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc18_29: = bound_method %int_1.loc18, %impl.elem0.loc18_29 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc18_29: = specific_function %Convert.bound.loc18_29, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc18_29: init %i32 = call %Convert.specific_fn.loc18_29(%int_1.loc18) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc18_29.1: %i32 = value_of_initializer %int.convert_checked.loc18_29 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc18_29.2: %i32 = converted %int_1.loc18, %.loc18_29.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc18_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc18_32: = bound_method %int_33, %impl.elem0.loc18_32 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc18_32: = specific_function %Convert.bound.loc18_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc18_32: init %i32 = call %Convert.specific_fn.loc18_32(%int_33) [template = constants.%int_33.2] +// CHECK:STDOUT: %.loc18_32.1: %i32 = value_of_initializer %int.convert_checked.loc18_32 [template = constants.%int_33.2] +// CHECK:STDOUT: %.loc18_32.2: %i32 = converted %int_33, %.loc18_32.1 [template = constants.%int_33.2] +// CHECK:STDOUT: %int.left_shift.loc18: init %i32 = call %LeftShift.ref.loc18(%.loc18_29.2, %.loc18_32.2) [template = ] +// CHECK:STDOUT: %.loc18_35.1: %i32 = value_of_initializer %int.left_shift.loc18 [template = ] +// CHECK:STDOUT: %.loc18_35.2: %i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] +// CHECK:STDOUT: %size_3: %i32 = bind_name size_3, %.loc18_35.2 +// CHECK:STDOUT: %LeftShift.ref.loc21: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1000.loc21: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] +// CHECK:STDOUT: %int_31.loc21: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc21_33: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc21_33: = bound_method %int_1000.loc21, %impl.elem0.loc21_33 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc21_33: = specific_function %Convert.bound.loc21_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc21_33: init %i32 = call %Convert.specific_fn.loc21_33(%int_1000.loc21) [template = constants.%int_1000.2] +// CHECK:STDOUT: %.loc21_33.1: %i32 = value_of_initializer %int.convert_checked.loc21_33 [template = constants.%int_1000.2] +// CHECK:STDOUT: %.loc21_33.2: %i32 = converted %int_1000.loc21, %.loc21_33.1 [template = constants.%int_1000.2] +// CHECK:STDOUT: %impl.elem0.loc21_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc21_39: = bound_method %int_31.loc21, %impl.elem0.loc21_39 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc21_39: = specific_function %Convert.bound.loc21_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc21_39: init %i32 = call %Convert.specific_fn.loc21_39(%int_31.loc21) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc21_39.1: %i32 = value_of_initializer %int.convert_checked.loc21_39 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc21_39.2: %i32 = converted %int_31.loc21, %.loc21_39.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.left_shift.loc21: init %i32 = call %LeftShift.ref.loc21(%.loc21_33.2, %.loc21_39.2) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc21_42.1: %i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc21_42.2: %i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %overflow_1: %i32 = bind_name overflow_1, %.loc21_42.2 +// CHECK:STDOUT: %LeftShift.ref.loc26: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1000.loc26: Core.IntLiteral = int_value 1000 [template = constants.%int_1000.1] +// CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %impl.elem0.loc26_33: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc26_33: = bound_method %int_1000.loc26, %impl.elem0.loc26_33 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc26_33: = specific_function %Convert.bound.loc26_33, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc26_33: init %i32 = call %Convert.specific_fn.loc26_33(%int_1000.loc26) [template = constants.%int_1000.2] +// CHECK:STDOUT: %.loc26_33.1: %i32 = value_of_initializer %int.convert_checked.loc26_33 [template = constants.%int_1000.2] +// CHECK:STDOUT: %.loc26_33.2: %i32 = converted %int_1000.loc26, %.loc26_33.1 [template = constants.%int_1000.2] +// CHECK:STDOUT: %impl.elem0.loc26_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc26_39: = bound_method %int_32.loc26, %impl.elem0.loc26_39 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc26_39: = specific_function %Convert.bound.loc26_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc26_39: init %i32 = call %Convert.specific_fn.loc26_39(%int_32.loc26) [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc26_39.1: %i32 = value_of_initializer %int.convert_checked.loc26_39 [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc26_39.2: %i32 = converted %int_32.loc26, %.loc26_39.1 [template = constants.%int_32.2] +// CHECK:STDOUT: %int.left_shift.loc26: init %i32 = call %LeftShift.ref.loc26(%.loc26_33.2, %.loc26_39.2) [template = ] +// CHECK:STDOUT: %.loc26_42.1: %i32 = value_of_initializer %int.left_shift.loc26 [template = ] +// CHECK:STDOUT: %.loc26_42.2: %i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] +// CHECK:STDOUT: %overflow_2: %i32 = bind_name overflow_2, %.loc26_42.2 +// CHECK:STDOUT: %LeftShift.ref.loc29: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_31.loc29: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc29_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc29_36: = bound_method %int_0.loc29, %impl.elem0.loc29_36 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc29_36: = specific_function %Convert.bound.loc29_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc29_36: init %i32 = call %Convert.specific_fn.loc29_36(%int_0.loc29) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc29_36.1: %i32 = value_of_initializer %int.convert_checked.loc29_36 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc29_36.2: %i32 = converted %int_0.loc29, %.loc29_36.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc29_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc29_39: = bound_method %int_31.loc29, %impl.elem0.loc29_39 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc29_39: = specific_function %Convert.bound.loc29_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc29_39: init %i32 = call %Convert.specific_fn.loc29_39(%int_31.loc29) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc29_39.1: %i32 = value_of_initializer %int.convert_checked.loc29_39 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc29_39.2: %i32 = converted %int_31.loc29, %.loc29_39.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.left_shift.loc29: init %i32 = call %LeftShift.ref.loc29(%.loc29_36.2, %.loc29_39.2) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc29_42.1: %i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc29_42.2: %i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %no_overflow_1: %i32 = bind_name no_overflow_1, %.loc29_42.2 +// CHECK:STDOUT: %LeftShift.ref.loc34: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc34: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_32.loc34: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %impl.elem0.loc34_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc34_36: = bound_method %int_0.loc34, %impl.elem0.loc34_36 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc34_36: = specific_function %Convert.bound.loc34_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc34_36: init %i32 = call %Convert.specific_fn.loc34_36(%int_0.loc34) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc34_36.1: %i32 = value_of_initializer %int.convert_checked.loc34_36 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc34_36.2: %i32 = converted %int_0.loc34, %.loc34_36.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc34_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc34_39: = bound_method %int_32.loc34, %impl.elem0.loc34_39 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc34_39: = specific_function %Convert.bound.loc34_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc34_39: init %i32 = call %Convert.specific_fn.loc34_39(%int_32.loc34) [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc34_39.1: %i32 = value_of_initializer %int.convert_checked.loc34_39 [template = constants.%int_32.2] +// CHECK:STDOUT: %.loc34_39.2: %i32 = converted %int_32.loc34, %.loc34_39.1 [template = constants.%int_32.2] +// CHECK:STDOUT: %int.left_shift.loc34: init %i32 = call %LeftShift.ref.loc34(%.loc34_36.2, %.loc34_39.2) [template = ] +// CHECK:STDOUT: %.loc34_42.1: %i32 = value_of_initializer %int.left_shift.loc34 [template = ] +// CHECK:STDOUT: %.loc34_42.2: %i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] +// CHECK:STDOUT: %no_overflow_2: %i32 = bind_name no_overflow_2, %.loc34_42.2 +// CHECK:STDOUT: %LeftShift.ref.loc41: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc41_31: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc41_35: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc41_34.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc41: = bound_method %int_1.loc41_35, %impl.elem0.loc41_34.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc41: init Core.IntLiteral = call %Op.bound.loc41(%int_1.loc41_35) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc41_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc41_31: = bound_method %int_1.loc41_31, %impl.elem0.loc41_31 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc41_31: = specific_function %Convert.bound.loc41_31, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc41_31: init %i32 = call %Convert.specific_fn.loc41_31(%int_1.loc41_31) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_31.1: %i32 = value_of_initializer %int.convert_checked.loc41_31 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc41_31.2: %i32 = converted %int_1.loc41_31, %.loc41_31.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc41_34.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc41_34: = bound_method %int.snegate.loc41, %impl.elem0.loc41_34.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc41_34: = specific_function %Convert.bound.loc41_34, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc41_34.1: Core.IntLiteral = value_of_initializer %int.snegate.loc41 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc41_34.2: Core.IntLiteral = converted %int.snegate.loc41, %.loc41_34.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc41_34: init %i32 = call %Convert.specific_fn.loc41_34(%.loc41_34.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc41_34.3: %i32 = value_of_initializer %int.convert_checked.loc41_34 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc41_34.4: %i32 = converted %int.snegate.loc41, %.loc41_34.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.left_shift.loc41: init %i32 = call %LeftShift.ref.loc41(%.loc41_31.2, %.loc41_34.4) [template = ] +// CHECK:STDOUT: %.loc41_37.1: %i32 = value_of_initializer %int.left_shift.loc41 [template = ] +// CHECK:STDOUT: %.loc41_37.2: %i32 = converted %int.left_shift.loc41, %.loc41_37.1 [template = ] +// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc41_37.2 +// CHECK:STDOUT: %LeftShift.ref.loc46: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_0.loc46: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc46_39.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc46: = bound_method %int_1.loc46, %impl.elem0.loc46_39.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc46: init Core.IntLiteral = call %Op.bound.loc46(%int_1.loc46) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc46_36: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc46_36: = bound_method %int_0.loc46, %impl.elem0.loc46_36 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc46_36: = specific_function %Convert.bound.loc46_36, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc46_36: init %i32 = call %Convert.specific_fn.loc46_36(%int_0.loc46) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc46_36.1: %i32 = value_of_initializer %int.convert_checked.loc46_36 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc46_36.2: %i32 = converted %int_0.loc46, %.loc46_36.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc46_39.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc46_39: = bound_method %int.snegate.loc46, %impl.elem0.loc46_39.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc46_39: = specific_function %Convert.bound.loc46_39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc46_39.1: Core.IntLiteral = value_of_initializer %int.snegate.loc46 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc46_39.2: Core.IntLiteral = converted %int.snegate.loc46, %.loc46_39.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc46_39: init %i32 = call %Convert.specific_fn.loc46_39(%.loc46_39.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc46_39.3: %i32 = value_of_initializer %int.convert_checked.loc46_39 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc46_39.4: %i32 = converted %int.snegate.loc46, %.loc46_39.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.left_shift.loc46: init %i32 = call %LeftShift.ref.loc46(%.loc46_36.2, %.loc46_39.4) [template = ] +// CHECK:STDOUT: %.loc46_42.1: %i32 = value_of_initializer %int.left_shift.loc46 [template = ] +// CHECK:STDOUT: %.loc46_42.2: %i32 = converted %int.left_shift.loc46, %.loc46_42.1 [template = ] +// CHECK:STDOUT: %negative_zero: %i32 = bind_name negative_zero, %.loc46_42.2 +// CHECK:STDOUT: %LeftShiftLit.ref.loc51: %LeftShiftLit.type = name_ref LeftShiftLit, file.%LeftShiftLit.decl [template = constants.%LeftShiftLit] +// CHECK:STDOUT: %int_1.loc51_52: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc51_56: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc51_55.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc51: = bound_method %int_1.loc51_56, %impl.elem0.loc51_55.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc51: init Core.IntLiteral = call %Op.bound.loc51(%int_1.loc51_56) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc51_55.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc51: = bound_method %int.snegate.loc51, %impl.elem0.loc51_55.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc51: = specific_function %Convert.bound.loc51, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc51_55.1: Core.IntLiteral = value_of_initializer %int.snegate.loc51 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc51_55.2: Core.IntLiteral = converted %int.snegate.loc51, %.loc51_55.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc51: init %i32 = call %Convert.specific_fn.loc51(%.loc51_55.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc51_55.3: %i32 = value_of_initializer %int.convert_checked.loc51 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc51_55.4: %i32 = converted %int.snegate.loc51, %.loc51_55.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.left_shift.loc51: init Core.IntLiteral = call %LeftShiftLit.ref.loc51(%int_1.loc51_52, %.loc51_55.4) [template = ] +// CHECK:STDOUT: %.loc51_58.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc51 [template = ] +// CHECK:STDOUT: %.loc51_58.2: Core.IntLiteral = converted %int.left_shift.loc51, %.loc51_58.1 [template = ] +// CHECK:STDOUT: %negative_lit: Core.IntLiteral = bind_name negative_lit, %.loc51_58.2 +// CHECK:STDOUT: %LeftShiftLit.ref.loc56: %LeftShiftLit.type = name_ref LeftShiftLit, file.%LeftShiftLit.decl [template = constants.%LeftShiftLit] +// CHECK:STDOUT: %int_0.loc56: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_1.loc56: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc56_60.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc56: = bound_method %int_1.loc56, %impl.elem0.loc56_60.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc56: init Core.IntLiteral = call %Op.bound.loc56(%int_1.loc56) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc56_60.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc56: = bound_method %int.snegate.loc56, %impl.elem0.loc56_60.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc56: = specific_function %Convert.bound.loc56, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc56_60.1: Core.IntLiteral = value_of_initializer %int.snegate.loc56 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc56_60.2: Core.IntLiteral = converted %int.snegate.loc56, %.loc56_60.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc56: init %i32 = call %Convert.specific_fn.loc56(%.loc56_60.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc56_60.3: %i32 = value_of_initializer %int.convert_checked.loc56 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc56_60.4: %i32 = converted %int.snegate.loc56, %.loc56_60.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.left_shift.loc56: init Core.IntLiteral = call %LeftShiftLit.ref.loc56(%int_0.loc56, %.loc56_60.4) [template = ] +// CHECK:STDOUT: %.loc56_63.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc56 [template = ] +// CHECK:STDOUT: %.loc56_63.2: Core.IntLiteral = converted %int.left_shift.loc56, %.loc56_63.1 [template = ] +// CHECK:STDOUT: %negative_lit_zero: Core.IntLiteral = bind_name negative_lit_zero, %.loc56_63.2 +// CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- literal_negative.carbon +// CHECK:STDOUT: --- fail_literal_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] @@ -954,24 +2739,25 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_1000000000: Core.IntLiteral = int_value 1000000000 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] +// CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] // CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.7(%int_32) [template] -// CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.10) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .IntLiteral = %import_ref.1 // CHECK:STDOUT: .Int = %import_ref.2 -// CHECK:STDOUT: .Negate = %import_ref.6 -// CHECK:STDOUT: .ImplicitAs = %import_ref.44 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .Negate = %import_ref.230 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -983,6 +2769,7 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .LeftShift = %LeftShift.decl // CHECK:STDOUT: .bad = @__global_init.%bad +// CHECK:STDOUT: .bad_negative = @__global_init.%bad_negative // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { @@ -1015,149 +2802,223 @@ let bad_negative: i32 = LeftShift(-1, 4000_000_000); // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc10_26: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int_1.loc10_30: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %impl.elem0.loc10_29: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound: = bound_method %int_1.loc10_30, %impl.elem0.loc10_29 [template = constants.%Op.bound] -// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_1.loc10_30) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_29.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_29.2: Core.IntLiteral = converted %int.snegate, %.loc10_29.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift: init Core.IntLiteral = call %LeftShift.ref(%int_1.loc10_26, %.loc10_29.2) [template = ] -// CHECK:STDOUT: %impl.elem0.loc10_32: %Convert.type.2 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound: = bound_method %int.left_shift, %impl.elem0.loc10_32 [template = ] -// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = ] -// CHECK:STDOUT: %.loc10_31.1: Core.IntLiteral = value_of_initializer %int.left_shift [template = ] -// CHECK:STDOUT: %.loc10_31.2: Core.IntLiteral = converted %int.left_shift, %.loc10_31.1 [template = ] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%.loc10_31.2) [template = ] -// CHECK:STDOUT: %.loc10_32.1: %i32 = value_of_initializer %int.convert_checked [template = ] -// CHECK:STDOUT: %.loc10_32.2: %i32 = converted %int.left_shift, %.loc10_32.1 [template = ] -// CHECK:STDOUT: %bad: %i32 = bind_name bad, %.loc10_32.2 +// CHECK:STDOUT: %LeftShift.ref.loc10: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1000000000.loc10: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %int.left_shift.loc10: init Core.IntLiteral = call %LeftShift.ref.loc10(%int_1.loc10, %int_1000000000.loc10) [template = ] +// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int.left_shift.loc10, %impl.elem0.loc10 [template = ] +// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = ] +// CHECK:STDOUT: %.loc10_42.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc10 [template = ] +// CHECK:STDOUT: %.loc10_42.2: Core.IntLiteral = converted %int.left_shift.loc10, %.loc10_42.1 [template = ] +// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%.loc10_42.2) [template = ] +// CHECK:STDOUT: %.loc10_43.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = ] +// CHECK:STDOUT: %.loc10_43.2: %i32 = converted %int.left_shift.loc10, %.loc10_43.1 [template = ] +// CHECK:STDOUT: %bad: %i32 = bind_name bad, %.loc10_43.2 +// CHECK:STDOUT: %LeftShift.ref.loc16: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc16_35: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.loc16, %impl.elem0.loc16_35 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_1.loc16) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1000000000.loc16: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %.loc16_35.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] +// CHECK:STDOUT: %.loc16_35.2: Core.IntLiteral = converted %int.snegate, %.loc16_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.left_shift.loc16: init Core.IntLiteral = call %LeftShift.ref.loc16(%.loc16_35.2, %int_1000000000.loc16) [template = ] +// CHECK:STDOUT: %impl.elem0.loc16_53: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16: = bound_method %int.left_shift.loc16, %impl.elem0.loc16_53 [template = ] +// CHECK:STDOUT: %Convert.specific_fn.loc16: = specific_function %Convert.bound.loc16, @Convert.2(constants.%int_32) [template = ] +// CHECK:STDOUT: %.loc16_52.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc16 [template = ] +// CHECK:STDOUT: %.loc16_52.2: Core.IntLiteral = converted %int.left_shift.loc16, %.loc16_52.1 [template = ] +// CHECK:STDOUT: %int.convert_checked.loc16: init %i32 = call %Convert.specific_fn.loc16(%.loc16_52.2) [template = ] +// CHECK:STDOUT: %.loc16_53.1: %i32 = value_of_initializer %int.convert_checked.loc16 [template = ] +// CHECK:STDOUT: %.loc16_53.2: %i32 = converted %int.left_shift.loc16, %.loc16_53.1 [template = ] +// CHECK:STDOUT: %bad_negative: %i32 = bind_name bad_negative, %.loc16_53.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- literal_overflow.carbon +// CHECK:STDOUT: --- fail_comp_time_only_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] -// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] -// CHECK:STDOUT: %LeftShift.type.1: type = fn_type @LeftShift.1 [template] -// CHECK:STDOUT: %LeftShift: %LeftShift.type.1 = struct_value () [template] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_4000000000: Core.IntLiteral = int_value 4000000000 [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %LeftShiftByLit.type: type = fn_type @LeftShiftByLit [template] +// CHECK:STDOUT: %LeftShiftByLit: %LeftShiftByLit.type = struct_value () [template] +// CHECK:STDOUT: %LeftShiftOfLit.type: type = fn_type @LeftShiftOfLit [template] +// CHECK:STDOUT: %LeftShiftOfLit: %LeftShiftOfLit.type = struct_value () [template] +// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [template] +// CHECK:STDOUT: %int_34.1: Core.IntLiteral = int_value 34 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] -// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] -// CHECK:STDOUT: %Op.bound: = bound_method %int_1, %Op.2 [template] -// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_34.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_34.2: %i32 = int_value 34 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .IntLiteral = %import_ref.1 -// CHECK:STDOUT: .Int = %import_ref.2 +// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .IntLiteral = %import_ref.5 // CHECK:STDOUT: .ImplicitAs = %import_ref.6 -// CHECK:STDOUT: .Negate = %import_ref.230 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: %import_ref.5: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .LeftShift = %LeftShift.decl -// CHECK:STDOUT: .bad = @__global_init.%bad -// CHECK:STDOUT: .bad_negative = @__global_init.%bad_negative +// CHECK:STDOUT: .LeftShiftByLit = %LeftShiftByLit.decl +// CHECK:STDOUT: .LeftShiftOfLit = %LeftShiftOfLit.decl +// CHECK:STDOUT: .a_lit = %a_lit +// CHECK:STDOUT: .an_i32 = %an_i32 +// CHECK:STDOUT: .bad1 = @__global_init.%bad1 +// CHECK:STDOUT: .bad2 = @__global_init.%bad2 +// CHECK:STDOUT: .bad3 = @__global_init.%bad3 +// CHECK:STDOUT: .bad4 = @__global_init.%bad4 // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %LeftShift.decl: %LeftShift.type.1 = fn_decl @LeftShift.1 [template = constants.%LeftShift] { -// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a -// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %LeftShiftByLit.decl: %LeftShiftByLit.type = fn_decl @LeftShiftByLit [template = constants.%LeftShiftByLit] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b // CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc4_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_46.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_46.2: type = converted %int_literal.make_type, %.loc4_46.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32.loc4_52: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_52: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %LeftShiftOfLit.decl: %LeftShiftOfLit.type = fn_decl @LeftShiftOfLit [template = constants.%LeftShiftOfLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern // CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Core.ref.loc4_17: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_33: init type = call %IntLiteral.ref.loc4_21() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_33.1: type = value_of_initializer %int_literal.make_type.loc4_33 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_33.2: type = converted %int_literal.make_type.loc4_33, %.loc4_33.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %Core.ref.loc4_39: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_43: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_55: init type = call %IntLiteral.ref.loc4_43() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_55.1: type = value_of_initializer %int_literal.make_type.loc4_55 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_55.2: type = converted %int_literal.make_type.loc4_55, %.loc4_55.1 [template = Core.IntLiteral] -// CHECK:STDOUT: %Core.ref.loc4_61: = name_ref Core, imports.%Core [template = imports.%Core] -// CHECK:STDOUT: %IntLiteral.ref.loc4_65: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] -// CHECK:STDOUT: %int_literal.make_type.loc4_77: init type = call %IntLiteral.ref.loc4_65() [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_77.1: type = value_of_initializer %int_literal.make_type.loc4_77 [template = Core.IntLiteral] -// CHECK:STDOUT: %.loc4_77.2: type = converted %int_literal.make_type.loc4_77, %.loc4_77.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc5_22: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_26: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_38: init type = call %IntLiteral.ref.loc5_26() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_38.1: type = value_of_initializer %int_literal.make_type.loc5_38 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_38.2: type = converted %int_literal.make_type.loc5_38, %.loc5_38.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc5_52: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_56: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_68: init type = call %IntLiteral.ref.loc5_56() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_68.1: type = value_of_initializer %int_literal.make_type.loc5_68 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_68.2: type = converted %int_literal.make_type.loc5_68, %.loc5_68.1 [template = Core.IntLiteral] // CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 // CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param -// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 -// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc7: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc7: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc7: init type = call %IntLiteral.ref.loc7() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_28.1: type = value_of_initializer %int_literal.make_type.loc7 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_28.2: type = converted %int_literal.make_type.loc7, %.loc7_28.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a_lit.var: ref Core.IntLiteral = var a_lit +// CHECK:STDOUT: %a_lit: ref Core.IntLiteral = bind_name a_lit, %a_lit.var +// CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %an_i32.var: ref %i32 = var an_i32 +// CHECK:STDOUT: %an_i32: ref %i32 = bind_name an_i32, %an_i32.var +// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc28: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc28: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc28: init type = call %IntLiteral.ref.loc28() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc28_27.1: type = value_of_initializer %int_literal.make_type.loc28 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc28_27.2: type = converted %int_literal.make_type.loc28, %.loc28_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32.loc38: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc38: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc47: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc47: init type = call %IntLiteral.ref.loc47() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc47_27.1: type = value_of_initializer %int_literal.make_type.loc47 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc47_27.2: type = converted %int_literal.make_type.loc47, %.loc47_27.1 [template = Core.IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @LeftShift.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; +// CHECK:STDOUT: fn @LeftShiftByLit(%a.param_patt: %i32, %b.param_patt: Core.IntLiteral) -> %i32 = "int.left_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LeftShiftOfLit(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> Core.IntLiteral = "int.left_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref.loc10: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %int_4000000000.loc10: Core.IntLiteral = int_value 4000000000 [template = constants.%int_4000000000] -// CHECK:STDOUT: %int.left_shift.loc10: init Core.IntLiteral = call %LeftShift.ref.loc10(%int_1.loc10, %int_4000000000.loc10) [template = ] -// CHECK:STDOUT: %impl.elem0.loc10: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10: = bound_method %int.left_shift.loc10, %impl.elem0.loc10 [template = ] -// CHECK:STDOUT: %Convert.specific_fn.loc10: = specific_function %Convert.bound.loc10, @Convert.2(constants.%int_32) [template = ] -// CHECK:STDOUT: %.loc10_41.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc10 [template = ] -// CHECK:STDOUT: %.loc10_41.2: Core.IntLiteral = converted %int.left_shift.loc10, %.loc10_41.1 [template = ] -// CHECK:STDOUT: %int.convert_checked.loc10: init %i32 = call %Convert.specific_fn.loc10(%.loc10_41.2) [template = ] -// CHECK:STDOUT: %.loc10_42.1: %i32 = value_of_initializer %int.convert_checked.loc10 [template = ] -// CHECK:STDOUT: %.loc10_42.2: %i32 = converted %int.left_shift.loc10, %.loc10_42.1 [template = ] -// CHECK:STDOUT: %bad: %i32 = bind_name bad, %.loc10_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc15: %LeftShift.type.1 = name_ref LeftShift, file.%LeftShift.decl [template = constants.%LeftShift] -// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1] -// CHECK:STDOUT: %impl.elem0.loc15_35: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] -// CHECK:STDOUT: %Op.bound: = bound_method %int_1.loc15, %impl.elem0.loc15_35 [template = constants.%Op.bound] -// CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %Op.bound(%int_1.loc15) [template = constants.%int_-1] -// CHECK:STDOUT: %int_4000000000.loc15: Core.IntLiteral = int_value 4000000000 [template = constants.%int_4000000000] -// CHECK:STDOUT: %.loc15_35.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc15_35.2: Core.IntLiteral = converted %int.snegate, %.loc15_35.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.left_shift.loc15: init Core.IntLiteral = call %LeftShift.ref.loc15(%.loc15_35.2, %int_4000000000.loc15) [template = ] -// CHECK:STDOUT: %impl.elem0.loc15_52: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15: = bound_method %int.left_shift.loc15, %impl.elem0.loc15_52 [template = ] -// CHECK:STDOUT: %Convert.specific_fn.loc15: = specific_function %Convert.bound.loc15, @Convert.2(constants.%int_32) [template = ] -// CHECK:STDOUT: %.loc15_51.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc15 [template = ] -// CHECK:STDOUT: %.loc15_51.2: Core.IntLiteral = converted %int.left_shift.loc15, %.loc15_51.1 [template = ] -// CHECK:STDOUT: %int.convert_checked.loc15: init %i32 = call %Convert.specific_fn.loc15(%.loc15_51.2) [template = ] -// CHECK:STDOUT: %.loc15_52.1: %i32 = value_of_initializer %int.convert_checked.loc15 [template = ] -// CHECK:STDOUT: %.loc15_52.2: %i32 = converted %int.left_shift.loc15, %.loc15_52.1 [template = ] -// CHECK:STDOUT: %bad_negative: %i32 = bind_name bad_negative, %.loc15_52.2 +// CHECK:STDOUT: %int_12.loc7: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: assign file.%a_lit.var, %int_12.loc7 +// CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [template = constants.%int_34.1] +// CHECK:STDOUT: %impl.elem0: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound: = bound_method %int_34, %impl.elem0 [template = constants.%Convert.bound] +// CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_34) [template = constants.%int_34.2] +// CHECK:STDOUT: %.loc8: init %i32 = converted %int_34, %int.convert_checked [template = constants.%int_34.2] +// CHECK:STDOUT: assign file.%an_i32.var, %.loc8 +// CHECK:STDOUT: %LeftShiftByLit.ref.loc18: %LeftShiftByLit.type = name_ref LeftShiftByLit, file.%LeftShiftByLit.decl [template = constants.%LeftShiftByLit] +// CHECK:STDOUT: %an_i32.ref.loc18: ref %i32 = name_ref an_i32, file.%an_i32 +// CHECK:STDOUT: %a_lit.ref.loc18: ref Core.IntLiteral = name_ref a_lit, file.%a_lit +// CHECK:STDOUT: %.loc18_32: %i32 = bind_value %an_i32.ref.loc18 +// CHECK:STDOUT: %.loc18_40: Core.IntLiteral = bind_value %a_lit.ref.loc18 +// CHECK:STDOUT: %int.left_shift.loc18: init %i32 = call %LeftShiftByLit.ref.loc18(%.loc18_32, %.loc18_40) +// CHECK:STDOUT: %.loc18_46.1: %i32 = value_of_initializer %int.left_shift.loc18 +// CHECK:STDOUT: %.loc18_46.2: %i32 = converted %int.left_shift.loc18, %.loc18_46.1 +// CHECK:STDOUT: %bad1: %i32 = bind_name bad1, %.loc18_46.2 +// CHECK:STDOUT: %LeftShiftOfLit.ref.loc28: %LeftShiftOfLit.type = name_ref LeftShiftOfLit, file.%LeftShiftOfLit.decl [template = constants.%LeftShiftOfLit] +// CHECK:STDOUT: %a_lit.ref.loc28: ref Core.IntLiteral = name_ref a_lit, file.%a_lit +// CHECK:STDOUT: %an_i32.ref.loc28: ref %i32 = name_ref an_i32, file.%an_i32 +// CHECK:STDOUT: %.loc28_46: Core.IntLiteral = bind_value %a_lit.ref.loc28 +// CHECK:STDOUT: %.loc28_53: %i32 = bind_value %an_i32.ref.loc28 +// CHECK:STDOUT: %int.left_shift.loc28: init Core.IntLiteral = call %LeftShiftOfLit.ref.loc28(%.loc28_46, %.loc28_53) +// CHECK:STDOUT: %.loc28_60.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc28 +// CHECK:STDOUT: %.loc28_60.2: Core.IntLiteral = converted %int.left_shift.loc28, %.loc28_60.1 +// CHECK:STDOUT: %bad2: Core.IntLiteral = bind_name bad2, %.loc28_60.2 +// CHECK:STDOUT: %LeftShiftByLit.ref.loc38: %LeftShiftByLit.type = name_ref LeftShiftByLit, file.%LeftShiftByLit.decl [template = constants.%LeftShiftByLit] +// CHECK:STDOUT: %an_i32.ref.loc38: ref %i32 = name_ref an_i32, file.%an_i32 +// CHECK:STDOUT: %int_12.loc38: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %.loc38_32: %i32 = bind_value %an_i32.ref.loc38 +// CHECK:STDOUT: %int.left_shift.loc38: init %i32 = call %LeftShiftByLit.ref.loc38(%.loc38_32, %int_12.loc38) +// CHECK:STDOUT: %.loc38_43.1: %i32 = value_of_initializer %int.left_shift.loc38 +// CHECK:STDOUT: %.loc38_43.2: %i32 = converted %int.left_shift.loc38, %.loc38_43.1 +// CHECK:STDOUT: %bad3: %i32 = bind_name bad3, %.loc38_43.2 +// CHECK:STDOUT: %LeftShiftOfLit.ref.loc47: %LeftShiftOfLit.type = name_ref LeftShiftOfLit, file.%LeftShiftOfLit.decl [template = constants.%LeftShiftOfLit] +// CHECK:STDOUT: %int_12.loc47: Core.IntLiteral = int_value 12 [template = constants.%int_12] +// CHECK:STDOUT: %an_i32.ref.loc47: ref %i32 = name_ref an_i32, file.%an_i32 +// CHECK:STDOUT: %.loc47_50: %i32 = bind_value %an_i32.ref.loc47 +// CHECK:STDOUT: %int.left_shift.loc47: init Core.IntLiteral = call %LeftShiftOfLit.ref.loc47(%int_12.loc47, %.loc47_50) +// CHECK:STDOUT: %.loc47_57.1: Core.IntLiteral = value_of_initializer %int.left_shift.loc47 +// CHECK:STDOUT: %.loc47_57.2: Core.IntLiteral = converted %int.left_shift.loc47, %.loc47_57.1 +// CHECK:STDOUT: %bad4: Core.IntLiteral = bind_name bad4, %.loc47_57.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index b3bf8cd10611f..3fbc1c328b1e3 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -8,44 +8,90 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/right_shift.carbon -// --- int_right_shift.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; + +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -var arr: [i32; RightShift(22, 2)]; -let arr_p: [i32; 5]* = &arr; +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(-1, 1)) as Expect(-1); + Test(RightShift(-2, 1)) as Expect(-1); + Test(RightShift(-10, 2)) as Expect(-3); +} fn RuntimeCall(a: i32, b: i32) -> i32 { return RightShift(a, b); } -// TODO: Test mixed types for LHS and RHS. +// --- u32.carbon -// --- arith_shift.carbon +library "[[@TEST_NAME]]"; -// TODO: Also test unsigned / logical right shift. +class Expect(N:! u32) {} +fn Test(N:! u32) -> Expect(N) { return {}; } -package ArithShift; +fn RightShift(a: u32, b: i32) -> u32 = "int.right_shift"; -fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(0xFFFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(RightShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF); +} + +fn RuntimeCall(a: u32, b: i32) -> u32 { + return RightShift(a, b); +} + +// --- literal.carbon + +library "[[@TEST_NAME]]"; -// -1 >> 1 is -1. -var arr1: [i32; Negate(RightShift(Negate(1), 1))]; -let arr1_p: [i32; 1]* = &arr1; +fn RightShift(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.right_shift"; -// -10 >> 2 is -3. -var arr2: [i32; Negate(RightShift(Negate(10), 2))]; -let arr2_p: [i32; 3]* = &arr2; +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(RightShift(0, 31)) as Expect(0); + Test(RightShift(1, 31)) as Expect(0); + Test(RightShift(1, 0)) as Expect(1); + Test(RightShift(1, 2)) as Expect(0); + Test(RightShift(22, 2)) as Expect(5); + Test(RightShift(-1, 1)) as Expect(-1); + Test(RightShift(-2, 1)) as Expect(-1); + Test(RightShift(-10, 2)) as Expect(-3); + Test(RightShift(0xFFFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(RightShift(0xABCD_EF01, 8)) as Expect(0xAB_CDEF); + + Test(RightShift(0x1234_5678, 1_000_000_000)) as Expect(0); + Test(RightShift(-0x1234_5678, 1_000_000_000)) as Expect(-1); + Test(RightShift(0xFFFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(0); + Test(RightShift(0x7FFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(0); + Test(RightShift(-0x7FFF_FFFF_FFFF_FFFF, 1_000_000_000)) as Expect(-1); + Test(RightShift(-0x8000_0000_0000_0000, 1_000_000_000)) as Expect(-1); +} // --- fail_bad_shift.carbon -package BadShift; +library "[[@TEST_NAME]]"; fn RightShift(a: i32, b: i32) -> i32 = "int.right_shift"; -fn Negate(a: i32) -> i32 = "int.snegate"; +fn RightShiftLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.right_shift"; -// Shift greater than size is disallowed. +// Shift greater than size is disallowed for sized types. let size_1: i32 = RightShift(1, 31); // CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); @@ -58,49 +104,125 @@ let size_2: i32 = RightShift(1, 32); // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); -// Negative shifts aren't allowed either. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] -// CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ -let negative: i32 = RightShift(1, Negate(1)); +// Negative shifts aren't allowed either, even for literals, even if the lhs is zero. +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:21: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative: i32 = RightShift(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative: i32 = RightShift(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: let negative_zero: i32 = RightShift(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_zero: i32 = RightShift(0, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:39: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit: Core.IntLiteral() = RightShiftLit(1, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +let negative_lit: Core.IntLiteral() = RightShiftLit(1, -1); +// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:44: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: let negative_lit_zero: Core.IntLiteral() = RightShiftLit(0, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +let negative_lit_zero: Core.IntLiteral() = RightShiftLit(0, -1); -// CHECK:STDOUT: --- int_right_shift.carbon +// CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %N.2: %i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.2: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] // CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] // CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_22.1: Core.IntLiteral = int_value 22 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_22.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_22.2: %i32 = int_value 22 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1.2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1.2) [template] +// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] +// CHECK:STDOUT: %int_22.1: Core.IntLiteral = int_value 22 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_22.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_22.2: %i32 = int_value 22 [template] // CHECK:STDOUT: %int_5.1: %i32 = int_value 5 [template] -// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.3, @impl.2(%int_32) [template] -// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.11) [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_5.1, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.3(%int_32) [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_5.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_5.1) [template] // CHECK:STDOUT: %int_5.2: Core.IntLiteral = int_value 5 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_5.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_5.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_-1.2) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_-1.2) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2.1, %Op.2 [template] +// CHECK:STDOUT: %int_-2.1: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %Convert.bound.8: = bound_method %int_-2.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.8: = specific_function %Convert.bound.8, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-2.2: %i32 = int_value -2 [template] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_10, %Op.2 [template] +// CHECK:STDOUT: %int_-10.1: Core.IntLiteral = int_value -10 [template] +// CHECK:STDOUT: %Convert.bound.9: = bound_method %int_-10.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.9: = specific_function %Convert.bound.9, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-10.2: %i32 = int_value -10 [template] +// CHECK:STDOUT: %int_-3.1: %i32 = int_value -3 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_-3.1) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_-3.1) [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_3, %Op.2 [template] +// CHECK:STDOUT: %int_-3.2: Core.IntLiteral = int_value -3 [template] +// CHECK:STDOUT: %Convert.bound.10: = bound_method %int_-3.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.10: = specific_function %Convert.bound.10, @Convert.2(%int_32) [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -109,12 +231,38 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc4_14.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc4_14.1, runtime_param [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc4_14.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc5_9.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc5_9.1, runtime_param [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc5_9.1 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc5_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc5_9.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc5_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -123,12 +271,12 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc7_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -136,40 +284,7 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %RightShift.ref: %RightShift.type.1 = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [template = constants.%int_22.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc4_27: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_27: = bound_method %int_22, %impl.elem0.loc4_27 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc4_27: = specific_function %Convert.bound.loc4_27, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc4_27: init %i32 = call %Convert.specific_fn.loc4_27(%int_22) [template = constants.%int_22.2] -// CHECK:STDOUT: %.loc4_27.1: %i32 = value_of_initializer %int.convert_checked.loc4_27 [template = constants.%int_22.2] -// CHECK:STDOUT: %.loc4_27.2: %i32 = converted %int_22, %.loc4_27.1 [template = constants.%int_22.2] -// CHECK:STDOUT: %impl.elem0.loc4_31: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_31: = bound_method %int_2, %impl.elem0.loc4_31 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc4_31: = specific_function %Convert.bound.loc4_31, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc4_31: init %i32 = call %Convert.specific_fn.loc4_31(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_31.1: %i32 = value_of_initializer %int.convert_checked.loc4_31 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_31.2: %i32 = converted %int_2, %.loc4_31.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.right_shift: init %i32 = call %RightShift.ref(%.loc4_27.2, %.loc4_31.2) [template = constants.%int_5.1] -// CHECK:STDOUT: %impl.elem0.loc4_32: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc4_32: = bound_method %int.right_shift, %impl.elem0.loc4_32 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc4_32: = specific_function %Convert.bound.loc4_32, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc4_32.1: %i32 = value_of_initializer %int.right_shift [template = constants.%int_5.1] -// CHECK:STDOUT: %.loc4_32.2: %i32 = converted %int.right_shift, %.loc4_32.1 [template = constants.%int_5.1] -// CHECK:STDOUT: %int.convert_checked.loc4_32: init Core.IntLiteral = call %Convert.specific_fn.loc4_32(%.loc4_32.2) [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc4_32.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_32 [template = constants.%int_5.2] -// CHECK:STDOUT: %.loc4_32.4: Core.IntLiteral = converted %int.right_shift, %.loc4_32.3 [template = constants.%int_5.2] -// CHECK:STDOUT: %array_type.loc4: type = array_type %.loc4_32.4, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %int_5, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -178,12 +293,12 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc20_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc20_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -193,75 +308,546 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc4_14.1: %i32) { +// CHECK:STDOUT: %N.loc4_14.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc4_14.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.2] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc5_9.1: %i32) { +// CHECK:STDOUT: %N.loc5_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc5_9.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc5_29.2: type = class_type @Expect, @Expect(%N.loc5_9.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc5_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc5_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %i32) -> %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc5_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc5_41.2: init @Test.%Expect.loc5_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc5_42: init @Test.%Expect.loc5_29.2 (%Expect.1) = converted %.loc5_41.1, %.loc5_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc5_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc10: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_0.loc10_19: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_31.loc10: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc10_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_19: = bound_method %int_0.loc10_19, %impl.elem0.loc10_19 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_19: = specific_function %Convert.bound.loc10_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_19: init %i32 = call %Convert.specific_fn.loc10_19(%int_0.loc10_19) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_19.1: %i32 = value_of_initializer %int.convert_checked.loc10_19 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_19.2: %i32 = converted %int_0.loc10_19, %.loc10_19.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_22: = bound_method %int_31.loc10, %impl.elem0.loc10_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc10_22: = specific_function %Convert.bound.loc10_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc10_22: init %i32 = call %Convert.specific_fn.loc10_22(%int_31.loc10) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc10_22.1: %i32 = value_of_initializer %int.convert_checked.loc10_22 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc10_22.2: %i32 = converted %int_31.loc10, %.loc10_22.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.right_shift.loc10: init %i32 = call %RightShift.ref.loc10(%.loc10_19.2, %.loc10_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_25.1: %i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_25.2: %i32 = converted %int.right_shift.loc10, %.loc10_25.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_25.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_37: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_38: = bound_method %int_0.loc10_37, %impl.elem0.loc10_38 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_38: = specific_function %Convert.bound.loc10_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_38: init %i32 = call %Convert.specific_fn.loc10_38(%int_0.loc10_37) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_38.1: %i32 = value_of_initializer %int.convert_checked.loc10_38 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_38.2: %i32 = converted %int_0.loc10_37, %.loc10_38.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_25.4: ref %Expect.2 = temporary %.loc10_25.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc11: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_31.loc11: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc11_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_19: = bound_method %int_1.loc11, %impl.elem0.loc11_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc11_19: = specific_function %Convert.bound.loc11_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc11_19: init %i32 = call %Convert.specific_fn.loc11_19(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_19.1: %i32 = value_of_initializer %int.convert_checked.loc11_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_19.2: %i32 = converted %int_1.loc11, %.loc11_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_31.loc11, %impl.elem0.loc11_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_22: init %i32 = call %Convert.specific_fn.loc11_22(%int_31.loc11) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc11_22.1: %i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc11_22.2: %i32 = converted %int_31.loc11, %.loc11_22.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.right_shift.loc11: init %i32 = call %RightShift.ref.loc11(%.loc11_19.2, %.loc11_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_25.1: %i32 = value_of_initializer %int.right_shift.loc11 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_25.2: %i32 = converted %int.right_shift.loc11, %.loc11_25.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_25.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_38: = bound_method %int_0.loc11, %impl.elem0.loc11_38 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_38: = specific_function %Convert.bound.loc11_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_38: init %i32 = call %Convert.specific_fn.loc11_38(%int_0.loc11) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_38.1: %i32 = value_of_initializer %int.convert_checked.loc11_38 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_38.2: %i32 = converted %int_0.loc11, %.loc11_38.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_25.4: ref %Expect.2 = temporary %.loc11_25.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc12: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc12_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc12_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_19: = bound_method %int_1.loc12_19, %impl.elem0.loc12_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_19: = specific_function %Convert.bound.loc12_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_19: init %i32 = call %Convert.specific_fn.loc12_19(%int_1.loc12_19) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_19.1: %i32 = value_of_initializer %int.convert_checked.loc12_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_19.2: %i32 = converted %int_1.loc12_19, %.loc12_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc12_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_22: = bound_method %int_0.loc12, %impl.elem0.loc12_22 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc12_22: = specific_function %Convert.bound.loc12_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc12_22: init %i32 = call %Convert.specific_fn.loc12_22(%int_0.loc12) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_22.1: %i32 = value_of_initializer %int.convert_checked.loc12_22 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc12_22.2: %i32 = converted %int_0.loc12, %.loc12_22.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.right_shift.loc12: init %i32 = call %RightShift.ref.loc12(%.loc12_19.2, %.loc12_22.2) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_24.1: %i32 = value_of_initializer %int.right_shift.loc12 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_24.2: %i32 = converted %int.right_shift.loc12, %.loc12_24.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_1.2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_24.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc12_36: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_37: = bound_method %int_1.loc12_36, %impl.elem0.loc12_37 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_37: = specific_function %Convert.bound.loc12_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_37: init %i32 = call %Convert.specific_fn.loc12_37(%int_1.loc12_36) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_37.1: %i32 = value_of_initializer %int.convert_checked.loc12_37 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_37.2: %i32 = converted %int_1.loc12_36, %.loc12_37.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_1.2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_24.4: ref %Expect.3 = temporary %.loc12_24.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_2.loc13: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc13_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_19: = bound_method %int_1.loc13, %impl.elem0.loc13_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_19: = specific_function %Convert.bound.loc13_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_19: init %i32 = call %Convert.specific_fn.loc13_19(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_19.1: %i32 = value_of_initializer %int.convert_checked.loc13_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_19.2: %i32 = converted %int_1.loc13, %.loc13_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_22: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_22: = bound_method %int_2.loc13, %impl.elem0.loc13_22 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc13_22: = specific_function %Convert.bound.loc13_22, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc13_22: init %i32 = call %Convert.specific_fn.loc13_22(%int_2.loc13) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_22.1: %i32 = value_of_initializer %int.convert_checked.loc13_22 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_22.2: %i32 = converted %int_2.loc13, %.loc13_22.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.right_shift.loc13: init %i32 = call %RightShift.ref.loc13(%.loc13_19.2, %.loc13_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_24.1: %i32 = value_of_initializer %int.right_shift.loc13 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_24.2: %i32 = converted %int.right_shift.loc13, %.loc13_24.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_24.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc13_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_37: = bound_method %int_0.loc13, %impl.elem0.loc13_37 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc13_37: = specific_function %Convert.bound.loc13_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc13_37: init %i32 = call %Convert.specific_fn.loc13_37(%int_0.loc13) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_37.1: %i32 = value_of_initializer %int.convert_checked.loc13_37 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_37.2: %i32 = converted %int_0.loc13, %.loc13_37.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_24.4: ref %Expect.2 = temporary %.loc13_24.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc14: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [template = constants.%int_22.1] +// CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc14_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_19: = bound_method %int_22, %impl.elem0.loc14_19 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc14_19: = specific_function %Convert.bound.loc14_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc14_19: init %i32 = call %Convert.specific_fn.loc14_19(%int_22) [template = constants.%int_22.2] +// CHECK:STDOUT: %.loc14_19.1: %i32 = value_of_initializer %int.convert_checked.loc14_19 [template = constants.%int_22.2] +// CHECK:STDOUT: %.loc14_19.2: %i32 = converted %int_22, %.loc14_19.1 [template = constants.%int_22.2] +// CHECK:STDOUT: %impl.elem0.loc14_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_23: = bound_method %int_2.loc14, %impl.elem0.loc14_23 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc14_23: = specific_function %Convert.bound.loc14_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc14_23: init %i32 = call %Convert.specific_fn.loc14_23(%int_2.loc14) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_23.1: %i32 = value_of_initializer %int.convert_checked.loc14_23 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_23.2: %i32 = converted %int_2.loc14, %.loc14_23.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.right_shift.loc14: init %i32 = call %RightShift.ref.loc14(%.loc14_19.2, %.loc14_23.2) [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_25.1: %i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_25.2: %i32 = converted %int.right_shift.loc14, %.loc14_25.1 [template = constants.%int_5.1] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_5.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_25.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_25.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.2] +// CHECK:STDOUT: %impl.elem0.loc14_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_38: = bound_method %int_5, %impl.elem0.loc14_38 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc14_38: = specific_function %Convert.bound.loc14_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc14_38: init %i32 = call %Convert.specific_fn.loc14_38(%int_5) [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_38.1: %i32 = value_of_initializer %int.convert_checked.loc14_38 [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_38.2: %i32 = converted %int_5, %.loc14_38.1 [template = constants.%int_5.1] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_5.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_25.4: ref %Expect.4 = temporary %.loc14_25.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc15: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc15_20: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_19.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_19: = bound_method %int_1.loc15_20, %impl.elem0.loc15_19.1 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_19: init Core.IntLiteral = call %Op.bound.loc15_19(%int_1.loc15_20) [template = constants.%int_-1.1] +// CHECK:STDOUT: %int_1.loc15_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_19.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_19: = bound_method %int.snegate.loc15_19, %impl.elem0.loc15_19.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc15_19: = specific_function %Convert.bound.loc15_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc15_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_19 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_19.2: Core.IntLiteral = converted %int.snegate.loc15_19, %.loc15_19.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15_19: init %i32 = call %Convert.specific_fn.loc15_19(%.loc15_19.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_19.3: %i32 = value_of_initializer %int.convert_checked.loc15_19 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_19.4: %i32 = converted %int.snegate.loc15_19, %.loc15_19.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %impl.elem0.loc15_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_23: = bound_method %int_1.loc15_23, %impl.elem0.loc15_23 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc15_23: = specific_function %Convert.bound.loc15_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc15_23: init %i32 = call %Convert.specific_fn.loc15_23(%int_1.loc15_23) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_23.1: %i32 = value_of_initializer %int.convert_checked.loc15_23 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc15_23.2: %i32 = converted %int_1.loc15_23, %.loc15_23.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.right_shift.loc15: init %i32 = call %RightShift.ref.loc15(%.loc15_19.4, %.loc15_23.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_25.1: %i32 = value_of_initializer %int.right_shift.loc15 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_25.2: %i32 = converted %int.right_shift.loc15, %.loc15_25.1 [template = constants.%int_-1.2] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-1.2) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_25.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_25.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc15_38: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_37: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_37: = bound_method %int_1.loc15_38, %impl.elem0.loc15_37 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_37: init Core.IntLiteral = call %Op.bound.loc15_37(%int_1.loc15_38) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc15_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_39: = bound_method %int.snegate.loc15_37, %impl.elem0.loc15_39 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc15_39: = specific_function %Convert.bound.loc15_39, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc15_37.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_37 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_37.2: Core.IntLiteral = converted %int.snegate.loc15_37, %.loc15_37.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15_39: init %i32 = call %Convert.specific_fn.loc15_39(%.loc15_37.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_39.1: %i32 = value_of_initializer %int.convert_checked.loc15_39 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_39.2: %i32 = converted %int.snegate.loc15_37, %.loc15_39.1 [template = constants.%int_-1.2] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-1.2) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_25.4: ref %Expect.5 = temporary %.loc15_25.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc16: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_2.loc16: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc16_19.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_19: = bound_method %int_2.loc16, %impl.elem0.loc16_19.1 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc16_19: init Core.IntLiteral = call %Op.bound.loc16_19(%int_2.loc16) [template = constants.%int_-2.1] +// CHECK:STDOUT: %int_1.loc16_23: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc16_19.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_19: = bound_method %int.snegate.loc16_19, %impl.elem0.loc16_19.2 [template = constants.%Convert.bound.8] +// CHECK:STDOUT: %Convert.specific_fn.loc16_19: = specific_function %Convert.bound.loc16_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.8] +// CHECK:STDOUT: %.loc16_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_19 [template = constants.%int_-2.1] +// CHECK:STDOUT: %.loc16_19.2: Core.IntLiteral = converted %int.snegate.loc16_19, %.loc16_19.1 [template = constants.%int_-2.1] +// CHECK:STDOUT: %int.convert_checked.loc16_19: init %i32 = call %Convert.specific_fn.loc16_19(%.loc16_19.2) [template = constants.%int_-2.2] +// CHECK:STDOUT: %.loc16_19.3: %i32 = value_of_initializer %int.convert_checked.loc16_19 [template = constants.%int_-2.2] +// CHECK:STDOUT: %.loc16_19.4: %i32 = converted %int.snegate.loc16_19, %.loc16_19.3 [template = constants.%int_-2.2] +// CHECK:STDOUT: %impl.elem0.loc16_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_23: = bound_method %int_1.loc16_23, %impl.elem0.loc16_23 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc16_23: = specific_function %Convert.bound.loc16_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc16_23: init %i32 = call %Convert.specific_fn.loc16_23(%int_1.loc16_23) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_23.1: %i32 = value_of_initializer %int.convert_checked.loc16_23 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc16_23.2: %i32 = converted %int_1.loc16_23, %.loc16_23.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.right_shift.loc16: init %i32 = call %RightShift.ref.loc16(%.loc16_19.4, %.loc16_23.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc16_25.1: %i32 = value_of_initializer %int.right_shift.loc16 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc16_25.2: %i32 = converted %int.right_shift.loc16, %.loc16_25.1 [template = constants.%int_-1.2] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_-1.2) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc16_25.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.5 = call %Test.specific_fn.loc16() to %.loc16_25.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc16_38: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc16_37: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_37: = bound_method %int_1.loc16_38, %impl.elem0.loc16_37 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc16_37: init Core.IntLiteral = call %Op.bound.loc16_37(%int_1.loc16_38) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc16_39: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_39: = bound_method %int.snegate.loc16_37, %impl.elem0.loc16_39 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc16_39: = specific_function %Convert.bound.loc16_39, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc16_37.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_37 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc16_37.2: Core.IntLiteral = converted %int.snegate.loc16_37, %.loc16_37.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc16_39: init %i32 = call %Convert.specific_fn.loc16_39(%.loc16_37.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc16_39.1: %i32 = value_of_initializer %int.convert_checked.loc16_39 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc16_39.2: %i32 = converted %int.snegate.loc16_37, %.loc16_39.1 [template = constants.%int_-1.2] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_-1.2) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc16_25.4: ref %Expect.5 = temporary %.loc16_25.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc17: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc17_19.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_19: = bound_method %int_10, %impl.elem0.loc17_19.1 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc17_19: init Core.IntLiteral = call %Op.bound.loc17_19(%int_10) [template = constants.%int_-10.1] +// CHECK:STDOUT: %int_2.loc17: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc17_19.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_19: = bound_method %int.snegate.loc17_19, %impl.elem0.loc17_19.2 [template = constants.%Convert.bound.9] +// CHECK:STDOUT: %Convert.specific_fn.loc17_19: = specific_function %Convert.bound.loc17_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.9] +// CHECK:STDOUT: %.loc17_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_19 [template = constants.%int_-10.1] +// CHECK:STDOUT: %.loc17_19.2: Core.IntLiteral = converted %int.snegate.loc17_19, %.loc17_19.1 [template = constants.%int_-10.1] +// CHECK:STDOUT: %int.convert_checked.loc17_19: init %i32 = call %Convert.specific_fn.loc17_19(%.loc17_19.2) [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc17_19.3: %i32 = value_of_initializer %int.convert_checked.loc17_19 [template = constants.%int_-10.2] +// CHECK:STDOUT: %.loc17_19.4: %i32 = converted %int.snegate.loc17_19, %.loc17_19.3 [template = constants.%int_-10.2] +// CHECK:STDOUT: %impl.elem0.loc17_24: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_24: = bound_method %int_2.loc17, %impl.elem0.loc17_24 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc17_24: = specific_function %Convert.bound.loc17_24, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc17_24: init %i32 = call %Convert.specific_fn.loc17_24(%int_2.loc17) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc17_24.1: %i32 = value_of_initializer %int.convert_checked.loc17_24 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc17_24.2: %i32 = converted %int_2.loc17, %.loc17_24.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.right_shift.loc17: init %i32 = call %RightShift.ref.loc17(%.loc17_19.4, %.loc17_24.2) [template = constants.%int_-3.1] +// CHECK:STDOUT: %.loc17_26.1: %i32 = value_of_initializer %int.right_shift.loc17 [template = constants.%int_-3.1] +// CHECK:STDOUT: %.loc17_26.2: %i32 = converted %int.right_shift.loc17, %.loc17_26.1 [template = constants.%int_-3.1] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_-3.1) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc17_26.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.6 = call %Test.specific_fn.loc17() to %.loc17_26.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc17_38: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_38: = bound_method %int_3, %impl.elem0.loc17_38 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc17_38: init Core.IntLiteral = call %Op.bound.loc17_38(%int_3) [template = constants.%int_-3.2] +// CHECK:STDOUT: %impl.elem0.loc17_40: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_40: = bound_method %int.snegate.loc17_38, %impl.elem0.loc17_40 [template = constants.%Convert.bound.10] +// CHECK:STDOUT: %Convert.specific_fn.loc17_40: = specific_function %Convert.bound.loc17_40, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.10] +// CHECK:STDOUT: %.loc17_38.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_38 [template = constants.%int_-3.2] +// CHECK:STDOUT: %.loc17_38.2: Core.IntLiteral = converted %int.snegate.loc17_38, %.loc17_38.1 [template = constants.%int_-3.2] +// CHECK:STDOUT: %int.convert_checked.loc17_40: init %i32 = call %Convert.specific_fn.loc17_40(%.loc17_38.2) [template = constants.%int_-3.1] +// CHECK:STDOUT: %.loc17_40.1: %i32 = value_of_initializer %int.convert_checked.loc17_40 [template = constants.%int_-3.1] +// CHECK:STDOUT: %.loc17_40.2: %i32 = converted %int.snegate.loc17_38, %.loc17_40.1 [template = constants.%int_-3.1] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_-3.1) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc17_26.4: ref %Expect.6 = temporary %.loc17_26.3, %Test.call.loc17 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %RightShift.ref: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.right_shift: init %i32 = call %RightShift.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_26.1: %i32 = value_of_initializer %int.right_shift -// CHECK:STDOUT: %.loc8_26.2: %i32 = converted %int.right_shift, %.loc8_26.1 -// CHECK:STDOUT: return %.loc8_26.2 +// CHECK:STDOUT: %.loc21_26.1: %i32 = value_of_initializer %int.right_shift +// CHECK:STDOUT: %.loc21_26.2: %i32 = converted %int.right_shift, %.loc21_26.1 +// CHECK:STDOUT: return %.loc21_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr -// CHECK:STDOUT: return +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc5_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- arith_shift.carbon +// CHECK:STDOUT: specific @Test(constants.%int_1.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_1.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_1.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_1.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_1.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_5.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_5.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_5.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_5.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_5.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_5.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-1.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_-1.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_-1.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-1.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_-1.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_-1.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-3.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_-3.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_-3.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-3.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_-3.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_-3.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- u32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [template] +// CHECK:STDOUT: %N.2: %u32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %u32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.2: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] // CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%u32) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.3, @impl.2(%int_32) [template] -// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.11) [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.2, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.3(%int_32) [template] -// CHECK:STDOUT: %array_type.1: type = array_type %int_1.1, %i32 [template] -// CHECK:STDOUT: %ptr.1: type = ptr_type %array_type.1 [template] -// CHECK:STDOUT: %int_10.1: Core.IntLiteral = int_value 10 [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_10.1, %Convert.10 [template] +// CHECK:STDOUT: %int_0.2: %u32 = int_value 0 [template] +// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.16: type = fn_type @Convert.7, @impl.5(%int_32) [template] +// CHECK:STDOUT: %Convert.16: %Convert.type.16 = struct_value () [template] +// CHECK:STDOUT: %interface.10: = interface_witness (%Convert.16) [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_10.2: %i32 = int_value 10 [template] -// CHECK:STDOUT: %int_-10: %i32 = int_value -10 [template] +// CHECK:STDOUT: %int_1.2: %u32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_0.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_0.3: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1.2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1.2) [template] // CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] -// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_2.1, %Convert.10 [template] -// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_2.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.7(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] -// CHECK:STDOUT: %int_-3: %i32 = int_value -3 [template] -// CHECK:STDOUT: %int_3.1: %i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_3.1, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.3(%int_32) [template] -// CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %array_type.2: type = array_type %int_3.2, %i32 [template] -// CHECK:STDOUT: %ptr.2: type = ptr_type %array_type.2 [template] +// CHECK:STDOUT: %int_22.1: Core.IntLiteral = int_value 22 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_22.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_22.2: %u32 = int_value 22 [template] +// CHECK:STDOUT: %int_5.1: %u32 = int_value 5 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_5.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_5.1) [template] +// CHECK:STDOUT: %int_5.2: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_5.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_4294967295.1: Core.IntLiteral = int_value 4294967295 [template] +// CHECK:STDOUT: %Convert.bound.8: = bound_method %int_4294967295.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.8: = specific_function %Convert.bound.8, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_4294967295.2: %u32 = int_value 4294967295 [template] +// CHECK:STDOUT: %Convert.bound.9: = bound_method %int_1.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.9: = specific_function %Convert.bound.9, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_1.3: %i32 = int_value 1 [template] +// CHECK:STDOUT: %int_2147483647.1: %u32 = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_2147483647.1) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_2147483647.1) [template] +// CHECK:STDOUT: %int_2147483647.2: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Convert.bound.10: = bound_method %int_2147483647.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.10: = specific_function %Convert.bound.10, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2882400001.1: Core.IntLiteral = int_value 2882400001 [template] +// CHECK:STDOUT: %int_8.1: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %Convert.bound.11: = bound_method %int_2882400001.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.11: = specific_function %Convert.bound.11, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2882400001.2: %u32 = int_value 2882400001 [template] +// CHECK:STDOUT: %Convert.bound.12: = bound_method %int_8.1, %Convert.16 [template] +// CHECK:STDOUT: %Convert.specific_fn.12: = specific_function %Convert.bound.12, @Convert.7(%int_32) [template] +// CHECK:STDOUT: %int_8.2: %i32 = int_value 8 [template] +// CHECK:STDOUT: %int_11259375.1: %u32 = int_value 11259375 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_11259375.1) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_11259375.1) [template] +// CHECK:STDOUT: %int_11259375.2: Core.IntLiteral = int_value 11259375 [template] +// CHECK:STDOUT: %Convert.bound.13: = bound_method %int_11259375.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.13: = specific_function %Convert.bound.13, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { -// CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .UInt = %import_ref.1 +// CHECK:STDOUT: .Int = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.9 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -270,151 +856,1078 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl -// CHECK:STDOUT: .arr1 = %arr1 -// CHECK:STDOUT: .arr1_p = @__global_init.%arr1_p -// CHECK:STDOUT: .arr2 = %arr2 -// CHECK:STDOUT: .arr2_p = @__global_init.%arr2_p +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc4_14.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc4_14.1, runtime_param [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %N.loc4_14.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc5_9.1: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %u32 = value_param_pattern %N.patt.loc5_9.1, runtime_param [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %u32 = name_ref N, %N.loc5_9.1 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc5_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %u32 = value_param runtime_param +// CHECK:STDOUT: %N.loc5_9.1: %u32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc5_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc5_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc6_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_18: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc6_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc6_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc6_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %int_32.loc7_18: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc7_18: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %int_32.loc7_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc7_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc7_34: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { +// CHECK:STDOUT: %a.patt: %u32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %u32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %u32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %u32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_22: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_22: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %int_32.loc19_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc19_19: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %int_32.loc19_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc19_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %u32.loc19_35: type = class_type @UInt, @UInt(constants.%int_32) [template = constants.%u32] +// CHECK:STDOUT: %a.param: %u32 = value_param runtime_param0 +// CHECK:STDOUT: %a: %u32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %u32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %u32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc4_14.1: %u32) { +// CHECK:STDOUT: %N.loc4_14.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc4_14.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.2] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %Negate.ref.loc10_17: %Negate.type.1 = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %RightShift.ref.loc10: %RightShift.type.1 = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %Negate.ref.loc10_35: %Negate.type.1 = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc10_42: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc10_42: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_42: = bound_method %int_1.loc10_42, %impl.elem0.loc10_42 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_42: = specific_function %Convert.bound.loc10_42, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_42: init %i32 = call %Convert.specific_fn.loc10_42(%int_1.loc10_42) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_42.1: %i32 = value_of_initializer %int.convert_checked.loc10_42 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_42.2: %i32 = converted %int_1.loc10_42, %.loc10_42.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc10_43: init %i32 = call %Negate.ref.loc10_35(%.loc10_42.2) [template = constants.%int_-1] -// CHECK:STDOUT: %int_1.loc10_46: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc10_43.1: %i32 = value_of_initializer %int.snegate.loc10_43 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_43.2: %i32 = converted %int.snegate.loc10_43, %.loc10_43.1 [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc10_46: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_46: = bound_method %int_1.loc10_46, %impl.elem0.loc10_46 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_46: = specific_function %Convert.bound.loc10_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_46: init %i32 = call %Convert.specific_fn.loc10_46(%int_1.loc10_46) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_46.1: %i32 = value_of_initializer %int.convert_checked.loc10_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_46.2: %i32 = converted %int_1.loc10_46, %.loc10_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.right_shift.loc10: init %i32 = call %RightShift.ref.loc10(%.loc10_43.2, %.loc10_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_47.1: %i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc10_47.2: %i32 = converted %int.right_shift.loc10, %.loc10_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.snegate.loc10_48: init %i32 = call %Negate.ref.loc10_17(%.loc10_47.2) [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_48: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc10_48: = bound_method %int.snegate.loc10_48, %impl.elem0.loc10_48 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc10_48: = specific_function %Convert.bound.loc10_48, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %.loc10_48.1: %i32 = value_of_initializer %int.snegate.loc10_48 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_48.2: %i32 = converted %int.snegate.loc10_48, %.loc10_48.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.convert_checked.loc10_48: init Core.IntLiteral = call %Convert.specific_fn.loc10_48(%.loc10_48.2) [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc10_48.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_48 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc10_48.4: Core.IntLiteral = converted %int.snegate.loc10_48, %.loc10_48.3 [template = constants.%int_1.1] -// CHECK:STDOUT: %array_type.loc10: type = array_type %.loc10_48.4, %i32 [template = constants.%array_type.1] -// CHECK:STDOUT: %arr1.var: ref %array_type.1 = var arr1 -// CHECK:STDOUT: %arr1: ref %array_type.1 = bind_name arr1, %arr1.var -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc5_9.1: %u32) { +// CHECK:STDOUT: %N.loc5_9.2: %u32 = bind_symbolic_name N, 0 [symbolic = %N.loc5_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc5_9.2: %u32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc5_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc5_29.2: type = class_type @Expect, @Expect(%N.loc5_9.2) [symbolic = %Expect.loc5_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc5_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc5_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %u32) -> %return.param_patt: @Test.%Expect.loc5_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc5_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc5_41.2: init @Test.%Expect.loc5_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc5_42: init @Test.%Expect.loc5_29.2 (%Expect.1) = converted %.loc5_41.1, %.loc5_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc5_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %u32, %b.param_patt: %i32) -> %u32 = "int.right_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc10: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_0.loc10_19: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_31.loc10: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc10_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_19: = bound_method %int_0.loc10_19, %impl.elem0.loc10_19 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_19: = specific_function %Convert.bound.loc10_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_19: init %u32 = call %Convert.specific_fn.loc10_19(%int_0.loc10_19) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_19.1: %u32 = value_of_initializer %int.convert_checked.loc10_19 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_19.2: %u32 = converted %int_0.loc10_19, %.loc10_19.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_22: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc10_22: = bound_method %int_31.loc10, %impl.elem0.loc10_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc10_22: = specific_function %Convert.bound.loc10_22, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc10_22: init %i32 = call %Convert.specific_fn.loc10_22(%int_31.loc10) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc10_22.1: %i32 = value_of_initializer %int.convert_checked.loc10_22 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc10_22.2: %i32 = converted %int_31.loc10, %.loc10_22.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.right_shift.loc10: init %u32 = call %RightShift.ref.loc10(%.loc10_19.2, %.loc10_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_25.1: %u32 = value_of_initializer %int.right_shift.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_25.2: %u32 = converted %int.right_shift.loc10, %.loc10_25.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_25.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_37: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_38: = bound_method %int_0.loc10_37, %impl.elem0.loc10_38 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_38: = specific_function %Convert.bound.loc10_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_38: init %u32 = call %Convert.specific_fn.loc10_38(%int_0.loc10_37) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_38.1: %u32 = value_of_initializer %int.convert_checked.loc10_38 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_38.2: %u32 = converted %int_0.loc10_37, %.loc10_38.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_25.4: ref %Expect.2 = temporary %.loc10_25.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc11: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] // CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %array_type.loc11: type = array_type %int_1.loc11, %i32 [template = constants.%array_type.1] -// CHECK:STDOUT: %ptr.loc11: type = ptr_type %array_type.1 [template = constants.%ptr.1] -// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %Negate.ref.loc14_17: %Negate.type.1 = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %RightShift.ref.loc14: %RightShift.type.1 = name_ref RightShift, %RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %Negate.ref.loc14_35: %Negate.type.1 = name_ref Negate, %Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10.1] -// CHECK:STDOUT: %impl.elem0.loc14_42: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_42: = bound_method %int_10, %impl.elem0.loc14_42 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc14_42: = specific_function %Convert.bound.loc14_42, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %int.convert_checked.loc14_42: init %i32 = call %Convert.specific_fn.loc14_42(%int_10) [template = constants.%int_10.2] -// CHECK:STDOUT: %.loc14_42.1: %i32 = value_of_initializer %int.convert_checked.loc14_42 [template = constants.%int_10.2] -// CHECK:STDOUT: %.loc14_42.2: %i32 = converted %int_10, %.loc14_42.1 [template = constants.%int_10.2] -// CHECK:STDOUT: %int.snegate.loc14_44: init %i32 = call %Negate.ref.loc14_35(%.loc14_42.2) [template = constants.%int_-10] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %.loc14_44.1: %i32 = value_of_initializer %int.snegate.loc14_44 [template = constants.%int_-10] -// CHECK:STDOUT: %.loc14_44.2: %i32 = converted %int.snegate.loc14_44, %.loc14_44.1 [template = constants.%int_-10] -// CHECK:STDOUT: %impl.elem0.loc14_47: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_47: = bound_method %int_2, %impl.elem0.loc14_47 [template = constants.%Convert.bound.4] -// CHECK:STDOUT: %Convert.specific_fn.loc14_47: = specific_function %Convert.bound.loc14_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] -// CHECK:STDOUT: %int.convert_checked.loc14_47: init %i32 = call %Convert.specific_fn.loc14_47(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc14_47.1: %i32 = value_of_initializer %int.convert_checked.loc14_47 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc14_47.2: %i32 = converted %int_2, %.loc14_47.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.right_shift.loc14: init %i32 = call %RightShift.ref.loc14(%.loc14_44.2, %.loc14_47.2) [template = constants.%int_-3] -// CHECK:STDOUT: %.loc14_48.1: %i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%int_-3] -// CHECK:STDOUT: %.loc14_48.2: %i32 = converted %int.right_shift.loc14, %.loc14_48.1 [template = constants.%int_-3] -// CHECK:STDOUT: %int.snegate.loc14_49: init %i32 = call %Negate.ref.loc14_17(%.loc14_48.2) [template = constants.%int_3.1] -// CHECK:STDOUT: %impl.elem0.loc14_49: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc14_49: = bound_method %int.snegate.loc14_49, %impl.elem0.loc14_49 [template = constants.%Convert.bound.5] -// CHECK:STDOUT: %Convert.specific_fn.loc14_49: = specific_function %Convert.bound.loc14_49, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.5] -// CHECK:STDOUT: %.loc14_49.1: %i32 = value_of_initializer %int.snegate.loc14_49 [template = constants.%int_3.1] -// CHECK:STDOUT: %.loc14_49.2: %i32 = converted %int.snegate.loc14_49, %.loc14_49.1 [template = constants.%int_3.1] -// CHECK:STDOUT: %int.convert_checked.loc14_49: init Core.IntLiteral = call %Convert.specific_fn.loc14_49(%.loc14_49.2) [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc14_49.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc14_49 [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc14_49.4: Core.IntLiteral = converted %int.snegate.loc14_49, %.loc14_49.3 [template = constants.%int_3.2] -// CHECK:STDOUT: %array_type.loc14: type = array_type %.loc14_49.4, %i32 [template = constants.%array_type.2] -// CHECK:STDOUT: %arr2.var: ref %array_type.2 = var arr2 -// CHECK:STDOUT: %arr2: ref %array_type.2 = bind_name arr2, %arr2.var -// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.2] -// CHECK:STDOUT: %array_type.loc15: type = array_type %int_3, %i32 [template = constants.%array_type.2] -// CHECK:STDOUT: %ptr.loc15: type = ptr_type %array_type.2 [template = constants.%ptr.2] +// CHECK:STDOUT: %int_31.loc11: Core.IntLiteral = int_value 31 [template = constants.%int_31.1] +// CHECK:STDOUT: %impl.elem0.loc11_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_19: = bound_method %int_1.loc11, %impl.elem0.loc11_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc11_19: = specific_function %Convert.bound.loc11_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc11_19: init %u32 = call %Convert.specific_fn.loc11_19(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_19.1: %u32 = value_of_initializer %int.convert_checked.loc11_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_19.2: %u32 = converted %int_1.loc11, %.loc11_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_22: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc11_22: = bound_method %int_31.loc11, %impl.elem0.loc11_22 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_22: = specific_function %Convert.bound.loc11_22, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_22: init %i32 = call %Convert.specific_fn.loc11_22(%int_31.loc11) [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc11_22.1: %i32 = value_of_initializer %int.convert_checked.loc11_22 [template = constants.%int_31.2] +// CHECK:STDOUT: %.loc11_22.2: %i32 = converted %int_31.loc11, %.loc11_22.1 [template = constants.%int_31.2] +// CHECK:STDOUT: %int.right_shift.loc11: init %u32 = call %RightShift.ref.loc11(%.loc11_19.2, %.loc11_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_25.1: %u32 = value_of_initializer %int.right_shift.loc11 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_25.2: %u32 = converted %int.right_shift.loc11, %.loc11_25.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_25.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_38: = bound_method %int_0.loc11, %impl.elem0.loc11_38 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_38: = specific_function %Convert.bound.loc11_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_38: init %u32 = call %Convert.specific_fn.loc11_38(%int_0.loc11) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_38.1: %u32 = value_of_initializer %int.convert_checked.loc11_38 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_38.2: %u32 = converted %int_0.loc11, %.loc11_38.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_25.4: ref %Expect.2 = temporary %.loc11_25.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc12: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc12_19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc12_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_19: = bound_method %int_1.loc12_19, %impl.elem0.loc12_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_19: = specific_function %Convert.bound.loc12_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_19: init %u32 = call %Convert.specific_fn.loc12_19(%int_1.loc12_19) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_19.1: %u32 = value_of_initializer %int.convert_checked.loc12_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_19.2: %u32 = converted %int_1.loc12_19, %.loc12_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc12_22: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc12_22: = bound_method %int_0.loc12, %impl.elem0.loc12_22 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc12_22: = specific_function %Convert.bound.loc12_22, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc12_22: init %i32 = call %Convert.specific_fn.loc12_22(%int_0.loc12) [template = constants.%int_0.3] +// CHECK:STDOUT: %.loc12_22.1: %i32 = value_of_initializer %int.convert_checked.loc12_22 [template = constants.%int_0.3] +// CHECK:STDOUT: %.loc12_22.2: %i32 = converted %int_0.loc12, %.loc12_22.1 [template = constants.%int_0.3] +// CHECK:STDOUT: %int.right_shift.loc12: init %u32 = call %RightShift.ref.loc12(%.loc12_19.2, %.loc12_22.2) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_24.1: %u32 = value_of_initializer %int.right_shift.loc12 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_24.2: %u32 = converted %int.right_shift.loc12, %.loc12_24.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_1.2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_24.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc12_36: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_37: = bound_method %int_1.loc12_36, %impl.elem0.loc12_37 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_37: = specific_function %Convert.bound.loc12_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_37: init %u32 = call %Convert.specific_fn.loc12_37(%int_1.loc12_36) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_37.1: %u32 = value_of_initializer %int.convert_checked.loc12_37 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_37.2: %u32 = converted %int_1.loc12_36, %.loc12_37.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_1.2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_24.4: ref %Expect.3 = temporary %.loc12_24.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_2.loc13: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc13_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_19: = bound_method %int_1.loc13, %impl.elem0.loc13_19 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc13_19: = specific_function %Convert.bound.loc13_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc13_19: init %u32 = call %Convert.specific_fn.loc13_19(%int_1.loc13) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_19.1: %u32 = value_of_initializer %int.convert_checked.loc13_19 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc13_19.2: %u32 = converted %int_1.loc13, %.loc13_19.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc13_22: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc13_22: = bound_method %int_2.loc13, %impl.elem0.loc13_22 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc13_22: = specific_function %Convert.bound.loc13_22, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc13_22: init %i32 = call %Convert.specific_fn.loc13_22(%int_2.loc13) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_22.1: %i32 = value_of_initializer %int.convert_checked.loc13_22 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_22.2: %i32 = converted %int_2.loc13, %.loc13_22.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.right_shift.loc13: init %u32 = call %RightShift.ref.loc13(%.loc13_19.2, %.loc13_22.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_24.1: %u32 = value_of_initializer %int.right_shift.loc13 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_24.2: %u32 = converted %int.right_shift.loc13, %.loc13_24.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_24.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc13_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_37: = bound_method %int_0.loc13, %impl.elem0.loc13_37 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc13_37: = specific_function %Convert.bound.loc13_37, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc13_37: init %u32 = call %Convert.specific_fn.loc13_37(%int_0.loc13) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_37.1: %u32 = value_of_initializer %int.convert_checked.loc13_37 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc13_37.2: %u32 = converted %int_0.loc13, %.loc13_37.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_24.4: ref %Expect.2 = temporary %.loc13_24.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc14: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [template = constants.%int_22.1] +// CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc14_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_19: = bound_method %int_22, %impl.elem0.loc14_19 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc14_19: = specific_function %Convert.bound.loc14_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc14_19: init %u32 = call %Convert.specific_fn.loc14_19(%int_22) [template = constants.%int_22.2] +// CHECK:STDOUT: %.loc14_19.1: %u32 = value_of_initializer %int.convert_checked.loc14_19 [template = constants.%int_22.2] +// CHECK:STDOUT: %.loc14_19.2: %u32 = converted %int_22, %.loc14_19.1 [template = constants.%int_22.2] +// CHECK:STDOUT: %impl.elem0.loc14_23: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc14_23: = bound_method %int_2.loc14, %impl.elem0.loc14_23 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc14_23: = specific_function %Convert.bound.loc14_23, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc14_23: init %i32 = call %Convert.specific_fn.loc14_23(%int_2.loc14) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_23.1: %i32 = value_of_initializer %int.convert_checked.loc14_23 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc14_23.2: %i32 = converted %int_2.loc14, %.loc14_23.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.right_shift.loc14: init %u32 = call %RightShift.ref.loc14(%.loc14_19.2, %.loc14_23.2) [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_25.1: %u32 = value_of_initializer %int.right_shift.loc14 [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_25.2: %u32 = converted %int.right_shift.loc14, %.loc14_25.1 [template = constants.%int_5.1] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_5.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_25.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_25.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.2] +// CHECK:STDOUT: %impl.elem0.loc14_38: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_38: = bound_method %int_5, %impl.elem0.loc14_38 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc14_38: = specific_function %Convert.bound.loc14_38, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %int.convert_checked.loc14_38: init %u32 = call %Convert.specific_fn.loc14_38(%int_5) [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_38.1: %u32 = value_of_initializer %int.convert_checked.loc14_38 [template = constants.%int_5.1] +// CHECK:STDOUT: %.loc14_38.2: %u32 = converted %int_5, %.loc14_38.1 [template = constants.%int_5.1] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_5.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_25.4: ref %Expect.4 = temporary %.loc14_25.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc15: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template = constants.%int_4294967295.1] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_19: = bound_method %int_4294967295, %impl.elem0.loc15_19 [template = constants.%Convert.bound.8] +// CHECK:STDOUT: %Convert.specific_fn.loc15_19: = specific_function %Convert.bound.loc15_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.8] +// CHECK:STDOUT: %int.convert_checked.loc15_19: init %u32 = call %Convert.specific_fn.loc15_19(%int_4294967295) [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %.loc15_19.1: %u32 = value_of_initializer %int.convert_checked.loc15_19 [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %.loc15_19.2: %u32 = converted %int_4294967295, %.loc15_19.1 [template = constants.%int_4294967295.2] +// CHECK:STDOUT: %impl.elem0.loc15_32: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc15_32: = bound_method %int_1.loc15, %impl.elem0.loc15_32 [template = constants.%Convert.bound.9] +// CHECK:STDOUT: %Convert.specific_fn.loc15_32: = specific_function %Convert.bound.loc15_32, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.9] +// CHECK:STDOUT: %int.convert_checked.loc15_32: init %i32 = call %Convert.specific_fn.loc15_32(%int_1.loc15) [template = constants.%int_1.3] +// CHECK:STDOUT: %.loc15_32.1: %i32 = value_of_initializer %int.convert_checked.loc15_32 [template = constants.%int_1.3] +// CHECK:STDOUT: %.loc15_32.2: %i32 = converted %int_1.loc15, %.loc15_32.1 [template = constants.%int_1.3] +// CHECK:STDOUT: %int.right_shift.loc15: init %u32 = call %RightShift.ref.loc15(%.loc15_19.2, %.loc15_32.2) [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc15_34.1: %u32 = value_of_initializer %int.right_shift.loc15 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc15_34.2: %u32 = converted %int.right_shift.loc15, %.loc15_34.1 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_2147483647.1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_34.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_34.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc15_57: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_57: = bound_method %int_2147483647, %impl.elem0.loc15_57 [template = constants.%Convert.bound.10] +// CHECK:STDOUT: %Convert.specific_fn.loc15_57: = specific_function %Convert.bound.loc15_57, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.10] +// CHECK:STDOUT: %int.convert_checked.loc15_57: init %u32 = call %Convert.specific_fn.loc15_57(%int_2147483647) [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc15_57.1: %u32 = value_of_initializer %int.convert_checked.loc15_57 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc15_57.2: %u32 = converted %int_2147483647, %.loc15_57.1 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_2147483647.1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_34.4: ref %Expect.5 = temporary %.loc15_34.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc16: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template = constants.%int_2882400001.1] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8.1] +// CHECK:STDOUT: %impl.elem0.loc16_19: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_19: = bound_method %int_2882400001, %impl.elem0.loc16_19 [template = constants.%Convert.bound.11] +// CHECK:STDOUT: %Convert.specific_fn.loc16_19: = specific_function %Convert.bound.loc16_19, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.11] +// CHECK:STDOUT: %int.convert_checked.loc16_19: init %u32 = call %Convert.specific_fn.loc16_19(%int_2882400001) [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %.loc16_19.1: %u32 = value_of_initializer %int.convert_checked.loc16_19 [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %.loc16_19.2: %u32 = converted %int_2882400001, %.loc16_19.1 [template = constants.%int_2882400001.2] +// CHECK:STDOUT: %impl.elem0.loc16_32: %Convert.type.11 = interface_witness_access constants.%interface.10, element0 [template = constants.%Convert.16] +// CHECK:STDOUT: %Convert.bound.loc16_32: = bound_method %int_8, %impl.elem0.loc16_32 [template = constants.%Convert.bound.12] +// CHECK:STDOUT: %Convert.specific_fn.loc16_32: = specific_function %Convert.bound.loc16_32, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn.12] +// CHECK:STDOUT: %int.convert_checked.loc16_32: init %i32 = call %Convert.specific_fn.loc16_32(%int_8) [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc16_32.1: %i32 = value_of_initializer %int.convert_checked.loc16_32 [template = constants.%int_8.2] +// CHECK:STDOUT: %.loc16_32.2: %i32 = converted %int_8, %.loc16_32.1 [template = constants.%int_8.2] +// CHECK:STDOUT: %int.right_shift.loc16: init %u32 = call %RightShift.ref.loc16(%.loc16_19.2, %.loc16_32.2) [template = constants.%int_11259375.1] +// CHECK:STDOUT: %.loc16_34.1: %u32 = value_of_initializer %int.right_shift.loc16 [template = constants.%int_11259375.1] +// CHECK:STDOUT: %.loc16_34.2: %u32 = converted %int.right_shift.loc16, %.loc16_34.1 [template = constants.%int_11259375.1] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_11259375.1) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc16_34.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.6 = call %Test.specific_fn.loc16() to %.loc16_34.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_11259375: Core.IntLiteral = int_value 11259375 [template = constants.%int_11259375.2] +// CHECK:STDOUT: %impl.elem0.loc16_55: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc16_55: = bound_method %int_11259375, %impl.elem0.loc16_55 [template = constants.%Convert.bound.13] +// CHECK:STDOUT: %Convert.specific_fn.loc16_55: = specific_function %Convert.bound.loc16_55, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.13] +// CHECK:STDOUT: %int.convert_checked.loc16_55: init %u32 = call %Convert.specific_fn.loc16_55(%int_11259375) [template = constants.%int_11259375.1] +// CHECK:STDOUT: %.loc16_55.1: %u32 = value_of_initializer %int.convert_checked.loc16_55 [template = constants.%int_11259375.1] +// CHECK:STDOUT: %.loc16_55.2: %u32 = converted %int_11259375, %.loc16_55.1 [template = constants.%int_11259375.1] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_11259375.1) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc16_34.4: ref %Expect.6 = temporary %.loc16_34.3, %Test.call.loc16 +// CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; +// CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %u32, %b.param_patt: %i32) -> %u32 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %RightShift.ref: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %a.ref: %u32 = name_ref a, %a +// CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b +// CHECK:STDOUT: %int.right_shift: init %u32 = call %RightShift.ref(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc20_26.1: %u32 = value_of_initializer %int.right_shift +// CHECK:STDOUT: %.loc20_26.2: %u32 = converted %int.right_shift, %.loc20_26.1 +// CHECK:STDOUT: return %.loc20_26.2 +// CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%N.2 // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc5_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1.2) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_1.2 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_1.2 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1.2) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_1.2 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_1.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_5.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_5.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_5.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_5.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_5.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_5.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_11259375.1) { +// CHECK:STDOUT: %N.loc5_9.2 => constants.%int_11259375.1 +// CHECK:STDOUT: %N.patt.loc5_9.2 => constants.%int_11259375.1 +// CHECK:STDOUT: %Expect.loc5_29.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.2 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_11259375.1) { +// CHECK:STDOUT: %N.loc4_14.2 => constants.%int_11259375.1 +// CHECK:STDOUT: %N.patt.loc4_14.2 => constants.%int_11259375.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %RightShift.type: type = fn_type @RightShift [template] +// CHECK:STDOUT: %RightShift: %RightShift.type = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %int_31: Core.IntLiteral = int_value 31 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_1) [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [template] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_5) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_5) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_-1) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2, %Op.2 [template] +// CHECK:STDOUT: %int_-2: Core.IntLiteral = int_value -2 [template] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_10, %Op.2 [template] +// CHECK:STDOUT: %int_-10: Core.IntLiteral = int_value -10 [template] +// CHECK:STDOUT: %int_-3: Core.IntLiteral = int_value -3 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_-3) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_-3) [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_3, %Op.2 [template] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_2147483647) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_2147483647) [template] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template] +// CHECK:STDOUT: %int_11259375: Core.IntLiteral = int_value 11259375 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_11259375) [template] +// CHECK:STDOUT: %Test.specific_fn.7: = specific_function %Test, @Test(%int_11259375) [template] +// CHECK:STDOUT: %int_305419896: Core.IntLiteral = int_value 305419896 [template] +// CHECK:STDOUT: %int_1000000000: Core.IntLiteral = int_value 1000000000 [template] +// CHECK:STDOUT: %Op.bound.5: = bound_method %int_305419896, %Op.2 [template] +// CHECK:STDOUT: %int_-305419896: Core.IntLiteral = int_value -305419896 [template] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] +// CHECK:STDOUT: %Op.bound.6: = bound_method %int_9223372036854775807, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775807: Core.IntLiteral = int_value -9223372036854775807 [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Op.bound.7: = bound_method %int_9223372036854775808, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.8: %Expect.8 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .RightShift = %RightShift.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %RightShift.decl: %RightShift.type = fn_decl @RightShift [template = constants.%RightShift] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_18: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_22: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_34: init type = call %IntLiteral.ref.loc4_22() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.1: type = value_of_initializer %int_literal.make_type.loc4_34 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_34.2: type = converted %int_literal.make_type.loc4_34, %.loc4_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_40: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_44: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_56: init type = call %IntLiteral.ref.loc4_44() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.1: type = value_of_initializer %int_literal.make_type.loc4_56 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_56.2: type = converted %int_literal.make_type.loc4_56, %.loc4_56.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_62: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_66: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_78: init type = call %IntLiteral.ref.loc4_66() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_78.1: type = value_of_initializer %int_literal.make_type.loc4_78 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_78.2: type = converted %int_literal.make_type.loc4_78, %.loc4_78.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @RightShift(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.right_shift"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr1.ref: ref %array_type.1 = name_ref arr1, file.%arr1 -// CHECK:STDOUT: %addr.loc11: %ptr.1 = addr_of %arr1.ref -// CHECK:STDOUT: %arr1_p: %ptr.1 = bind_name arr1_p, %addr.loc11 -// CHECK:STDOUT: %arr2.ref: ref %array_type.2 = name_ref arr2, file.%arr2 -// CHECK:STDOUT: %addr.loc15: %ptr.2 = addr_of %arr2.ref -// CHECK:STDOUT: %arr2_p: %ptr.2 = bind_name arr2_p, %addr.loc15 +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc10: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_0.loc10_19: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_31.loc10: Core.IntLiteral = int_value 31 [template = constants.%int_31] +// CHECK:STDOUT: %int.right_shift.loc10: init Core.IntLiteral = call %RightShift.ref.loc10(%int_0.loc10_19, %int_31.loc10) [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_25.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc10 [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_25.2: Core.IntLiteral = converted %int.right_shift.loc10, %.loc10_25.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_25.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_37: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_25.4: ref %Expect.2 = temporary %.loc10_25.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc11: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_31.loc11: Core.IntLiteral = int_value 31 [template = constants.%int_31] +// CHECK:STDOUT: %int.right_shift.loc11: init Core.IntLiteral = call %RightShift.ref.loc11(%int_1.loc11, %int_31.loc11) [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_25.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc11 [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_25.2: Core.IntLiteral = converted %int.right_shift.loc11, %.loc11_25.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_25.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_25.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_25.4: ref %Expect.2 = temporary %.loc11_25.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc12: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc12_19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.right_shift.loc12: init Core.IntLiteral = call %RightShift.ref.loc12(%int_1.loc12_19, %int_0.loc12) [template = constants.%int_1] +// CHECK:STDOUT: %.loc12_24.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc12 [template = constants.%int_1] +// CHECK:STDOUT: %.loc12_24.2: Core.IntLiteral = converted %int.right_shift.loc12, %.loc12_24.1 [template = constants.%int_1] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_24.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_24.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc12_36: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_24.4: ref %Expect.3 = temporary %.loc12_24.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_2.loc13: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.right_shift.loc13: init Core.IntLiteral = call %RightShift.ref.loc13(%int_1.loc13, %int_2.loc13) [template = constants.%int_0] +// CHECK:STDOUT: %.loc13_24.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc13 [template = constants.%int_0] +// CHECK:STDOUT: %.loc13_24.2: Core.IntLiteral = converted %int.right_shift.loc13, %.loc13_24.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc13_24.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.2 = call %Test.specific_fn.loc13() to %.loc13_24.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc13: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc13_24.4: ref %Expect.2 = temporary %.loc13_24.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc14: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [template = constants.%int_22] +// CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.right_shift.loc14: init Core.IntLiteral = call %RightShift.ref.loc14(%int_22, %int_2.loc14) [template = constants.%int_5] +// CHECK:STDOUT: %.loc14_25.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc14 [template = constants.%int_5] +// CHECK:STDOUT: %.loc14_25.2: Core.IntLiteral = converted %int.right_shift.loc14, %.loc14_25.1 [template = constants.%int_5] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_5) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_25.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_25.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_5) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_25.4: ref %Expect.4 = temporary %.loc14_25.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc15: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc15_20: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_19: = bound_method %int_1.loc15_20, %impl.elem0.loc15_19 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_19: init Core.IntLiteral = call %Op.bound.loc15_19(%int_1.loc15_20) [template = constants.%int_-1] +// CHECK:STDOUT: %int_1.loc15_23: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc15_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_19 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_19.2: Core.IntLiteral = converted %int.snegate.loc15_19, %.loc15_19.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.right_shift.loc15: init Core.IntLiteral = call %RightShift.ref.loc15(%.loc15_19.2, %int_1.loc15_23) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_25.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc15 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_25.2: Core.IntLiteral = converted %int.right_shift.loc15, %.loc15_25.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_25.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_25.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc15_38: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15_37: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_37: = bound_method %int_1.loc15_38, %impl.elem0.loc15_37 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_37: init Core.IntLiteral = call %Op.bound.loc15_37(%int_1.loc15_38) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_39.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_37 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_39.2: Core.IntLiteral = converted %int.snegate.loc15_37, %.loc15_39.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_25.4: ref %Expect.5 = temporary %.loc15_25.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc16: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_2.loc16: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %impl.elem0.loc16_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_19: = bound_method %int_2.loc16, %impl.elem0.loc16_19 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc16_19: init Core.IntLiteral = call %Op.bound.loc16_19(%int_2.loc16) [template = constants.%int_-2] +// CHECK:STDOUT: %int_1.loc16_23: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc16_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_19 [template = constants.%int_-2] +// CHECK:STDOUT: %.loc16_19.2: Core.IntLiteral = converted %int.snegate.loc16_19, %.loc16_19.1 [template = constants.%int_-2] +// CHECK:STDOUT: %int.right_shift.loc16: init Core.IntLiteral = call %RightShift.ref.loc16(%.loc16_19.2, %int_1.loc16_23) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc16_25.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc16 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc16_25.2: Core.IntLiteral = converted %int.right_shift.loc16, %.loc16_25.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc16_25.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.5 = call %Test.specific_fn.loc16() to %.loc16_25.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc16_38: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc16_37: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc16_37: = bound_method %int_1.loc16_38, %impl.elem0.loc16_37 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc16_37: init Core.IntLiteral = call %Op.bound.loc16_37(%int_1.loc16_38) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc16_39.1: Core.IntLiteral = value_of_initializer %int.snegate.loc16_37 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc16_39.2: Core.IntLiteral = converted %int.snegate.loc16_37, %.loc16_39.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc16_25.4: ref %Expect.5 = temporary %.loc16_25.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc17: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [template = constants.%int_10] +// CHECK:STDOUT: %impl.elem0.loc17_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_19: = bound_method %int_10, %impl.elem0.loc17_19 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc17_19: init Core.IntLiteral = call %Op.bound.loc17_19(%int_10) [template = constants.%int_-10] +// CHECK:STDOUT: %int_2.loc17: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %.loc17_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_19 [template = constants.%int_-10] +// CHECK:STDOUT: %.loc17_19.2: Core.IntLiteral = converted %int.snegate.loc17_19, %.loc17_19.1 [template = constants.%int_-10] +// CHECK:STDOUT: %int.right_shift.loc17: init Core.IntLiteral = call %RightShift.ref.loc17(%.loc17_19.2, %int_2.loc17) [template = constants.%int_-3] +// CHECK:STDOUT: %.loc17_26.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc17 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc17_26.2: Core.IntLiteral = converted %int.right_shift.loc17, %.loc17_26.1 [template = constants.%int_-3] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_-3) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc17_26.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.6 = call %Test.specific_fn.loc17() to %.loc17_26.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %impl.elem0.loc17_38: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc17_38: = bound_method %int_3, %impl.elem0.loc17_38 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc17_38: init Core.IntLiteral = call %Op.bound.loc17_38(%int_3) [template = constants.%int_-3] +// CHECK:STDOUT: %.loc17_40.1: Core.IntLiteral = value_of_initializer %int.snegate.loc17_38 [template = constants.%int_-3] +// CHECK:STDOUT: %.loc17_40.2: Core.IntLiteral = converted %int.snegate.loc17_38, %.loc17_40.1 [template = constants.%int_-3] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_-3) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc17_26.4: ref %Expect.6 = temporary %.loc17_26.3, %Test.call.loc17 +// CHECK:STDOUT: %Test.ref.loc18: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc18: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_4294967295: Core.IntLiteral = int_value 4294967295 [template = constants.%int_4294967295] +// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.right_shift.loc18: init Core.IntLiteral = call %RightShift.ref.loc18(%int_4294967295, %int_1.loc18) [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc18_34.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc18 [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc18_34.2: Core.IntLiteral = converted %int.right_shift.loc18, %.loc18_34.1 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Test.specific_fn.loc18: = specific_function %Test.ref.loc18, @Test(constants.%int_2147483647) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc18_34.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc18: init %Expect.7 = call %Test.specific_fn.loc18() to %.loc18_34.3 +// CHECK:STDOUT: %Expect.ref.loc18: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Expect.loc18: type = class_type @Expect, @Expect(constants.%int_2147483647) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc18_34.4: ref %Expect.7 = temporary %.loc18_34.3, %Test.call.loc18 +// CHECK:STDOUT: %Test.ref.loc19: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc19: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_2882400001: Core.IntLiteral = int_value 2882400001 [template = constants.%int_2882400001] +// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [template = constants.%int_8] +// CHECK:STDOUT: %int.right_shift.loc19: init Core.IntLiteral = call %RightShift.ref.loc19(%int_2882400001, %int_8) [template = constants.%int_11259375] +// CHECK:STDOUT: %.loc19_34.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc19 [template = constants.%int_11259375] +// CHECK:STDOUT: %.loc19_34.2: Core.IntLiteral = converted %int.right_shift.loc19, %.loc19_34.1 [template = constants.%int_11259375] +// CHECK:STDOUT: %Test.specific_fn.loc19: = specific_function %Test.ref.loc19, @Test(constants.%int_11259375) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc19_34.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc19: init %Expect.8 = call %Test.specific_fn.loc19() to %.loc19_34.3 +// CHECK:STDOUT: %Expect.ref.loc19: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_11259375: Core.IntLiteral = int_value 11259375 [template = constants.%int_11259375] +// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_11259375) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc19_34.4: ref %Expect.8 = temporary %.loc19_34.3, %Test.call.loc19 +// CHECK:STDOUT: %Test.ref.loc21: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc21: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_305419896.loc21: Core.IntLiteral = int_value 305419896 [template = constants.%int_305419896] +// CHECK:STDOUT: %int_1000000000.loc21: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %int.right_shift.loc21: init Core.IntLiteral = call %RightShift.ref.loc21(%int_305419896.loc21, %int_1000000000.loc21) [template = constants.%int_0] +// CHECK:STDOUT: %.loc21_46.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc21 [template = constants.%int_0] +// CHECK:STDOUT: %.loc21_46.2: Core.IntLiteral = converted %int.right_shift.loc21, %.loc21_46.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc21: = specific_function %Test.ref.loc21, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc21_46.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc21: init %Expect.2 = call %Test.specific_fn.loc21() to %.loc21_46.3 +// CHECK:STDOUT: %Expect.ref.loc21: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc21: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc21_46.4: ref %Expect.2 = temporary %.loc21_46.3, %Test.call.loc21 +// CHECK:STDOUT: %Test.ref.loc22: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc22: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_305419896.loc22: Core.IntLiteral = int_value 305419896 [template = constants.%int_305419896] +// CHECK:STDOUT: %impl.elem0.loc22_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc22_19: = bound_method %int_305419896.loc22, %impl.elem0.loc22_19 [template = constants.%Op.bound.5] +// CHECK:STDOUT: %int.snegate.loc22_19: init Core.IntLiteral = call %Op.bound.loc22_19(%int_305419896.loc22) [template = constants.%int_-305419896] +// CHECK:STDOUT: %int_1000000000.loc22: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %.loc22_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc22_19 [template = constants.%int_-305419896] +// CHECK:STDOUT: %.loc22_19.2: Core.IntLiteral = converted %int.snegate.loc22_19, %.loc22_19.1 [template = constants.%int_-305419896] +// CHECK:STDOUT: %int.right_shift.loc22: init Core.IntLiteral = call %RightShift.ref.loc22(%.loc22_19.2, %int_1000000000.loc22) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_47.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc22 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_47.2: Core.IntLiteral = converted %int.right_shift.loc22, %.loc22_47.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc22: = specific_function %Test.ref.loc22, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc22_47.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc22: init %Expect.5 = call %Test.specific_fn.loc22() to %.loc22_47.3 +// CHECK:STDOUT: %Expect.ref.loc22: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc22_59: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc22_59: = bound_method %int_1.loc22, %impl.elem0.loc22_59 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc22_59: init Core.IntLiteral = call %Op.bound.loc22_59(%int_1.loc22) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_61.1: Core.IntLiteral = value_of_initializer %int.snegate.loc22_59 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_61.2: Core.IntLiteral = converted %int.snegate.loc22_59, %.loc22_61.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc22: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc22_47.4: ref %Expect.5 = temporary %.loc22_47.3, %Test.call.loc22 +// CHECK:STDOUT: %Test.ref.loc23: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc23: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template = constants.%int_18446744073709551615] +// CHECK:STDOUT: %int_1000000000.loc23: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %int.right_shift.loc23: init Core.IntLiteral = call %RightShift.ref.loc23(%int_18446744073709551615, %int_1000000000.loc23) [template = constants.%int_0] +// CHECK:STDOUT: %.loc23_56.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc23 [template = constants.%int_0] +// CHECK:STDOUT: %.loc23_56.2: Core.IntLiteral = converted %int.right_shift.loc23, %.loc23_56.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc23: = specific_function %Test.ref.loc23, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc23_56.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc23: init %Expect.2 = call %Test.specific_fn.loc23() to %.loc23_56.3 +// CHECK:STDOUT: %Expect.ref.loc23: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc23: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc23_56.4: ref %Expect.2 = temporary %.loc23_56.3, %Test.call.loc23 +// CHECK:STDOUT: %Test.ref.loc24: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc24: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_9223372036854775807.loc24: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int_1000000000.loc24: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %int.right_shift.loc24: init Core.IntLiteral = call %RightShift.ref.loc24(%int_9223372036854775807.loc24, %int_1000000000.loc24) [template = constants.%int_0] +// CHECK:STDOUT: %.loc24_56.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc24 [template = constants.%int_0] +// CHECK:STDOUT: %.loc24_56.2: Core.IntLiteral = converted %int.right_shift.loc24, %.loc24_56.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc24: = specific_function %Test.ref.loc24, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc24_56.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc24: init %Expect.2 = call %Test.specific_fn.loc24() to %.loc24_56.3 +// CHECK:STDOUT: %Expect.ref.loc24: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc24: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc24: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc24_56.4: ref %Expect.2 = temporary %.loc24_56.3, %Test.call.loc24 +// CHECK:STDOUT: %Test.ref.loc25: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc25: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_9223372036854775807.loc25: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %impl.elem0.loc25_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc25_19: = bound_method %int_9223372036854775807.loc25, %impl.elem0.loc25_19 [template = constants.%Op.bound.6] +// CHECK:STDOUT: %int.snegate.loc25_19: init Core.IntLiteral = call %Op.bound.loc25_19(%int_9223372036854775807.loc25) [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %int_1000000000.loc25: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %.loc25_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc25_19 [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %.loc25_19.2: Core.IntLiteral = converted %int.snegate.loc25_19, %.loc25_19.1 [template = constants.%int_-9223372036854775807] +// CHECK:STDOUT: %int.right_shift.loc25: init Core.IntLiteral = call %RightShift.ref.loc25(%.loc25_19.2, %int_1000000000.loc25) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc25_57.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc25 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc25_57.2: Core.IntLiteral = converted %int.right_shift.loc25, %.loc25_57.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc25: = specific_function %Test.ref.loc25, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc25_57.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc25: init %Expect.5 = call %Test.specific_fn.loc25() to %.loc25_57.3 +// CHECK:STDOUT: %Expect.ref.loc25: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc25: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc25_69: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc25_69: = bound_method %int_1.loc25, %impl.elem0.loc25_69 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc25_69: init Core.IntLiteral = call %Op.bound.loc25_69(%int_1.loc25) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc25_71.1: Core.IntLiteral = value_of_initializer %int.snegate.loc25_69 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc25_71.2: Core.IntLiteral = converted %int.snegate.loc25_69, %.loc25_71.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc25: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc25_57.4: ref %Expect.5 = temporary %.loc25_57.3, %Test.call.loc25 +// CHECK:STDOUT: %Test.ref.loc26: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %RightShift.ref.loc26: %RightShift.type = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc26_19: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc26_19: = bound_method %int_9223372036854775808, %impl.elem0.loc26_19 [template = constants.%Op.bound.7] +// CHECK:STDOUT: %int.snegate.loc26_19: init Core.IntLiteral = call %Op.bound.loc26_19(%int_9223372036854775808) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1000000000.loc26: Core.IntLiteral = int_value 1000000000 [template = constants.%int_1000000000] +// CHECK:STDOUT: %.loc26_19.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_19 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc26_19.2: Core.IntLiteral = converted %int.snegate.loc26_19, %.loc26_19.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.right_shift.loc26: init Core.IntLiteral = call %RightShift.ref.loc26(%.loc26_19.2, %int_1000000000.loc26) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_57.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc26 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_57.2: Core.IntLiteral = converted %int.right_shift.loc26, %.loc26_57.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc26: = specific_function %Test.ref.loc26, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc26_57.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc26: init %Expect.5 = call %Test.specific_fn.loc26() to %.loc26_57.3 +// CHECK:STDOUT: %Expect.ref.loc26: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc26_69: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc26_69: = bound_method %int_1.loc26, %impl.elem0.loc26_69 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc26_69: init Core.IntLiteral = call %Op.bound.loc26_69(%int_1.loc26) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_71.1: Core.IntLiteral = value_of_initializer %int.snegate.loc26_69 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc26_71.2: Core.IntLiteral = converted %int.snegate.loc26_69, %.loc26_71.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc26: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc26_57.4: ref %Expect.5 = temporary %.loc26_57.3, %Test.call.loc26 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_5) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_5 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_5 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_5) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_5 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-3) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-3 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-3 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-3) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-3 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_11259375) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_11259375 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_11259375 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_11259375) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_11259375 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_11259375 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -422,8 +1935,10 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32.1) [template] // CHECK:STDOUT: %RightShift.type.1: type = fn_type @RightShift.1 [template] // CHECK:STDOUT: %RightShift: %RightShift.type.1 = struct_value () [template] -// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] -// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %RightShiftLit.type: type = fn_type @RightShiftLit [template] +// CHECK:STDOUT: %RightShiftLit: %RightShiftLit.type = struct_value () [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %int_31.1: Core.IntLiteral = int_value 31 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] @@ -436,7 +1951,7 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %Convert.bound.2: = bound_method %int_31.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32.1) [template] // CHECK:STDOUT: %int_31.2: %i32 = int_value 31 [template] -// CHECK:STDOUT: %int_0: %i32 = int_value 0 [template] +// CHECK:STDOUT: %int_0.1: %i32 = int_value 0 [template] // CHECK:STDOUT: %Convert.bound.3: = bound_method %int_32.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32.1) [template] // CHECK:STDOUT: %int_32.2: %i32 = int_value 32 [template] @@ -444,27 +1959,44 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %Convert.bound.4: = bound_method %int_33.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32.1) [template] // CHECK:STDOUT: %int_33.2: %i32 = int_value 33 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32.1) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_0.2: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_0.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32.1) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .IntLiteral = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .Negate = %import_ref.230 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .RightShift = %RightShift.decl -// CHECK:STDOUT: .Negate = %Negate.decl +// CHECK:STDOUT: .RightShiftLit = %RightShiftLit.decl // CHECK:STDOUT: .size_1 = @__global_init.%size_1 // CHECK:STDOUT: .size_2 = @__global_init.%size_2 // CHECK:STDOUT: .size_3 = @__global_init.%size_3 // CHECK:STDOUT: .negative = @__global_init.%negative +// CHECK:STDOUT: .negative_zero = @__global_init.%negative_zero +// CHECK:STDOUT: .negative_lit = @__global_init.%negative_lit +// CHECK:STDOUT: .negative_lit_zero = @__global_init.%negative_lit_zero // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %RightShift.decl: %RightShift.type.1 = fn_decl @RightShift.1 [template = constants.%RightShift] { @@ -488,20 +2020,32 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { -// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a -// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 -// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: %RightShiftLit.decl: %RightShiftLit.type = fn_decl @RightShiftLit [template = constants.%RightShiftLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc5_22: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc5_22: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: %Core.ref.loc5_21: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_25: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_37: init type = call %IntLiteral.ref.loc5_25() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_37.1: type = value_of_initializer %int_literal.make_type.loc5_37 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_37.2: type = converted %int_literal.make_type.loc5_37, %.loc5_37.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc5_51: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_55: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_67: init type = call %IntLiteral.ref.loc5_55() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_67.1: type = value_of_initializer %int_literal.make_type.loc5_67 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_67.2: type = converted %int_literal.make_type.loc5_67, %.loc5_67.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] // CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] @@ -509,13 +2053,25 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] // CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] // CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc24: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] -// CHECK:STDOUT: %i32.loc24: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc25: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc25: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc30: Core.IntLiteral = int_value 32 [template = constants.%int_32.1] +// CHECK:STDOUT: %i32.loc30: type = class_type @Int, @Int(constants.%int_32.1) [template = constants.%i32] +// CHECK:STDOUT: %Core.ref.loc35: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc35: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc35: init type = call %IntLiteral.ref.loc35() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc35_35.1: type = value_of_initializer %int_literal.make_type.loc35 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc35_35.2: type = converted %int_literal.make_type.loc35, %.loc35_35.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc39: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc39: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc39: init type = call %IntLiteral.ref.loc39() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc39_40.1: type = value_of_initializer %int_literal.make_type.loc39 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc39_40.2: type = converted %int_literal.make_type.loc39, %.loc39_40.1 [template = Core.IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @RightShift.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.right_shift"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Negate.1(%a.param_patt: %i32) -> %i32 = "int.snegate"; +// CHECK:STDOUT: fn @RightShiftLit(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> Core.IntLiteral = "int.right_shift"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: @@ -534,9 +2090,9 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %int.convert_checked.loc8_33: init %i32 = call %Convert.specific_fn.loc8_33(%int_31) [template = constants.%int_31.2] // CHECK:STDOUT: %.loc8_33.1: %i32 = value_of_initializer %int.convert_checked.loc8_33 [template = constants.%int_31.2] // CHECK:STDOUT: %.loc8_33.2: %i32 = converted %int_31, %.loc8_33.1 [template = constants.%int_31.2] -// CHECK:STDOUT: %int.right_shift.loc8: init %i32 = call %RightShift.ref.loc8(%.loc8_30.2, %.loc8_33.2) [template = constants.%int_0] -// CHECK:STDOUT: %.loc8_36.1: %i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%int_0] -// CHECK:STDOUT: %.loc8_36.2: %i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%int_0] +// CHECK:STDOUT: %int.right_shift.loc8: init %i32 = call %RightShift.ref.loc8(%.loc8_30.2, %.loc8_33.2) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc8_36.1: %i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc8_36.2: %i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%int_0.1] // CHECK:STDOUT: %size_1: %i32 = bind_name size_1, %.loc8_36.2 // CHECK:STDOUT: %RightShift.ref.loc13: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] // CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] @@ -576,29 +2132,90 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: %.loc18_36.1: %i32 = value_of_initializer %int.right_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_36.2: %i32 = converted %int.right_shift.loc18, %.loc18_36.1 [template = ] // CHECK:STDOUT: %size_3: %i32 = bind_name size_3, %.loc18_36.2 -// CHECK:STDOUT: %RightShift.ref.loc24: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] -// CHECK:STDOUT: %int_1.loc24_32: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %Negate.ref: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc24_42: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc24_42: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc24_42: = bound_method %int_1.loc24_42, %impl.elem0.loc24_42 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc24_42: = specific_function %Convert.bound.loc24_42, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc24_42: init %i32 = call %Convert.specific_fn.loc24_42(%int_1.loc24_42) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_42.1: %i32 = value_of_initializer %int.convert_checked.loc24_42 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_42.2: %i32 = converted %int_1.loc24_42, %.loc24_42.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate: init %i32 = call %Negate.ref(%.loc24_42.2) [template = constants.%int_-1] -// CHECK:STDOUT: %impl.elem0.loc24_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc24_32: = bound_method %int_1.loc24_32, %impl.elem0.loc24_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc24_32: = specific_function %Convert.bound.loc24_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc24_32: init %i32 = call %Convert.specific_fn.loc24_32(%int_1.loc24_32) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_32.1: %i32 = value_of_initializer %int.convert_checked.loc24_32 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_32.2: %i32 = converted %int_1.loc24_32, %.loc24_32.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc24_43.1: %i32 = value_of_initializer %int.snegate [template = constants.%int_-1] -// CHECK:STDOUT: %.loc24_43.2: %i32 = converted %int.snegate, %.loc24_43.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.right_shift.loc24: init %i32 = call %RightShift.ref.loc24(%.loc24_32.2, %.loc24_43.2) [template = ] -// CHECK:STDOUT: %.loc24_45.1: %i32 = value_of_initializer %int.right_shift.loc24 [template = ] -// CHECK:STDOUT: %.loc24_45.2: %i32 = converted %int.right_shift.loc24, %.loc24_45.1 [template = ] -// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc24_45.2 +// CHECK:STDOUT: %RightShift.ref.loc25: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_1.loc25_32: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc25_36: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc25_35.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc25: = bound_method %int_1.loc25_36, %impl.elem0.loc25_35.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc25: init Core.IntLiteral = call %Op.bound.loc25(%int_1.loc25_36) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc25_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc25_32: = bound_method %int_1.loc25_32, %impl.elem0.loc25_32 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc25_32: = specific_function %Convert.bound.loc25_32, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc25_32: init %i32 = call %Convert.specific_fn.loc25_32(%int_1.loc25_32) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc25_32.1: %i32 = value_of_initializer %int.convert_checked.loc25_32 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc25_32.2: %i32 = converted %int_1.loc25_32, %.loc25_32.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc25_35.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc25_35: = bound_method %int.snegate.loc25, %impl.elem0.loc25_35.2 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc25_35: = specific_function %Convert.bound.loc25_35, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %.loc25_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc25 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc25_35.2: Core.IntLiteral = converted %int.snegate.loc25, %.loc25_35.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc25_35: init %i32 = call %Convert.specific_fn.loc25_35(%.loc25_35.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc25_35.3: %i32 = value_of_initializer %int.convert_checked.loc25_35 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc25_35.4: %i32 = converted %int.snegate.loc25, %.loc25_35.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.right_shift.loc25: init %i32 = call %RightShift.ref.loc25(%.loc25_32.2, %.loc25_35.4) [template = ] +// CHECK:STDOUT: %.loc25_38.1: %i32 = value_of_initializer %int.right_shift.loc25 [template = ] +// CHECK:STDOUT: %.loc25_38.2: %i32 = converted %int.right_shift.loc25, %.loc25_38.1 [template = ] +// CHECK:STDOUT: %negative: %i32 = bind_name negative, %.loc25_38.2 +// CHECK:STDOUT: %RightShift.ref.loc30: %RightShift.type.1 = name_ref RightShift, file.%RightShift.decl [template = constants.%RightShift] +// CHECK:STDOUT: %int_0.loc30: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_1.loc30: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc30_40.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc30: = bound_method %int_1.loc30, %impl.elem0.loc30_40.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc30: init Core.IntLiteral = call %Op.bound.loc30(%int_1.loc30) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc30_37: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc30_37: = bound_method %int_0.loc30, %impl.elem0.loc30_37 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc30_37: = specific_function %Convert.bound.loc30_37, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc30_37: init %i32 = call %Convert.specific_fn.loc30_37(%int_0.loc30) [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc30_37.1: %i32 = value_of_initializer %int.convert_checked.loc30_37 [template = constants.%int_0.1] +// CHECK:STDOUT: %.loc30_37.2: %i32 = converted %int_0.loc30, %.loc30_37.1 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc30_40.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc30_40: = bound_method %int.snegate.loc30, %impl.elem0.loc30_40.2 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc30_40: = specific_function %Convert.bound.loc30_40, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %.loc30_40.1: Core.IntLiteral = value_of_initializer %int.snegate.loc30 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc30_40.2: Core.IntLiteral = converted %int.snegate.loc30, %.loc30_40.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc30_40: init %i32 = call %Convert.specific_fn.loc30_40(%.loc30_40.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc30_40.3: %i32 = value_of_initializer %int.convert_checked.loc30_40 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc30_40.4: %i32 = converted %int.snegate.loc30, %.loc30_40.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.right_shift.loc30: init %i32 = call %RightShift.ref.loc30(%.loc30_37.2, %.loc30_40.4) [template = ] +// CHECK:STDOUT: %.loc30_43.1: %i32 = value_of_initializer %int.right_shift.loc30 [template = ] +// CHECK:STDOUT: %.loc30_43.2: %i32 = converted %int.right_shift.loc30, %.loc30_43.1 [template = ] +// CHECK:STDOUT: %negative_zero: %i32 = bind_name negative_zero, %.loc30_43.2 +// CHECK:STDOUT: %RightShiftLit.ref.loc35: %RightShiftLit.type = name_ref RightShiftLit, file.%RightShiftLit.decl [template = constants.%RightShiftLit] +// CHECK:STDOUT: %int_1.loc35_53: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_1.loc35_57: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc35_56.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc35: = bound_method %int_1.loc35_57, %impl.elem0.loc35_56.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc35: init Core.IntLiteral = call %Op.bound.loc35(%int_1.loc35_57) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc35_56.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc35: = bound_method %int.snegate.loc35, %impl.elem0.loc35_56.2 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc35: = specific_function %Convert.bound.loc35, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %.loc35_56.1: Core.IntLiteral = value_of_initializer %int.snegate.loc35 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc35_56.2: Core.IntLiteral = converted %int.snegate.loc35, %.loc35_56.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc35: init %i32 = call %Convert.specific_fn.loc35(%.loc35_56.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc35_56.3: %i32 = value_of_initializer %int.convert_checked.loc35 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc35_56.4: %i32 = converted %int.snegate.loc35, %.loc35_56.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.right_shift.loc35: init Core.IntLiteral = call %RightShiftLit.ref.loc35(%int_1.loc35_53, %.loc35_56.4) [template = ] +// CHECK:STDOUT: %.loc35_59.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc35 [template = ] +// CHECK:STDOUT: %.loc35_59.2: Core.IntLiteral = converted %int.right_shift.loc35, %.loc35_59.1 [template = ] +// CHECK:STDOUT: %negative_lit: Core.IntLiteral = bind_name negative_lit, %.loc35_59.2 +// CHECK:STDOUT: %RightShiftLit.ref.loc39: %RightShiftLit.type = name_ref RightShiftLit, file.%RightShiftLit.decl [template = constants.%RightShiftLit] +// CHECK:STDOUT: %int_0.loc39: Core.IntLiteral = int_value 0 [template = constants.%int_0.2] +// CHECK:STDOUT: %int_1.loc39: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc39_61.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc39: = bound_method %int_1.loc39, %impl.elem0.loc39_61.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc39: init Core.IntLiteral = call %Op.bound.loc39(%int_1.loc39) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc39_61.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc39: = bound_method %int.snegate.loc39, %impl.elem0.loc39_61.2 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc39: = specific_function %Convert.bound.loc39, @Convert.2(constants.%int_32.1) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %.loc39_61.1: Core.IntLiteral = value_of_initializer %int.snegate.loc39 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc39_61.2: Core.IntLiteral = converted %int.snegate.loc39, %.loc39_61.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc39: init %i32 = call %Convert.specific_fn.loc39(%.loc39_61.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc39_61.3: %i32 = value_of_initializer %int.convert_checked.loc39 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc39_61.4: %i32 = converted %int.snegate.loc39, %.loc39_61.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.right_shift.loc39: init Core.IntLiteral = call %RightShiftLit.ref.loc39(%int_0.loc39, %.loc39_61.4) [template = ] +// CHECK:STDOUT: %.loc39_64.1: Core.IntLiteral = value_of_initializer %int.right_shift.loc39 [template = ] +// CHECK:STDOUT: %.loc39_64.2: Core.IntLiteral = converted %int.right_shift.loc39, %.loc39_64.1 [template = ] +// CHECK:STDOUT: %negative_lit_zero: Core.IntLiteral = bind_name negative_lit_zero, %.loc39_64.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 69bd1b0f5ba27..1948af5258377 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -8,17 +8,47 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/sadd.carbon -// --- int_add.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; -var arr: [i32; Add(1, 2)]; -let arr_p: [i32; 3]* = &arr; +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } + +fn F() { + Test(Add(0, 0)) as Expect(0); + Test(Add(1, 2)) as Expect(3); + Test(Add(0x7FFF_FFFE, 1)) as Expect(0x7FFF_FFFF); +} fn RuntimeCall(a: i32, b: i32) -> i32 { return Add(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Add(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Add(0, 0)) as Expect(0); + Test(Add(1, 2)) as Expect(3); + + // Test some cases that might -- but shouldn't -- overflow. + Test(Add(0x7FFF_FFFE, 1)) as Expect(0x7FFF_FFFF); + Test(Add(0x7FFF_FFFF, 1)) as Expect(0x8000_0000); + Test(Add(0x7FFF_FFFF_FFFF_FFFF, 1)) as Expect(0x8000_0000_0000_0000); + Test(Add(0xFFFF_FFFF_FFFF_FFFF, 1)) as Expect(0x1_0000_0000_0000_0000); + Test(Add(-0x8000_0000_0000_0000, -1)) as Expect(-0x8000_0000_0000_0001); + Test(Add(-0x8000_0000_0000_0000, -0x8000_0000_0000_0000)) as Expect(-0x1_0000_0000_0000_0000); +} + // --- fail_bad_decl.carbon package FailBadDecl; @@ -89,37 +119,65 @@ let a: i32 = Add(0x7FFFFFFF, 0); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ let b: i32 = Add(0x7FFFFFFF, 1); -// CHECK:STDOUT: --- int_add.carbon +// CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] // CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %N.2: %i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] // CHECK:STDOUT: %int_3.1: %i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.3, @impl.2(%int_32) [template] -// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.11) [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_3.1, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.3(%int_32) [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_3.1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_3.1) [template] // CHECK:STDOUT: %int_3.2: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_3.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_3.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2147483646.1: Core.IntLiteral = int_value 2147483646 [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_2147483646.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2147483646.2: %i32 = int_value 2147483646 [template] +// CHECK:STDOUT: %int_2147483647.1: %i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_2147483647.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_2147483647.1) [template] +// CHECK:STDOUT: %int_2147483647.2: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_2147483647.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -135,8 +193,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -148,12 +207,12 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -161,40 +220,32 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %Add.ref: %Add.type.1 = name_ref Add, %Add.decl [template = constants.%Add] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc4_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_20: = bound_method %int_1, %impl.elem0.loc4_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc4_20: = specific_function %Convert.bound.loc4_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc4_20: init %i32 = call %Convert.specific_fn.loc4_20(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc4_20.1: %i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc4_20.2: %i32 = converted %int_1, %.loc4_20.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc4_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_23: = bound_method %int_2, %impl.elem0.loc4_23 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc4_23: = specific_function %Convert.bound.loc4_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc4_23: init %i32 = call %Convert.specific_fn.loc4_23(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_23.1: %i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_23.2: %i32 = converted %int_2, %.loc4_23.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%.loc4_20.2, %.loc4_23.2) [template = constants.%int_3.1] -// CHECK:STDOUT: %impl.elem0.loc4_24: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc4_24: = bound_method %int.sadd, %impl.elem0.loc4_24 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc4_24: = specific_function %Convert.bound.loc4_24, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc4_24.1: %i32 = value_of_initializer %int.sadd [template = constants.%int_3.1] -// CHECK:STDOUT: %.loc4_24.2: %i32 = converted %int.sadd, %.loc4_24.1 [template = constants.%int_3.1] -// CHECK:STDOUT: %int.convert_checked.loc4_24: init Core.IntLiteral = call %Convert.specific_fn.loc4_24(%.loc4_24.2) [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc4_24.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_24 [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc4_24.4: Core.IntLiteral = converted %int.sadd, %.loc4_24.3 [template = constants.%int_3.2] -// CHECK:STDOUT: %array_type.loc4: type = array_type %.loc4_24.4, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %int_3, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc7_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -203,12 +254,12 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc15_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc15_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc15_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -218,27 +269,705 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: %i32) { +// CHECK:STDOUT: %N.loc6_14.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc6_14.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Add.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: %i32) { +// CHECK:STDOUT: %N.loc7_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc7_9.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc7_29.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %i32) -> %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_41.2: init @Test.%Expect.loc7_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_42: init @Test.%Expect.loc7_29.2 (%Expect.1) = converted %.loc7_41.1, %.loc7_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc10: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_0.loc10_12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc10_15: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_12: = bound_method %int_0.loc10_12, %impl.elem0.loc10_12 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_12: = specific_function %Convert.bound.loc10_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_12: init %i32 = call %Convert.specific_fn.loc10_12(%int_0.loc10_12) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_12.1: %i32 = value_of_initializer %int.convert_checked.loc10_12 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_12.2: %i32 = converted %int_0.loc10_12, %.loc10_12.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_15: = bound_method %int_0.loc10_15, %impl.elem0.loc10_15 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_15: = specific_function %Convert.bound.loc10_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_15: init %i32 = call %Convert.specific_fn.loc10_15(%int_0.loc10_15) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_15.1: %i32 = value_of_initializer %int.convert_checked.loc10_15 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_15.2: %i32 = converted %int_0.loc10_15, %.loc10_15.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.sadd.loc10: init %i32 = call %Add.ref.loc10(%.loc10_12.2, %.loc10_15.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_17.1: %i32 = value_of_initializer %int.sadd.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_17.2: %i32 = converted %int.sadd.loc10, %.loc10_17.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_29: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_30: = bound_method %int_0.loc10_29, %impl.elem0.loc10_30 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_30: = specific_function %Convert.bound.loc10_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_30: init %i32 = call %Convert.specific_fn.loc10_30(%int_0.loc10_29) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_30.1: %i32 = value_of_initializer %int.convert_checked.loc10_30 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_30.2: %i32 = converted %int_0.loc10_29, %.loc10_30.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc11: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc11_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_12: = bound_method %int_1.loc11, %impl.elem0.loc11_12 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_12: = specific_function %Convert.bound.loc11_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_12: init %i32 = call %Convert.specific_fn.loc11_12(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_12.1: %i32 = value_of_initializer %int.convert_checked.loc11_12 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_12.2: %i32 = converted %int_1.loc11, %.loc11_12.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_15: = bound_method %int_2, %impl.elem0.loc11_15 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc11_15: = specific_function %Convert.bound.loc11_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc11_15: init %i32 = call %Convert.specific_fn.loc11_15(%int_2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_15.1: %i32 = value_of_initializer %int.convert_checked.loc11_15 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc11_15.2: %i32 = converted %int_2, %.loc11_15.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.sadd.loc11: init %i32 = call %Add.ref.loc11(%.loc11_12.2, %.loc11_15.2) [template = constants.%int_3.1] +// CHECK:STDOUT: %.loc11_17.1: %i32 = value_of_initializer %int.sadd.loc11 [template = constants.%int_3.1] +// CHECK:STDOUT: %.loc11_17.2: %i32 = converted %int.sadd.loc11, %.loc11_17.1 [template = constants.%int_3.1] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_3.1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_17.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.2] +// CHECK:STDOUT: %impl.elem0.loc11_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_30: = bound_method %int_3, %impl.elem0.loc11_30 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc11_30: = specific_function %Convert.bound.loc11_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc11_30: init %i32 = call %Convert.specific_fn.loc11_30(%int_3) [template = constants.%int_3.1] +// CHECK:STDOUT: %.loc11_30.1: %i32 = value_of_initializer %int.convert_checked.loc11_30 [template = constants.%int_3.1] +// CHECK:STDOUT: %.loc11_30.2: %i32 = converted %int_3, %.loc11_30.1 [template = constants.%int_3.1] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_3.1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_17.4: ref %Expect.3 = temporary %.loc11_17.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc12: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_2147483646: Core.IntLiteral = int_value 2147483646 [template = constants.%int_2147483646.1] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_12: = bound_method %int_2147483646, %impl.elem0.loc12_12 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc12_12: = specific_function %Convert.bound.loc12_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc12_12: init %i32 = call %Convert.specific_fn.loc12_12(%int_2147483646) [template = constants.%int_2147483646.2] +// CHECK:STDOUT: %.loc12_12.1: %i32 = value_of_initializer %int.convert_checked.loc12_12 [template = constants.%int_2147483646.2] +// CHECK:STDOUT: %.loc12_12.2: %i32 = converted %int_2147483646, %.loc12_12.1 [template = constants.%int_2147483646.2] +// CHECK:STDOUT: %impl.elem0.loc12_25: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_25: = bound_method %int_1.loc12, %impl.elem0.loc12_25 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc12_25: = specific_function %Convert.bound.loc12_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc12_25: init %i32 = call %Convert.specific_fn.loc12_25(%int_1.loc12) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_25.1: %i32 = value_of_initializer %int.convert_checked.loc12_25 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_25.2: %i32 = converted %int_1.loc12, %.loc12_25.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.sadd.loc12: init %i32 = call %Add.ref.loc12(%.loc12_12.2, %.loc12_25.2) [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc12_27.1: %i32 = value_of_initializer %int.sadd.loc12 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc12_27.2: %i32 = converted %int.sadd.loc12, %.loc12_27.1 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_2147483647.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc12_27.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.4 = call %Test.specific_fn.loc12() to %.loc12_27.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc12_50: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_50: = bound_method %int_2147483647, %impl.elem0.loc12_50 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc12_50: = specific_function %Convert.bound.loc12_50, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc12_50: init %i32 = call %Convert.specific_fn.loc12_50(%int_2147483647) [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc12_50.1: %i32 = value_of_initializer %int.convert_checked.loc12_50 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %.loc12_50.2: %i32 = converted %int_2147483647, %.loc12_50.1 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_2147483647.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc12_27.4: ref %Expect.4 = temporary %.loc12_27.3, %Test.call.loc12 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Add.ref: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.sadd: init %i32 = call %Add.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.sadd -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.sadd, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 +// CHECK:STDOUT: %.loc16_19.1: %i32 = value_of_initializer %int.sadd +// CHECK:STDOUT: %.loc16_19.2: %i32 = converted %int.sadd, %.loc16_19.1 +// CHECK:STDOUT: return %.loc16_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_3.1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_3.1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_3.1 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_3.1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_3.1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_3.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647.1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647.1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Add.type.1: type = fn_type @Add.1 [template] +// CHECK:STDOUT: %Add: %Add.type.1 = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_3) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_3) [template] +// CHECK:STDOUT: %int_2147483646: Core.IntLiteral = int_value 2147483646 [template] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_2147483647) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_2147483647) [template] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_2147483648) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_2147483648) [template] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_9223372036854775808) [template] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template] +// CHECK:STDOUT: %int_18446744073709551616: Core.IntLiteral = int_value 18446744073709551616 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_18446744073709551616) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_18446744073709551616) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_9223372036854775808, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %int_-9223372036854775809: Core.IntLiteral = int_value -9223372036854775809 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_-9223372036854775809) [template] +// CHECK:STDOUT: %Test.specific_fn.7: = specific_function %Test, @Test(%int_-9223372036854775809) [template] +// CHECK:STDOUT: %int_9223372036854775809: Core.IntLiteral = int_value 9223372036854775809 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_9223372036854775809, %Op.2 [template] +// CHECK:STDOUT: %int_-18446744073709551616: Core.IntLiteral = int_value -18446744073709551616 [template] +// CHECK:STDOUT: %Expect.9: type = class_type @Expect, @Expect(%int_-18446744073709551616) [template] +// CHECK:STDOUT: %Test.specific_fn.8: = specific_function %Test, @Test(%int_-18446744073709551616) [template] +// CHECK:STDOUT: %Op.bound.4: = bound_method %int_18446744073709551616, %Op.2 [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.8: %Expect.8 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.9: %Expect.9 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Add = %Add.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Add.decl: %Add.type.1 = fn_decl @Add.1 [template = constants.%Add] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_11: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_15: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_27: init type = call %IntLiteral.ref.loc4_15() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int_literal.make_type.loc4_27 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int_literal.make_type.loc4_27, %.loc4_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_33: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_37: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_49: init type = call %IntLiteral.ref.loc4_37() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.1: type = value_of_initializer %int_literal.make_type.loc4_49 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.2: type = converted %int_literal.make_type.loc4_49, %.loc4_49.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_55: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_59: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_71: init type = call %IntLiteral.ref.loc4_59() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.1: type = value_of_initializer %int_literal.make_type.loc4_71 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.2: type = converted %int_literal.make_type.loc4_71, %.loc4_71.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Add.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.sadd"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc10: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_0.loc10_12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc10_15: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.sadd.loc10: init Core.IntLiteral = call %Add.ref.loc10(%int_0.loc10_12, %int_0.loc10_15) [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.1: Core.IntLiteral = value_of_initializer %int.sadd.loc10 [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.2: Core.IntLiteral = converted %int.sadd.loc10, %.loc10_17.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_29: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc11: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.sadd.loc11: init Core.IntLiteral = call %Add.ref.loc11(%int_1.loc11, %int_2) [template = constants.%int_3] +// CHECK:STDOUT: %.loc11_17.1: Core.IntLiteral = value_of_initializer %int.sadd.loc11 [template = constants.%int_3] +// CHECK:STDOUT: %.loc11_17.2: Core.IntLiteral = converted %int.sadd.loc11, %.loc11_17.1 [template = constants.%int_3] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_3) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_17.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_3) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_17.4: ref %Expect.3 = temporary %.loc11_17.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc14: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_2147483646: Core.IntLiteral = int_value 2147483646 [template = constants.%int_2147483646] +// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.sadd.loc14: init Core.IntLiteral = call %Add.ref.loc14(%int_2147483646, %int_1.loc14) [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc14_27.1: Core.IntLiteral = value_of_initializer %int.sadd.loc14 [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc14_27.2: Core.IntLiteral = converted %int.sadd.loc14, %.loc14_27.1 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_2147483647) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc14_27.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.4 = call %Test.specific_fn.loc14() to %.loc14_27.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc14: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_2147483647) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc14_27.4: ref %Expect.4 = temporary %.loc14_27.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc15: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_2147483647.loc15: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.sadd.loc15: init Core.IntLiteral = call %Add.ref.loc15(%int_2147483647.loc15, %int_1.loc15) [template = constants.%int_2147483648] +// CHECK:STDOUT: %.loc15_27.1: Core.IntLiteral = value_of_initializer %int.sadd.loc15 [template = constants.%int_2147483648] +// CHECK:STDOUT: %.loc15_27.2: Core.IntLiteral = converted %int.sadd.loc15, %.loc15_27.1 [template = constants.%int_2147483648] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_2147483648) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc15_27.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.5 = call %Test.specific_fn.loc15() to %.loc15_27.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_2147483648) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc15_27.4: ref %Expect.5 = temporary %.loc15_27.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc16: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc16: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [template = constants.%int_9223372036854775807] +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.sadd.loc16: init Core.IntLiteral = call %Add.ref.loc16(%int_9223372036854775807, %int_1.loc16) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc16_37.1: Core.IntLiteral = value_of_initializer %int.sadd.loc16 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc16_37.2: Core.IntLiteral = converted %int.sadd.loc16, %.loc16_37.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc16: = specific_function %Test.ref.loc16, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc16_37.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc16: init %Expect.6 = call %Test.specific_fn.loc16() to %.loc16_37.3 +// CHECK:STDOUT: %Expect.ref.loc16: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc16: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc16: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc16_37.4: ref %Expect.6 = temporary %.loc16_37.3, %Test.call.loc16 +// CHECK:STDOUT: %Test.ref.loc17: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc17: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [template = constants.%int_18446744073709551615] +// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.sadd.loc17: init Core.IntLiteral = call %Add.ref.loc17(%int_18446744073709551615, %int_1.loc17) [template = constants.%int_18446744073709551616] +// CHECK:STDOUT: %.loc17_37.1: Core.IntLiteral = value_of_initializer %int.sadd.loc17 [template = constants.%int_18446744073709551616] +// CHECK:STDOUT: %.loc17_37.2: Core.IntLiteral = converted %int.sadd.loc17, %.loc17_37.1 [template = constants.%int_18446744073709551616] +// CHECK:STDOUT: %Test.specific_fn.loc17: = specific_function %Test.ref.loc17, @Test(constants.%int_18446744073709551616) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc17_37.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc17: init %Expect.7 = call %Test.specific_fn.loc17() to %.loc17_37.3 +// CHECK:STDOUT: %Expect.ref.loc17: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_18446744073709551616.loc17: Core.IntLiteral = int_value 18446744073709551616 [template = constants.%int_18446744073709551616] +// CHECK:STDOUT: %Expect.loc17: type = class_type @Expect, @Expect(constants.%int_18446744073709551616) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc17_37.4: ref %Expect.7 = temporary %.loc17_37.3, %Test.call.loc17 +// CHECK:STDOUT: %Test.ref.loc18: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc18: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_9223372036854775808.loc18: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc18_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc18_12: = bound_method %int_9223372036854775808.loc18, %impl.elem0.loc18_12 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc18_12: init Core.IntLiteral = call %Op.bound.loc18_12(%int_9223372036854775808.loc18) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc18_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc18_36: = bound_method %int_1.loc18, %impl.elem0.loc18_36 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc18_36: init Core.IntLiteral = call %Op.bound.loc18_36(%int_1.loc18) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc18_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc18_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc18_12.2: Core.IntLiteral = converted %int.snegate.loc18_12, %.loc18_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc18_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc18_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc18_36.2: Core.IntLiteral = converted %int.snegate.loc18_36, %.loc18_36.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.sadd.loc18: init Core.IntLiteral = call %Add.ref.loc18(%.loc18_12.2, %.loc18_36.2) [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc18_39.1: Core.IntLiteral = value_of_initializer %int.sadd.loc18 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc18_39.2: Core.IntLiteral = converted %int.sadd.loc18, %.loc18_39.1 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %Test.specific_fn.loc18: = specific_function %Test.ref.loc18, @Test(constants.%int_-9223372036854775809) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc18_39.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc18: init %Expect.8 = call %Test.specific_fn.loc18() to %.loc18_39.3 +// CHECK:STDOUT: %Expect.ref.loc18: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775809: Core.IntLiteral = int_value 9223372036854775809 [template = constants.%int_9223372036854775809] +// CHECK:STDOUT: %impl.elem0.loc18_51: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc18_51: = bound_method %int_9223372036854775809, %impl.elem0.loc18_51 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc18_51: init Core.IntLiteral = call %Op.bound.loc18_51(%int_9223372036854775809) [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc18_73.1: Core.IntLiteral = value_of_initializer %int.snegate.loc18_51 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %.loc18_73.2: Core.IntLiteral = converted %int.snegate.loc18_51, %.loc18_73.1 [template = constants.%int_-9223372036854775809] +// CHECK:STDOUT: %Expect.loc18: type = class_type @Expect, @Expect(constants.%int_-9223372036854775809) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc18_39.4: ref %Expect.8 = temporary %.loc18_39.3, %Test.call.loc18 +// CHECK:STDOUT: %Test.ref.loc19: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Add.ref.loc19: %Add.type.1 = name_ref Add, file.%Add.decl [template = constants.%Add] +// CHECK:STDOUT: %int_9223372036854775808.loc19_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc19_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_12: = bound_method %int_9223372036854775808.loc19_13, %impl.elem0.loc19_12 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc19_12: init Core.IntLiteral = call %Op.bound.loc19_12(%int_9223372036854775808.loc19_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_9223372036854775808.loc19_37: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc19_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_36: = bound_method %int_9223372036854775808.loc19_37, %impl.elem0.loc19_36 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc19_36: init Core.IntLiteral = call %Op.bound.loc19_36(%int_9223372036854775808.loc19_37) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_12.2: Core.IntLiteral = converted %int.snegate.loc19_12, %.loc19_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_36 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_36.2: Core.IntLiteral = converted %int.snegate.loc19_36, %.loc19_36.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.sadd.loc19: init Core.IntLiteral = call %Add.ref.loc19(%.loc19_12.2, %.loc19_36.2) [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %.loc19_59.1: Core.IntLiteral = value_of_initializer %int.sadd.loc19 [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %.loc19_59.2: Core.IntLiteral = converted %int.sadd.loc19, %.loc19_59.1 [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %Test.specific_fn.loc19: = specific_function %Test.ref.loc19, @Test(constants.%int_-18446744073709551616) [template = constants.%Test.specific_fn.8] +// CHECK:STDOUT: %.loc19_59.3: ref %Expect.9 = temporary_storage +// CHECK:STDOUT: %Test.call.loc19: init %Expect.9 = call %Test.specific_fn.loc19() to %.loc19_59.3 +// CHECK:STDOUT: %Expect.ref.loc19: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_18446744073709551616.loc19: Core.IntLiteral = int_value 18446744073709551616 [template = constants.%int_18446744073709551616] +// CHECK:STDOUT: %impl.elem0.loc19_71: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_71: = bound_method %int_18446744073709551616.loc19, %impl.elem0.loc19_71 [template = constants.%Op.bound.4] +// CHECK:STDOUT: %int.snegate.loc19_71: init Core.IntLiteral = call %Op.bound.loc19_71(%int_18446744073709551616.loc19) [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %.loc19_95.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_71 [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %.loc19_95.2: Core.IntLiteral = converted %int.snegate.loc19_71, %.loc19_95.1 [template = constants.%int_-18446744073709551616] +// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_-18446744073709551616) [template = constants.%Expect.9] +// CHECK:STDOUT: %.loc19_59.4: ref %Expect.9 = temporary %.loc19_59.3, %Test.call.loc19 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_3) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_3 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_3 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_3) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_3 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483648) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483648 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483648 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483648) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483648 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483648 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_18446744073709551616) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_18446744073709551616 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_18446744073709551616 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_18446744073709551616) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_18446744073709551616 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_18446744073709551616 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-9223372036854775809) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-9223372036854775809) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-9223372036854775809 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-18446744073709551616) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-18446744073709551616 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-18446744073709551616 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.9 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-18446744073709551616) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-18446744073709551616 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-18446744073709551616 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 67f3241745af9..133d3fb1a99ae 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -8,17 +8,55 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/smul.carbon -// --- int_mul.carbon +// --- i32.carbon + +library "[[@TEST_NAME]]"; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; -var arr: [i32; Mul(3, 2)]; -let arr_p: [i32; 6]* = &arr; +class Expect(N:! i32) {} +fn Test(N:! i32) -> Expect(N) { return {}; } + +fn F() { + Test(Mul(0, 0)) as Expect(0); + Test(Mul(0, 3)) as Expect(0); + Test(Mul(1, 2)) as Expect(2); + Test(Mul(3, 2)) as Expect(6); + Test(Mul(0x7FFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(Mul(0x7FFF_FFFF, -1)) as Expect(-0x7FFF_FFFF); +} fn RuntimeCall(a: i32, b: i32) -> i32 { return Mul(a, b); } +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Mul(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.smul"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Mul(0, 0)) as Expect(0); + Test(Mul(0, 3)) as Expect(0); + Test(Mul(1, 2)) as Expect(2); + Test(Mul(3, 2)) as Expect(6); + Test(Mul(0x7FFF_FFFF, 1)) as Expect(0x7FFF_FFFF); + Test(Mul(0x7FFF_FFFF, -1)) as Expect(-0x7FFF_FFFF); + + // Test some cases that might -- but shouldn't -- overflow. + Test(Mul(0x8000_0000_0000_0000, 1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(0x8000_0000_0000_0000, -1)) as Expect(-0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, 1)) as Expect(-0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); + Test(Mul(-0x8000_0000_0000_0000, -0x8000_0000_0000_0000)) + as Expect(0x4000_0000_0000_0000_0000_0000_0000_0000); +} + // --- fail_overflow.carbon package FailOverflow; @@ -31,43 +69,92 @@ let a: i32 = Mul(0x7FFF, 0x10000); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ let b: i32 = Mul(0x8000, 0x10000); -// CHECK:STDOUT: --- int_mul.carbon +// CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] // CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] -// CHECK:STDOUT: %int_3.1: Core.IntLiteral = int_value 3 [template] -// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %N.2: %i32 = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt.2: %i32 = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N.2) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete.2: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] // CHECK:STDOUT: %interface.5: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_3.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_3.2: %i32 = int_value 3 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0.2) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0.2) [template] +// CHECK:STDOUT: %int_3.1: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_3.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_3.2: %i32 = int_value 3 [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_2.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_2.2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_2.2) [template] // CHECK:STDOUT: %int_6.1: %i32 = int_value 6 [template] -// CHECK:STDOUT: %Convert.type.11: type = fn_type @Convert.3, @impl.2(%int_32) [template] -// CHECK:STDOUT: %Convert.11: %Convert.type.11 = struct_value () [template] -// CHECK:STDOUT: %interface.6: = interface_witness (%Convert.11) [template] -// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_6.1, %Convert.11 [template] -// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.3(%int_32) [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_6.1) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_6.1) [template] // CHECK:STDOUT: %int_6.2: Core.IntLiteral = int_value 6 [template] -// CHECK:STDOUT: %array_type: type = array_type %int_6.2, %i32 [template] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template] +// CHECK:STDOUT: %Convert.bound.5: = bound_method %int_6.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.5: = specific_function %Convert.bound.5, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Convert.bound.6: = bound_method %int_2147483647.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.6: = specific_function %Convert.bound.6, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_2147483647.2) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_2147483647.2) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Convert.bound.7: = bound_method %int_-1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.7: = specific_function %Convert.bound.7, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_-2147483647.1: %i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_-2147483647.1) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_-2147483647.1) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2147483647.1, %Op.2 [template] +// CHECK:STDOUT: %int_-2147483647.2: Core.IntLiteral = int_value -2147483647 [template] +// CHECK:STDOUT: %Convert.bound.8: = bound_method %int_-2147483647.2, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.8: = specific_function %Convert.bound.8, @Convert.2(%int_32) [template] // CHECK:STDOUT: %RuntimeCall.type: type = fn_type @RuntimeCall [template] // CHECK:STDOUT: %RuntimeCall: %RuntimeCall.type = struct_value () [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -77,8 +164,9 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Mul = %Mul.decl -// CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .arr_p = @__global_init.%arr_p +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core @@ -90,12 +178,12 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc2_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc2_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc2_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_11: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_11: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc4_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc4_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -103,40 +191,32 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %Mul.ref: %Mul.type.1 = name_ref Mul, %Mul.decl [template = constants.%Mul] -// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] -// CHECK:STDOUT: %impl.elem0.loc4_20: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_20: = bound_method %int_3, %impl.elem0.loc4_20 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc4_20: = specific_function %Convert.bound.loc4_20, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc4_20: init %i32 = call %Convert.specific_fn.loc4_20(%int_3) [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc4_20.1: %i32 = value_of_initializer %int.convert_checked.loc4_20 [template = constants.%int_3.2] -// CHECK:STDOUT: %.loc4_20.2: %i32 = converted %int_3, %.loc4_20.1 [template = constants.%int_3.2] -// CHECK:STDOUT: %impl.elem0.loc4_23: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc4_23: = bound_method %int_2, %impl.elem0.loc4_23 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc4_23: = specific_function %Convert.bound.loc4_23, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc4_23: init %i32 = call %Convert.specific_fn.loc4_23(%int_2) [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_23.1: %i32 = value_of_initializer %int.convert_checked.loc4_23 [template = constants.%int_2.2] -// CHECK:STDOUT: %.loc4_23.2: %i32 = converted %int_2, %.loc4_23.1 [template = constants.%int_2.2] -// CHECK:STDOUT: %int.smul: init %i32 = call %Mul.ref(%.loc4_20.2, %.loc4_23.2) [template = constants.%int_6.1] -// CHECK:STDOUT: %impl.elem0.loc4_24: %Convert.type.5 = interface_witness_access constants.%interface.6, element0 [template = constants.%Convert.11] -// CHECK:STDOUT: %Convert.bound.loc4_24: = bound_method %int.smul, %impl.elem0.loc4_24 [template = constants.%Convert.bound.3] -// CHECK:STDOUT: %Convert.specific_fn.loc4_24: = specific_function %Convert.bound.loc4_24, @Convert.3(constants.%int_32) [template = constants.%Convert.specific_fn.3] -// CHECK:STDOUT: %.loc4_24.1: %i32 = value_of_initializer %int.smul [template = constants.%int_6.1] -// CHECK:STDOUT: %.loc4_24.2: %i32 = converted %int.smul, %.loc4_24.1 [template = constants.%int_6.1] -// CHECK:STDOUT: %int.convert_checked.loc4_24: init Core.IntLiteral = call %Convert.specific_fn.loc4_24(%.loc4_24.2) [template = constants.%int_6.2] -// CHECK:STDOUT: %.loc4_24.3: Core.IntLiteral = value_of_initializer %int.convert_checked.loc4_24 [template = constants.%int_6.2] -// CHECK:STDOUT: %.loc4_24.4: Core.IntLiteral = converted %int.smul, %.loc4_24.3 [template = constants.%int_6.2] -// CHECK:STDOUT: %array_type.loc4: type = array_type %.loc4_24.4, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %arr.var: ref %array_type = var arr -// CHECK:STDOUT: %arr: ref %array_type = bind_name arr, %arr.var -// CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6.2] -// CHECK:STDOUT: %array_type.loc5: type = array_type %int_6, %i32 [template = constants.%array_type] -// CHECK:STDOUT: %ptr: type = ptr_type %array_type [template = constants.%ptr] +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %Expect.loc7_29.1: type = class_type @Expect, @Expect(constants.%N.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: %i32 = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_29.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_29.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} // CHECK:STDOUT: %RuntimeCall.decl: %RuntimeCall.type = fn_decl @RuntimeCall [template = constants.%RuntimeCall] { // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 @@ -145,12 +225,12 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 @@ -160,27 +240,925 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: %i32) { +// CHECK:STDOUT: %N.loc6_14.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc6_14.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Mul.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.smul"; // CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: %i32) { +// CHECK:STDOUT: %N.loc7_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N.2)] +// CHECK:STDOUT: %N.patt.loc7_9.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt.2)] +// CHECK:STDOUT: %Expect.loc7_29.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_29.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_29.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_29.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: %i32) -> %return.param_patt: @Test.%Expect.loc7_29.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_41.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_41.2: init @Test.%Expect.loc7_29.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_42: init @Test.%Expect.loc7_29.2 (%Expect.1) = converted %.loc7_41.1, %.loc7_41.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_42 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc10: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_0.loc10_12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc10_15: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_12: = bound_method %int_0.loc10_12, %impl.elem0.loc10_12 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_12: = specific_function %Convert.bound.loc10_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_12: init %i32 = call %Convert.specific_fn.loc10_12(%int_0.loc10_12) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_12.1: %i32 = value_of_initializer %int.convert_checked.loc10_12 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_12.2: %i32 = converted %int_0.loc10_12, %.loc10_12.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc10_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_15: = bound_method %int_0.loc10_15, %impl.elem0.loc10_15 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_15: = specific_function %Convert.bound.loc10_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_15: init %i32 = call %Convert.specific_fn.loc10_15(%int_0.loc10_15) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_15.1: %i32 = value_of_initializer %int.convert_checked.loc10_15 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_15.2: %i32 = converted %int_0.loc10_15, %.loc10_15.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.smul.loc10: init %i32 = call %Mul.ref.loc10(%.loc10_12.2, %.loc10_15.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_17.1: %i32 = value_of_initializer %int.smul.loc10 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_17.2: %i32 = converted %int.smul.loc10, %.loc10_17.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_29: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc10_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc10_30: = bound_method %int_0.loc10_29, %impl.elem0.loc10_30 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc10_30: = specific_function %Convert.bound.loc10_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc10_30: init %i32 = call %Convert.specific_fn.loc10_30(%int_0.loc10_29) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_30.1: %i32 = value_of_initializer %int.convert_checked.loc10_30 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc10_30.2: %i32 = converted %int_0.loc10_29, %.loc10_30.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc11: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_0.loc11_12: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_3.loc11: Core.IntLiteral = int_value 3 [template = constants.%int_3.1] +// CHECK:STDOUT: %impl.elem0.loc11_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_12: = bound_method %int_0.loc11_12, %impl.elem0.loc11_12 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_12: = specific_function %Convert.bound.loc11_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_12: init %i32 = call %Convert.specific_fn.loc11_12(%int_0.loc11_12) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_12.1: %i32 = value_of_initializer %int.convert_checked.loc11_12 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_12.2: %i32 = converted %int_0.loc11_12, %.loc11_12.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc11_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_15: = bound_method %int_3.loc11, %impl.elem0.loc11_15 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_15: = specific_function %Convert.bound.loc11_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_15: init %i32 = call %Convert.specific_fn.loc11_15(%int_3.loc11) [template = constants.%int_3.2] +// CHECK:STDOUT: %.loc11_15.1: %i32 = value_of_initializer %int.convert_checked.loc11_15 [template = constants.%int_3.2] +// CHECK:STDOUT: %.loc11_15.2: %i32 = converted %int_3.loc11, %.loc11_15.1 [template = constants.%int_3.2] +// CHECK:STDOUT: %int.smul.loc11: init %i32 = call %Mul.ref.loc11(%.loc11_12.2, %.loc11_15.2) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_17.1: %i32 = value_of_initializer %int.smul.loc11 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_17.2: %i32 = converted %int.smul.loc11, %.loc11_17.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0.2) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_17.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11_29: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_30: = bound_method %int_0.loc11_29, %impl.elem0.loc11_30 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_30: = specific_function %Convert.bound.loc11_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_30: init %i32 = call %Convert.specific_fn.loc11_30(%int_0.loc11_29) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_30.1: %i32 = value_of_initializer %int.convert_checked.loc11_30 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_30.2: %i32 = converted %int_0.loc11_29, %.loc11_30.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0.2) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_17.4: ref %Expect.2 = temporary %.loc11_17.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc12: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_2.loc12_15: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc12_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_12: = bound_method %int_1.loc12, %impl.elem0.loc12_12 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_12: = specific_function %Convert.bound.loc12_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc12_12: init %i32 = call %Convert.specific_fn.loc12_12(%int_1.loc12) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_12.1: %i32 = value_of_initializer %int.convert_checked.loc12_12 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_12.2: %i32 = converted %int_1.loc12, %.loc12_12.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc12_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_15: = bound_method %int_2.loc12_15, %impl.elem0.loc12_15 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc12_15: = specific_function %Convert.bound.loc12_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc12_15: init %i32 = call %Convert.specific_fn.loc12_15(%int_2.loc12_15) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_15.1: %i32 = value_of_initializer %int.convert_checked.loc12_15 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_15.2: %i32 = converted %int_2.loc12_15, %.loc12_15.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.smul.loc12: init %i32 = call %Mul.ref.loc12(%.loc12_12.2, %.loc12_15.2) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_17.1: %i32 = value_of_initializer %int.smul.loc12 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_17.2: %i32 = converted %int.smul.loc12, %.loc12_17.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_2.2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_17.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2.loc12_29: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc12_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_30: = bound_method %int_2.loc12_29, %impl.elem0.loc12_30 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc12_30: = specific_function %Convert.bound.loc12_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc12_30: init %i32 = call %Convert.specific_fn.loc12_30(%int_2.loc12_29) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_30.1: %i32 = value_of_initializer %int.convert_checked.loc12_30 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc12_30.2: %i32 = converted %int_2.loc12_29, %.loc12_30.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_2.2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_17.4: ref %Expect.3 = temporary %.loc12_17.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc13: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_3.loc13: Core.IntLiteral = int_value 3 [template = constants.%int_3.1] +// CHECK:STDOUT: %int_2.loc13: Core.IntLiteral = int_value 2 [template = constants.%int_2.1] +// CHECK:STDOUT: %impl.elem0.loc13_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_12: = bound_method %int_3.loc13, %impl.elem0.loc13_12 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc13_12: = specific_function %Convert.bound.loc13_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc13_12: init %i32 = call %Convert.specific_fn.loc13_12(%int_3.loc13) [template = constants.%int_3.2] +// CHECK:STDOUT: %.loc13_12.1: %i32 = value_of_initializer %int.convert_checked.loc13_12 [template = constants.%int_3.2] +// CHECK:STDOUT: %.loc13_12.2: %i32 = converted %int_3.loc13, %.loc13_12.1 [template = constants.%int_3.2] +// CHECK:STDOUT: %impl.elem0.loc13_15: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_15: = bound_method %int_2.loc13, %impl.elem0.loc13_15 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc13_15: = specific_function %Convert.bound.loc13_15, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc13_15: init %i32 = call %Convert.specific_fn.loc13_15(%int_2.loc13) [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_15.1: %i32 = value_of_initializer %int.convert_checked.loc13_15 [template = constants.%int_2.2] +// CHECK:STDOUT: %.loc13_15.2: %i32 = converted %int_2.loc13, %.loc13_15.1 [template = constants.%int_2.2] +// CHECK:STDOUT: %int.smul.loc13: init %i32 = call %Mul.ref.loc13(%.loc13_12.2, %.loc13_15.2) [template = constants.%int_6.1] +// CHECK:STDOUT: %.loc13_17.1: %i32 = value_of_initializer %int.smul.loc13 [template = constants.%int_6.1] +// CHECK:STDOUT: %.loc13_17.2: %i32 = converted %int.smul.loc13, %.loc13_17.1 [template = constants.%int_6.1] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_6.1) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc13_17.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.4 = call %Test.specific_fn.loc13() to %.loc13_17.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6.2] +// CHECK:STDOUT: %impl.elem0.loc13_30: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc13_30: = bound_method %int_6, %impl.elem0.loc13_30 [template = constants.%Convert.bound.5] +// CHECK:STDOUT: %Convert.specific_fn.loc13_30: = specific_function %Convert.bound.loc13_30, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.5] +// CHECK:STDOUT: %int.convert_checked.loc13_30: init %i32 = call %Convert.specific_fn.loc13_30(%int_6) [template = constants.%int_6.1] +// CHECK:STDOUT: %.loc13_30.1: %i32 = value_of_initializer %int.convert_checked.loc13_30 [template = constants.%int_6.1] +// CHECK:STDOUT: %.loc13_30.2: %i32 = converted %int_6, %.loc13_30.1 [template = constants.%int_6.1] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_6.1) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc13_17.4: ref %Expect.4 = temporary %.loc13_17.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc14: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_2147483647.loc14_12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc14_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_12: = bound_method %int_2147483647.loc14_12, %impl.elem0.loc14_12 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc14_12: = specific_function %Convert.bound.loc14_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc14_12: init %i32 = call %Convert.specific_fn.loc14_12(%int_2147483647.loc14_12) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_12.1: %i32 = value_of_initializer %int.convert_checked.loc14_12 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_12.2: %i32 = converted %int_2147483647.loc14_12, %.loc14_12.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc14_25: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_25: = bound_method %int_1.loc14, %impl.elem0.loc14_25 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc14_25: = specific_function %Convert.bound.loc14_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %int.convert_checked.loc14_25: init %i32 = call %Convert.specific_fn.loc14_25(%int_1.loc14) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_25.1: %i32 = value_of_initializer %int.convert_checked.loc14_25 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc14_25.2: %i32 = converted %int_1.loc14, %.loc14_25.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.smul.loc14: init %i32 = call %Mul.ref.loc14(%.loc14_12.2, %.loc14_25.2) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_27.1: %i32 = value_of_initializer %int.smul.loc14 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_27.2: %i32 = converted %int.smul.loc14, %.loc14_27.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_2147483647.2) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc14_27.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.5 = call %Test.specific_fn.loc14() to %.loc14_27.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc14_39: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc14_50: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14_50: = bound_method %int_2147483647.loc14_39, %impl.elem0.loc14_50 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc14_50: = specific_function %Convert.bound.loc14_50, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc14_50: init %i32 = call %Convert.specific_fn.loc14_50(%int_2147483647.loc14_39) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_50.1: %i32 = value_of_initializer %int.convert_checked.loc14_50 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc14_50.2: %i32 = converted %int_2147483647.loc14_39, %.loc14_50.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_2147483647.2) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc14_27.4: ref %Expect.5 = temporary %.loc14_27.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc15: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_2147483647.loc15_12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc15_25.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_25: = bound_method %int_1.loc15, %impl.elem0.loc15_25.1 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_25: init Core.IntLiteral = call %Op.bound.loc15_25(%int_1.loc15) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc15_12: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_12: = bound_method %int_2147483647.loc15_12, %impl.elem0.loc15_12 [template = constants.%Convert.bound.6] +// CHECK:STDOUT: %Convert.specific_fn.loc15_12: = specific_function %Convert.bound.loc15_12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.6] +// CHECK:STDOUT: %int.convert_checked.loc15_12: init %i32 = call %Convert.specific_fn.loc15_12(%int_2147483647.loc15_12) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc15_12.1: %i32 = value_of_initializer %int.convert_checked.loc15_12 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc15_12.2: %i32 = converted %int_2147483647.loc15_12, %.loc15_12.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc15_25.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_25: = bound_method %int.snegate.loc15_25, %impl.elem0.loc15_25.2 [template = constants.%Convert.bound.7] +// CHECK:STDOUT: %Convert.specific_fn.loc15_25: = specific_function %Convert.bound.loc15_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.7] +// CHECK:STDOUT: %.loc15_25.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_25 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc15_25.2: Core.IntLiteral = converted %int.snegate.loc15_25, %.loc15_25.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc15_25: init %i32 = call %Convert.specific_fn.loc15_25(%.loc15_25.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_25.3: %i32 = value_of_initializer %int.convert_checked.loc15_25 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc15_25.4: %i32 = converted %int.snegate.loc15_25, %.loc15_25.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.smul.loc15: init %i32 = call %Mul.ref.loc15(%.loc15_12.2, %.loc15_25.4) [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %.loc15_28.1: %i32 = value_of_initializer %int.smul.loc15 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %.loc15_28.2: %i32 = converted %int.smul.loc15, %.loc15_28.1 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-2147483647.1) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc15_28.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.6 = call %Test.specific_fn.loc15() to %.loc15_28.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc15_41: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc15_40: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_40: = bound_method %int_2147483647.loc15_41, %impl.elem0.loc15_40 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc15_40: init Core.IntLiteral = call %Op.bound.loc15_40(%int_2147483647.loc15_41) [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc15_52: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc15_52: = bound_method %int.snegate.loc15_40, %impl.elem0.loc15_52 [template = constants.%Convert.bound.8] +// CHECK:STDOUT: %Convert.specific_fn.loc15_52: = specific_function %Convert.bound.loc15_52, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.8] +// CHECK:STDOUT: %.loc15_40.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_40 [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %.loc15_40.2: Core.IntLiteral = converted %int.snegate.loc15_40, %.loc15_40.1 [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %int.convert_checked.loc15_52: init %i32 = call %Convert.specific_fn.loc15_52(%.loc15_40.2) [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %.loc15_52.1: %i32 = value_of_initializer %int.convert_checked.loc15_52 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %.loc15_52.2: %i32 = converted %int.snegate.loc15_40, %.loc15_52.1 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-2147483647.1) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc15_28.4: ref %Expect.6 = temporary %.loc15_28.3, %Test.call.loc15 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Mul.ref: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %int.smul: init %i32 = call %Mul.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc8_19.1: %i32 = value_of_initializer %int.smul -// CHECK:STDOUT: %.loc8_19.2: %i32 = converted %int.smul, %.loc8_19.1 -// CHECK:STDOUT: return %.loc8_19.2 +// CHECK:STDOUT: %.loc19_19.1: %i32 = value_of_initializer %int.smul +// CHECK:STDOUT: %.loc19_19.2: %i32 = converted %int.smul, %.loc19_19.1 +// CHECK:STDOUT: return %.loc19_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @__global_init() { +// CHECK:STDOUT: specific @Expect(constants.%N.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_6.1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_6.1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_6.1 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_6.1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_6.1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_6.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647.2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647.2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-2147483647.1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-2147483647.1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-2147483647.1 +// CHECK:STDOUT: %Expect.loc7_29.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-2147483647.1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-2147483647.1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-2147483647.1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Mul.type.1: type = fn_type @Mul.1 [template] +// CHECK:STDOUT: %Mul: %Mul.type.1 = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] +// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_2) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_2) [template] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_6) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_6) [template] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Expect.5: type = class_type @Expect, @Expect(%int_2147483647) [template] +// CHECK:STDOUT: %Test.specific_fn.4: = specific_function %Test, @Test(%int_2147483647) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %int_-2147483647: Core.IntLiteral = int_value -2147483647 [template] +// CHECK:STDOUT: %Expect.6: type = class_type @Expect, @Expect(%int_-2147483647) [template] +// CHECK:STDOUT: %Test.specific_fn.5: = specific_function %Test, @Test(%int_-2147483647) [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_2147483647, %Op.2 [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Expect.7: type = class_type @Expect, @Expect(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.6: = specific_function %Test, @Test(%int_9223372036854775808) [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Expect.8: type = class_type @Expect, @Expect(%int_-9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.7: = specific_function %Test, @Test(%int_-9223372036854775808) [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_9223372036854775808, %Op.2 [template] +// CHECK:STDOUT: %int_85070591730234615865843651857942052864: Core.IntLiteral = int_value 85070591730234615865843651857942052864 [template] +// CHECK:STDOUT: %Expect.9: type = class_type @Expect, @Expect(%int_85070591730234615865843651857942052864) [template] +// CHECK:STDOUT: %Test.specific_fn.8: = specific_function %Test, @Test(%int_85070591730234615865843651857942052864) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.5: %Expect.5 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.6: %Expect.6 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.7: %Expect.7 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.8: %Expect.8 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.9: %Expect.9 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Mul = %Mul.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Mul.decl: %Mul.type.1 = fn_decl @Mul.1 [template = constants.%Mul] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_11: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_15: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_27: init type = call %IntLiteral.ref.loc4_15() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int_literal.make_type.loc4_27 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int_literal.make_type.loc4_27, %.loc4_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_33: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_37: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_49: init type = call %IntLiteral.ref.loc4_37() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.1: type = value_of_initializer %int_literal.make_type.loc4_49 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.2: type = converted %int_literal.make_type.loc4_49, %.loc4_49.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_55: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_59: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_71: init type = call %IntLiteral.ref.loc4_59() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.1: type = value_of_initializer %int_literal.make_type.loc4_71 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.2: type = converted %int_literal.make_type.loc4_71, %.loc4_71.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Mul.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.smul"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %arr.ref: ref %array_type = name_ref arr, file.%arr -// CHECK:STDOUT: %addr: %ptr = addr_of %arr.ref -// CHECK:STDOUT: %arr_p: %ptr = bind_name arr_p, %addr +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc10: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_0.loc10_12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_0.loc10_15: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.smul.loc10: init Core.IntLiteral = call %Mul.ref.loc10(%int_0.loc10_12, %int_0.loc10_15) [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.1: Core.IntLiteral = value_of_initializer %int.smul.loc10 [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.2: Core.IntLiteral = converted %int.smul.loc10, %.loc10_17.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_29: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc11: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_0.loc11_12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_3.loc11: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %int.smul.loc11: init Core.IntLiteral = call %Mul.ref.loc11(%int_0.loc11_12, %int_3.loc11) [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_17.1: Core.IntLiteral = value_of_initializer %int.smul.loc11 [template = constants.%int_0] +// CHECK:STDOUT: %.loc11_17.2: Core.IntLiteral = converted %int.smul.loc11, %.loc11_17.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc11_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.2 = call %Test.specific_fn.loc11() to %.loc11_17.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11_29: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc11_17.4: ref %Expect.2 = temporary %.loc11_17.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc12: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_2.loc12_15: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.smul.loc12: init Core.IntLiteral = call %Mul.ref.loc12(%int_1.loc12, %int_2.loc12_15) [template = constants.%int_2] +// CHECK:STDOUT: %.loc12_17.1: Core.IntLiteral = value_of_initializer %int.smul.loc12 [template = constants.%int_2] +// CHECK:STDOUT: %.loc12_17.2: Core.IntLiteral = converted %int.smul.loc12, %.loc12_17.1 [template = constants.%int_2] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_2) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc12_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.3 = call %Test.specific_fn.loc12() to %.loc12_17.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2.loc12_29: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_2) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc12_17.4: ref %Expect.3 = temporary %.loc12_17.3, %Test.call.loc12 +// CHECK:STDOUT: %Test.ref.loc13: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc13: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_3.loc13: Core.IntLiteral = int_value 3 [template = constants.%int_3] +// CHECK:STDOUT: %int_2.loc13: Core.IntLiteral = int_value 2 [template = constants.%int_2] +// CHECK:STDOUT: %int.smul.loc13: init Core.IntLiteral = call %Mul.ref.loc13(%int_3.loc13, %int_2.loc13) [template = constants.%int_6] +// CHECK:STDOUT: %.loc13_17.1: Core.IntLiteral = value_of_initializer %int.smul.loc13 [template = constants.%int_6] +// CHECK:STDOUT: %.loc13_17.2: Core.IntLiteral = converted %int.smul.loc13, %.loc13_17.1 [template = constants.%int_6] +// CHECK:STDOUT: %Test.specific_fn.loc13: = specific_function %Test.ref.loc13, @Test(constants.%int_6) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc13_17.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc13: init %Expect.4 = call %Test.specific_fn.loc13() to %.loc13_17.3 +// CHECK:STDOUT: %Expect.ref.loc13: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [template = constants.%int_6] +// CHECK:STDOUT: %Expect.loc13: type = class_type @Expect, @Expect(constants.%int_6) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc13_17.4: ref %Expect.4 = temporary %.loc13_17.3, %Test.call.loc13 +// CHECK:STDOUT: %Test.ref.loc14: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc14: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_2147483647.loc14_12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.smul.loc14: init Core.IntLiteral = call %Mul.ref.loc14(%int_2147483647.loc14_12, %int_1.loc14) [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc14_27.1: Core.IntLiteral = value_of_initializer %int.smul.loc14 [template = constants.%int_2147483647] +// CHECK:STDOUT: %.loc14_27.2: Core.IntLiteral = converted %int.smul.loc14, %.loc14_27.1 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Test.specific_fn.loc14: = specific_function %Test.ref.loc14, @Test(constants.%int_2147483647) [template = constants.%Test.specific_fn.4] +// CHECK:STDOUT: %.loc14_27.3: ref %Expect.5 = temporary_storage +// CHECK:STDOUT: %Test.call.loc14: init %Expect.5 = call %Test.specific_fn.loc14() to %.loc14_27.3 +// CHECK:STDOUT: %Expect.ref.loc14: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc14_39: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %Expect.loc14: type = class_type @Expect, @Expect(constants.%int_2147483647) [template = constants.%Expect.5] +// CHECK:STDOUT: %.loc14_27.4: ref %Expect.5 = temporary %.loc14_27.3, %Test.call.loc14 +// CHECK:STDOUT: %Test.ref.loc15: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc15: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_2147483647.loc15_12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc15_25: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_25: = bound_method %int_1.loc15, %impl.elem0.loc15_25 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc15_25: init Core.IntLiteral = call %Op.bound.loc15_25(%int_1.loc15) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_25.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_25 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc15_25.2: Core.IntLiteral = converted %int.snegate.loc15_25, %.loc15_25.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.smul.loc15: init Core.IntLiteral = call %Mul.ref.loc15(%int_2147483647.loc15_12, %.loc15_25.2) [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc15_28.1: Core.IntLiteral = value_of_initializer %int.smul.loc15 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc15_28.2: Core.IntLiteral = converted %int.smul.loc15, %.loc15_28.1 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %Test.specific_fn.loc15: = specific_function %Test.ref.loc15, @Test(constants.%int_-2147483647) [template = constants.%Test.specific_fn.5] +// CHECK:STDOUT: %.loc15_28.3: ref %Expect.6 = temporary_storage +// CHECK:STDOUT: %Test.call.loc15: init %Expect.6 = call %Test.specific_fn.loc15() to %.loc15_28.3 +// CHECK:STDOUT: %Expect.ref.loc15: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483647.loc15_41: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647] +// CHECK:STDOUT: %impl.elem0.loc15_40: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc15_40: = bound_method %int_2147483647.loc15_41, %impl.elem0.loc15_40 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc15_40: init Core.IntLiteral = call %Op.bound.loc15_40(%int_2147483647.loc15_41) [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc15_52.1: Core.IntLiteral = value_of_initializer %int.snegate.loc15_40 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc15_52.2: Core.IntLiteral = converted %int.snegate.loc15_40, %.loc15_52.1 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %Expect.loc15: type = class_type @Expect, @Expect(constants.%int_-2147483647) [template = constants.%Expect.6] +// CHECK:STDOUT: %.loc15_28.4: ref %Expect.6 = temporary %.loc15_28.3, %Test.call.loc15 +// CHECK:STDOUT: %Test.ref.loc18: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc18: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc18_12: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int_1.loc18: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.smul.loc18: init Core.IntLiteral = call %Mul.ref.loc18(%int_9223372036854775808.loc18_12, %int_1.loc18) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc18_37.1: Core.IntLiteral = value_of_initializer %int.smul.loc18 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc18_37.2: Core.IntLiteral = converted %int.smul.loc18, %.loc18_37.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc18: = specific_function %Test.ref.loc18, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc18_37.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc18: init %Expect.7 = call %Test.specific_fn.loc18() to %.loc18_37.3 +// CHECK:STDOUT: %Expect.ref.loc18: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc18_49: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc18: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc18_37.4: ref %Expect.7 = temporary %.loc18_37.3, %Test.call.loc18 +// CHECK:STDOUT: %Test.ref.loc19: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc19: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc19_12: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc19_35: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_35: = bound_method %int_1.loc19, %impl.elem0.loc19_35 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc19_35: init Core.IntLiteral = call %Op.bound.loc19_35(%int_1.loc19) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc19_35.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_35 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc19_35.2: Core.IntLiteral = converted %int.snegate.loc19_35, %.loc19_35.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.smul.loc19: init Core.IntLiteral = call %Mul.ref.loc19(%int_9223372036854775808.loc19_12, %.loc19_35.2) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_38.1: Core.IntLiteral = value_of_initializer %int.smul.loc19 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_38.2: Core.IntLiteral = converted %int.smul.loc19, %.loc19_38.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc19: = specific_function %Test.ref.loc19, @Test(constants.%int_-9223372036854775808) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc19_38.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc19: init %Expect.8 = call %Test.specific_fn.loc19() to %.loc19_38.3 +// CHECK:STDOUT: %Expect.ref.loc19: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc19_51: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc19_50: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_50: = bound_method %int_9223372036854775808.loc19_51, %impl.elem0.loc19_50 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc19_50: init Core.IntLiteral = call %Op.bound.loc19_50(%int_9223372036854775808.loc19_51) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_72.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_50 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc19_72.2: Core.IntLiteral = converted %int.snegate.loc19_50, %.loc19_72.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Expect.loc19: type = class_type @Expect, @Expect(constants.%int_-9223372036854775808) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc19_38.4: ref %Expect.8 = temporary %.loc19_38.3, %Test.call.loc19 +// CHECK:STDOUT: %Test.ref.loc20: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc20: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc20_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc20_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc20_12: = bound_method %int_9223372036854775808.loc20_13, %impl.elem0.loc20_12 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc20_12: init Core.IntLiteral = call %Op.bound.loc20_12(%int_9223372036854775808.loc20_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %.loc20_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc20_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc20_12.2: Core.IntLiteral = converted %int.snegate.loc20_12, %.loc20_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.smul.loc20: init Core.IntLiteral = call %Mul.ref.loc20(%.loc20_12.2, %int_1.loc20) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc20_38.1: Core.IntLiteral = value_of_initializer %int.smul.loc20 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc20_38.2: Core.IntLiteral = converted %int.smul.loc20, %.loc20_38.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc20: = specific_function %Test.ref.loc20, @Test(constants.%int_-9223372036854775808) [template = constants.%Test.specific_fn.7] +// CHECK:STDOUT: %.loc20_38.3: ref %Expect.8 = temporary_storage +// CHECK:STDOUT: %Test.call.loc20: init %Expect.8 = call %Test.specific_fn.loc20() to %.loc20_38.3 +// CHECK:STDOUT: %Expect.ref.loc20: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc20_51: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc20_50: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc20_50: = bound_method %int_9223372036854775808.loc20_51, %impl.elem0.loc20_50 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc20_50: init Core.IntLiteral = call %Op.bound.loc20_50(%int_9223372036854775808.loc20_51) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc20_72.1: Core.IntLiteral = value_of_initializer %int.snegate.loc20_50 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc20_72.2: Core.IntLiteral = converted %int.snegate.loc20_50, %.loc20_72.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %Expect.loc20: type = class_type @Expect, @Expect(constants.%int_-9223372036854775808) [template = constants.%Expect.8] +// CHECK:STDOUT: %.loc20_38.4: ref %Expect.8 = temporary %.loc20_38.3, %Test.call.loc20 +// CHECK:STDOUT: %Test.ref.loc21: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc21: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc21_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc21_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc21_12: = bound_method %int_9223372036854775808.loc21_13, %impl.elem0.loc21_12 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc21_12: init Core.IntLiteral = call %Op.bound.loc21_12(%int_9223372036854775808.loc21_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc21_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc21_36: = bound_method %int_1.loc21, %impl.elem0.loc21_36 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc21_36: init Core.IntLiteral = call %Op.bound.loc21_36(%int_1.loc21) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc21_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc21_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc21_12.2: Core.IntLiteral = converted %int.snegate.loc21_12, %.loc21_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc21_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc21_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc21_36.2: Core.IntLiteral = converted %int.snegate.loc21_36, %.loc21_36.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.smul.loc21: init Core.IntLiteral = call %Mul.ref.loc21(%.loc21_12.2, %.loc21_36.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc21_39.1: Core.IntLiteral = value_of_initializer %int.smul.loc21 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc21_39.2: Core.IntLiteral = converted %int.smul.loc21, %.loc21_39.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc21: = specific_function %Test.ref.loc21, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc21_39.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc21: init %Expect.7 = call %Test.specific_fn.loc21() to %.loc21_39.3 +// CHECK:STDOUT: %Expect.ref.loc21: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc21_51: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc21: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc21_39.4: ref %Expect.7 = temporary %.loc21_39.3, %Test.call.loc21 +// CHECK:STDOUT: %Test.ref.loc22: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc22: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc22_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc22_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc22_12: = bound_method %int_9223372036854775808.loc22_13, %impl.elem0.loc22_12 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc22_12: init Core.IntLiteral = call %Op.bound.loc22_12(%int_9223372036854775808.loc22_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc22_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc22_36: = bound_method %int_1.loc22, %impl.elem0.loc22_36 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc22_36: init Core.IntLiteral = call %Op.bound.loc22_36(%int_1.loc22) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc22_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc22_12.2: Core.IntLiteral = converted %int.snegate.loc22_12, %.loc22_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc22_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc22_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc22_36.2: Core.IntLiteral = converted %int.snegate.loc22_36, %.loc22_36.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.smul.loc22: init Core.IntLiteral = call %Mul.ref.loc22(%.loc22_12.2, %.loc22_36.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc22_39.1: Core.IntLiteral = value_of_initializer %int.smul.loc22 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc22_39.2: Core.IntLiteral = converted %int.smul.loc22, %.loc22_39.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc22: = specific_function %Test.ref.loc22, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.6] +// CHECK:STDOUT: %.loc22_39.3: ref %Expect.7 = temporary_storage +// CHECK:STDOUT: %Test.call.loc22: init %Expect.7 = call %Test.specific_fn.loc22() to %.loc22_39.3 +// CHECK:STDOUT: %Expect.ref.loc22: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc22_51: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc22: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.7] +// CHECK:STDOUT: %.loc22_39.4: ref %Expect.7 = temporary %.loc22_39.3, %Test.call.loc22 +// CHECK:STDOUT: %Test.ref.loc23: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Mul.ref.loc23: %Mul.type.1 = name_ref Mul, file.%Mul.decl [template = constants.%Mul] +// CHECK:STDOUT: %int_9223372036854775808.loc23_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc23_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc23_12: = bound_method %int_9223372036854775808.loc23_13, %impl.elem0.loc23_12 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc23_12: init Core.IntLiteral = call %Op.bound.loc23_12(%int_9223372036854775808.loc23_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_9223372036854775808.loc23_37: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc23_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc23_36: = bound_method %int_9223372036854775808.loc23_37, %impl.elem0.loc23_36 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc23_36: init Core.IntLiteral = call %Op.bound.loc23_36(%int_9223372036854775808.loc23_37) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc23_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc23_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc23_12.2: Core.IntLiteral = converted %int.snegate.loc23_12, %.loc23_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc23_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc23_36 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc23_36.2: Core.IntLiteral = converted %int.snegate.loc23_36, %.loc23_36.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.smul.loc23: init Core.IntLiteral = call %Mul.ref.loc23(%.loc23_12.2, %.loc23_36.2) [template = constants.%int_85070591730234615865843651857942052864] +// CHECK:STDOUT: %.loc23_59.1: Core.IntLiteral = value_of_initializer %int.smul.loc23 [template = constants.%int_85070591730234615865843651857942052864] +// CHECK:STDOUT: %.loc23_59.2: Core.IntLiteral = converted %int.smul.loc23, %.loc23_59.1 [template = constants.%int_85070591730234615865843651857942052864] +// CHECK:STDOUT: %Test.specific_fn.loc23: = specific_function %Test.ref.loc23, @Test(constants.%int_85070591730234615865843651857942052864) [template = constants.%Test.specific_fn.8] +// CHECK:STDOUT: %.loc23_59.3: ref %Expect.9 = temporary_storage +// CHECK:STDOUT: %Test.call.loc23: init %Expect.9 = call %Test.specific_fn.loc23() to %.loc23_59.3 +// CHECK:STDOUT: %Expect.ref.loc24: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_85070591730234615865843651857942052864: Core.IntLiteral = int_value 85070591730234615865843651857942052864 [template = constants.%int_85070591730234615865843651857942052864] +// CHECK:STDOUT: %Expect.loc24: type = class_type @Expect, @Expect(constants.%int_85070591730234615865843651857942052864) [template = constants.%Expect.9] +// CHECK:STDOUT: %.loc23_59.4: ref %Expect.9 = temporary %.loc23_59.3, %Test.call.loc23 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_6) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_6 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_6 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_6) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_6 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483647 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.5 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.5 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483647) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483647 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-2147483647) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-2147483647 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-2147483647 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.6 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.6 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-2147483647) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-2147483647 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-2147483647 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.7 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.7 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.8 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_85070591730234615865843651857942052864) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_85070591730234615865843651857942052864 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_85070591730234615865843651857942052864 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.9 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_85070591730234615865843651857942052864) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_85070591730234615865843651857942052864 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_85070591730234615865843651857942052864 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 78e436b3f7fc1..4721ba1a20539 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -20,6 +20,21 @@ let n: i32 = Negate(1); fn RuntimeCall(a: i32, b: i32) -> i32 { return Negate(a); } + +// --- literal.carbon + +library "[[@TEST_NAME]]"; + +fn Negate(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.snegate"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Negate(0)) as Expect(0); + Test(Negate(1)) as Expect(0 - 1); + Test(Negate(0 - 0x8000_0000_0000_0000)) as Expect(0x8000_0000_0000_0000); +} // --- fail_bad_decl.carbon @@ -108,13 +123,13 @@ fn Negate(a: i32) -> i32 = "int.snegate"; fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; // -(-INT_MAX) is INT_MAX. -let a: i32 = Negate(Negate(0x7FFFFFFF)); +let a: i32 = Negate(Negate(0x7FFF_FFFF)); -// -(-INT_MAX - 1) is too large for i32. +// -INT_MIN is too large for i32. // CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow] -// CHECK:STDERR: let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); +// CHECK:STDERR: let b: i32 = Negate(-0x8000_0000); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ +let b: i32 = Negate(-0x8000_0000); // CHECK:STDOUT: --- int_negate.carbon // CHECK:STDOUT: @@ -271,6 +286,278 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] +// CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_0) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_0) [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_-1) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_-1) [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_0, %Op.2 [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Expect.4: type = class_type @Expect, @Expect(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.3: = specific_function %Test, @Test(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.4: %Expect.4 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Sub = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Negate = %Negate.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Negate.decl: %Negate.type.1 = fn_decl @Negate.1 [template = constants.%Negate] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param1 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Negate.1(%a.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.snegate"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc10: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_0.loc10_15: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int.snegate.loc10: init Core.IntLiteral = call %Negate.ref.loc10(%int_0.loc10_15) [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.1: Core.IntLiteral = value_of_initializer %int.snegate.loc10 [template = constants.%int_0] +// CHECK:STDOUT: %.loc10_17.2: Core.IntLiteral = converted %int.snegate.loc10, %.loc10_17.1 [template = constants.%int_0] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_0) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_17.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_17.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc10_29: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_0) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_17.4: ref %Expect.2 = temporary %.loc10_17.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc11: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_1.loc11_15: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.snegate.loc11: init Core.IntLiteral = call %Negate.ref.loc11(%int_1.loc11_15) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_17.1: Core.IntLiteral = value_of_initializer %int.snegate.loc11 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_17.2: Core.IntLiteral = converted %int.snegate.loc11, %.loc11_17.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_-1) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_17.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_17.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_1.loc11_33: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc11: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc11: = bound_method %int_0.loc11, %impl.elem0.loc11 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.ssub.loc11: init Core.IntLiteral = call %Op.bound.loc11(%int_0.loc11, %int_1.loc11_33) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_34.1: Core.IntLiteral = value_of_initializer %int.ssub.loc11 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_34.2: Core.IntLiteral = converted %int.ssub.loc11, %.loc11_34.1 [template = constants.%int_-1] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_-1) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_17.4: ref %Expect.3 = temporary %.loc11_17.3, %Test.call.loc11 +// CHECK:STDOUT: %Test.ref.loc12: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_0.loc12: Core.IntLiteral = int_value 0 [template = constants.%int_0] +// CHECK:STDOUT: %int_9223372036854775808.loc12_19: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12: = bound_method %int_0.loc12, %impl.elem0.loc12 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.ssub.loc12: init Core.IntLiteral = call %Op.bound.loc12(%int_0.loc12, %int_9223372036854775808.loc12_19) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc12_17.1: Core.IntLiteral = value_of_initializer %int.ssub.loc12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc12_17.2: Core.IntLiteral = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int.snegate.loc12: init Core.IntLiteral = call %Negate.ref.loc12(%.loc12_17.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc12_41.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc12_41.2: Core.IntLiteral = converted %int.snegate.loc12, %.loc12_41.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc12: = specific_function %Test.ref.loc12, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.3] +// CHECK:STDOUT: %.loc12_41.3: ref %Expect.4 = temporary_storage +// CHECK:STDOUT: %Test.call.loc12: init %Expect.4 = call %Test.specific_fn.loc12() to %.loc12_41.3 +// CHECK:STDOUT: %Expect.ref.loc12: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc12_53: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc12: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.4] +// CHECK:STDOUT: %.loc12_41.4: ref %Expect.4 = temporary %.loc12_41.3, %Test.call.loc12 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_0) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_0 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_0) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_0 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_-1) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_-1 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_-1) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_-1 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.4 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -556,17 +843,23 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] // CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.6: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound: = bound_method %int_2147483648, %Op.2 [template] +// CHECK:STDOUT: %int_-2147483648.1: Core.IntLiteral = int_value -2147483648 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_-2147483648.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %int_-2147483648.2: %i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.229 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -631,47 +924,37 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Negate.ref.loc8_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] // CHECK:STDOUT: %Negate.ref.loc8_21: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc8: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] // CHECK:STDOUT: %impl.elem0.loc8: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_2147483647.loc8, %impl.elem0.loc8 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.bound.loc8: = bound_method %int_2147483647, %impl.elem0.loc8 [template = constants.%Convert.bound.1] // CHECK:STDOUT: %Convert.specific_fn.loc8: = specific_function %Convert.bound.loc8, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc8: init %i32 = call %Convert.specific_fn.loc8(%int_2147483647.loc8) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %int.convert_checked.loc8: init %i32 = call %Convert.specific_fn.loc8(%int_2147483647) [template = constants.%int_2147483647.2] // CHECK:STDOUT: %.loc8_28.1: %i32 = value_of_initializer %int.convert_checked.loc8 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_28.2: %i32 = converted %int_2147483647.loc8, %.loc8_28.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc8_38: init %i32 = call %Negate.ref.loc8_21(%.loc8_28.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.1: %i32 = value_of_initializer %int.snegate.loc8_38 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc8_38.2: %i32 = converted %int.snegate.loc8_38, %.loc8_38.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int.snegate.loc8_39: init %i32 = call %Negate.ref.loc8_14(%.loc8_38.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.1: %i32 = value_of_initializer %int.snegate.loc8_39 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc8_40.2: %i32 = converted %int.snegate.loc8_39, %.loc8_40.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc14_14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %Sub.ref: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc14_25: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc14: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc14_32: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_32: = bound_method %int_2147483647.loc14, %impl.elem0.loc14_32 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc14_32: = specific_function %Convert.bound.loc14_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc14_32: init %i32 = call %Convert.specific_fn.loc14_32(%int_2147483647.loc14) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_32.1: %i32 = value_of_initializer %int.convert_checked.loc14_32 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc14_32.2: %i32 = converted %int_2147483647.loc14, %.loc14_32.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc14_42: init %i32 = call %Negate.ref.loc14_25(%.loc14_32.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc14_42.1: %i32 = value_of_initializer %int.snegate.loc14_42 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc14_42.2: %i32 = converted %int.snegate.loc14_42, %.loc14_42.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc14_45: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc14_45: = bound_method %int_1, %impl.elem0.loc14_45 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc14_45: = specific_function %Convert.bound.loc14_45, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc14_45: init %i32 = call %Convert.specific_fn.loc14_45(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc14_45.1: %i32 = value_of_initializer %int.convert_checked.loc14_45 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc14_45.2: %i32 = converted %int_1, %.loc14_45.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub: init %i32 = call %Sub.ref(%.loc14_42.2, %.loc14_45.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_46.1: %i32 = value_of_initializer %int.ssub [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_46.2: %i32 = converted %int.ssub, %.loc14_46.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int.snegate.loc14_47: init %i32 = call %Negate.ref.loc14_14(%.loc14_46.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_48.1: %i32 = value_of_initializer %int.snegate.loc14_47 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc14_48.2: %i32 = converted %int.snegate.loc14_47, %.loc14_48.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc14_48.2 +// CHECK:STDOUT: %.loc8_28.2: %i32 = converted %int_2147483647, %.loc8_28.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %int.snegate.loc8_39: init %i32 = call %Negate.ref.loc8_21(%.loc8_28.2) [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc8_39.1: %i32 = value_of_initializer %int.snegate.loc8_39 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %.loc8_39.2: %i32 = converted %int.snegate.loc8_39, %.loc8_39.1 [template = constants.%int_-2147483647] +// CHECK:STDOUT: %int.snegate.loc8_40: init %i32 = call %Negate.ref.loc8_14(%.loc8_39.2) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc8_41.1: %i32 = value_of_initializer %int.snegate.loc8_40 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc8_41.2: %i32 = converted %int.snegate.loc8_40, %.loc8_41.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc8_41.2 +// CHECK:STDOUT: %Negate.ref.loc14: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %impl.elem0.loc14_21.1: %Op.type.1 = interface_witness_access constants.%interface.6, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound: = bound_method %int_2147483648, %impl.elem0.loc14_21.1 [template = constants.%Op.bound] +// CHECK:STDOUT: %int.snegate.loc14_21: init Core.IntLiteral = call %Op.bound(%int_2147483648) [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %impl.elem0.loc14_21.2: %Convert.type.2 = interface_witness_access constants.%interface.5, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc14: = bound_method %int.snegate.loc14_21, %impl.elem0.loc14_21.2 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc14: = specific_function %Convert.bound.loc14, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %.loc14_21.1: Core.IntLiteral = value_of_initializer %int.snegate.loc14_21 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %.loc14_21.2: Core.IntLiteral = converted %int.snegate.loc14_21, %.loc14_21.1 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %int.convert_checked.loc14: init %i32 = call %Convert.specific_fn.loc14(%.loc14_21.2) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc14_21.3: %i32 = value_of_initializer %int.convert_checked.loc14 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc14_21.4: %i32 = converted %int.snegate.loc14_21, %.loc14_21.3 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %int.snegate.loc14_33: init %i32 = call %Negate.ref.loc14(%.loc14_21.4) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc14_34.1: %i32 = value_of_initializer %int.snegate.loc14_33 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc14_34.2: %i32 = converted %int.snegate.loc14_33, %.loc14_34.1 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc14_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index e0f8aa87b54c9..96f3ce4628d23 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -58,25 +58,6 @@ static auto GetBuiltinFCmpPredicate(SemIR::BuiltinFunctionKind builtin_kind) } } -// Given an argument that is either a sized integer or integer literal, produces -// a corresponding value. -static auto GetIntOrIntLiteralValue(FunctionContext& context, - SemIR::InstId arg_id) -> llvm::Value* { - auto* result = context.GetValue(arg_id); - - // An IntLiteral value will have been lowered to an empty struct. Produce a - // ConstantInt with its constant value instead. - if (isa(result)) { - CARBON_CHECK(result == context.GetIntLiteralAsValue()); - auto int_value = context.sem_ir().insts().GetAs( - context.sem_ir().constant_values().GetConstantInstId(arg_id)); - return llvm::ConstantInt::get( - context.llvm_context(), context.sem_ir().ints().Get(int_value.int_id)); - } - - return result; -} - // Returns whether the specified instruction has a signed integer type. static auto IsSignedInt(FunctionContext& context, SemIR::InstId int_id) -> bool { @@ -98,7 +79,7 @@ static auto HandleIntShift(FunctionContext& context, SemIR::InstId inst_id, llvm::Instruction::BinaryOps bin_op, SemIR::InstId lhs_id, SemIR::InstId rhs_id) -> void { llvm::Value* lhs = context.GetValue(lhs_id); - llvm::Value* rhs = GetIntOrIntLiteralValue(context, rhs_id); + llvm::Value* rhs = context.GetValue(rhs_id); // Weirdly, LLVM requires the operands of bit shift operators to be of the // same type. We can always use the width of the LHS, because if the RHS @@ -115,8 +96,8 @@ static auto HandleIntComparison(FunctionContext& context, SemIR::InstId inst_id, SemIR::BuiltinFunctionKind builtin_kind, SemIR::InstId lhs_id, SemIR::InstId rhs_id) -> void { - llvm::Value* lhs = GetIntOrIntLiteralValue(context, lhs_id); - llvm::Value* rhs = GetIntOrIntLiteralValue(context, rhs_id); + llvm::Value* lhs = context.GetValue(lhs_id); + llvm::Value* rhs = context.GetValue(rhs_id); const auto* lhs_type = cast(lhs->getType()); const auto* rhs_type = cast(rhs->getType()); @@ -402,7 +383,8 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id, case SemIR::BuiltinFunctionKind::IntConvertChecked: { // TODO: Check this statically. CARBON_CHECK(builtin_kind.IsCompTimeOnly( - context.sem_ir(), context.sem_ir().insts().Get(inst_id).type_id())); + context.sem_ir(), arg_ids, + context.sem_ir().insts().Get(inst_id).type_id())); CARBON_FATAL("Missing constant value for call to comptime-only function"); } } diff --git a/toolchain/lower/testdata/builtins/int_literal.carbon b/toolchain/lower/testdata/builtins/int_literal.carbon index afe16953ddbf9..29c4ad8a2f28b 100644 --- a/toolchain/lower/testdata/builtins/int_literal.carbon +++ b/toolchain/lower/testdata/builtins/int_literal.carbon @@ -14,6 +14,14 @@ fn Copy(x: Make()) -> Make() { return x; } +fn MinusOne() -> i32 { + return -1; +} + +fn IntMax() -> i32 { + return 0x1_0000_0000_0000_0000 / 0x2_0000_0000 - 1; +} + // CHECK:STDOUT: ; ModuleID = 'int_literal.carbon' // CHECK:STDOUT: source_filename = "int_literal.carbon" // CHECK:STDOUT: @@ -22,6 +30,16 @@ fn Copy(x: Make()) -> Make() { // CHECK:STDOUT: ret {} %x, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CMinusOne.Main() !dbg !8 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 -1, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CIntMax.Main() !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 2147483647, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -33,3 +51,7 @@ fn Copy(x: Make()) -> Make() { // CHECK:STDOUT: !5 = !DISubroutineType(types: !6) // CHECK:STDOUT: !6 = !{} // CHECK:STDOUT: !7 = !DILocation(line: 14, column: 3, scope: !4) +// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "MinusOne", linkageName: "_CMinusOne.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !9 = !DILocation(line: 18, column: 3, scope: !8) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "IntMax", linkageName: "_CIntMax.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 22, column: 3, scope: !10) diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 24d6bfb609f80..7813c9ef53a9a 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -422,6 +422,7 @@ auto BuiltinFunctionKind::IsValidType(const File& sem_ir, } auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, + llvm::ArrayRef arg_ids, TypeId return_type_id) const -> bool { switch (*this) { case IntConvertChecked: @@ -438,8 +439,22 @@ auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, case IntAnd: case IntOr: case IntXor: + // Integer builtins producing an IntLiteral are compile-time only. + // TODO: We could allow these at runtime and just produce an empty struct + // result. Should we? + return sem_ir.types().Is(return_type_id); + case IntLeftShift: case IntRightShift: + // Shifts by an integer literal amount are compile-time only. We don't + // have a value for the shift amount at runtime in general. + // TODO: We could allow these in the case where the shift amount has a + // compile-time value. + if (sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[1]).type_id())) { + return true; + } + // Integer builtins producing an IntLiteral are compile-time only. // TODO: We could allow these at runtime and just produce an empty struct // result. Should we? diff --git a/toolchain/sem_ir/builtin_function_kind.h b/toolchain/sem_ir/builtin_function_kind.h index d992d545e00c7..7207a31657ea6 100644 --- a/toolchain/sem_ir/builtin_function_kind.h +++ b/toolchain/sem_ir/builtin_function_kind.h @@ -37,7 +37,8 @@ class BuiltinFunctionKind : public CARBON_ENUM_BASE(BuiltinFunctionKind) { TypeId return_type) const -> bool; // Returns whether this is a compile-time-only function. - auto IsCompTimeOnly(const File& sem_ir, TypeId return_type_id) const -> bool; + auto IsCompTimeOnly(const File& sem_ir, llvm::ArrayRef arg_ids, + TypeId return_type_id) const -> bool; }; #define CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(Name) \ From 106a94da4a32f6ebe3c6f441c843c68c68f410a5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 19:56:27 +0000 Subject: [PATCH 06/13] pre-commit fixes --- toolchain/check/eval.cpp | 12 +++++++----- toolchain/check/testdata/builtins/int/snegate.carbon | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 9cb1f2989e2ea..cb63a151f6fc8 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -792,7 +792,7 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error, "integer overflow in negation of {0}", TypedInt); context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow, - {.type = op.type_id, .value = op_val}); + {.type = op.type_id, .value = op_val}); } else { // Widen the integer so we don't overflow into the sign bit. op_val = op_val.sext(op_val.getBitWidth() + @@ -827,7 +827,7 @@ struct APIntBinaryOperands { llvm::APInt lhs; llvm::APInt rhs; }; -} +} // namespace // Get a pair of integers at the same suitable bit-width: either their actual // width if they have a fixed width, or the smallest canonical width in which @@ -860,7 +860,7 @@ struct BinaryIntOpResult { bool overflow; Lex::TokenKind op_token; }; -} +} // namespace // Computes the result of a homogeneous binary (int, int) -> int operation. static auto ComputeBinaryIntOpResult(SemIR::BuiltinFunctionKind builtin_kind, @@ -1014,7 +1014,8 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, // Ensure we don't generate a ridiculously large integer through a bit // shift. auto width = rhs_orig_val.trySExtValue(); - if (!width || *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { + if (!width || + *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { CARBON_DIAGNOSTIC(CompileTimeUnsizedShiftOutOfRange, Error, "shift distance of {0} would result in an " "integer whose width is greater than the " @@ -1029,7 +1030,8 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, lhs_val.getSignificantBits() + *width)); } - result_val = lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + result_val = + lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); } else if (lhs_is_signed) { result_val = lhs_val.ashr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 4721ba1a20539..1af51bba94324 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -20,7 +20,7 @@ let n: i32 = Negate(1); fn RuntimeCall(a: i32, b: i32) -> i32 { return Negate(a); } - + // --- literal.carbon library "[[@TEST_NAME]]"; From bb7606fdf7a6591040af25026b0ca4a057726d93 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 20:01:20 +0000 Subject: [PATCH 07/13] Also disallow runtime comparisons against integer literals for now. --- toolchain/sem_ir/builtin_function_kind.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 7813c9ef53a9a..b6a54192cd6d4 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -460,6 +460,22 @@ auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, // result. Should we? return sem_ir.types().Is(return_type_id); + case IntEq: + case IntNeq: + case IntLess: + case IntLessEq: + case IntGreater: + case IntGreaterEq: + // Comparisons involving an integer literal operand are compile-time only. + // We don't have a value for an integer literal operand argument at + // runtime in general. + // TODO: We could allow these in the case where the operand has a + // compile-time value. + return sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[0]).type_id()) || + sem_ir.types().Is( + sem_ir.insts().Get(arg_ids[1]).type_id()); + default: // TODO: Should the sized MakeType functions be compile-time only? We // can't produce diagnostics for bad sizes at runtime. From 97879ab150ceed0fd2854f25f484cde1a755576b Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Dec 2024 20:08:09 +0000 Subject: [PATCH 08/13] Add test for directly writing INT_MIN. --- toolchain/lower/testdata/builtins/int_literal.carbon | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolchain/lower/testdata/builtins/int_literal.carbon b/toolchain/lower/testdata/builtins/int_literal.carbon index 29c4ad8a2f28b..db93678405de3 100644 --- a/toolchain/lower/testdata/builtins/int_literal.carbon +++ b/toolchain/lower/testdata/builtins/int_literal.carbon @@ -22,6 +22,10 @@ fn IntMax() -> i32 { return 0x1_0000_0000_0000_0000 / 0x2_0000_0000 - 1; } +fn IntMin() -> i32 { + return -0x8000_0000; +} + // CHECK:STDOUT: ; ModuleID = 'int_literal.carbon' // CHECK:STDOUT: source_filename = "int_literal.carbon" // CHECK:STDOUT: @@ -40,6 +44,11 @@ fn IntMax() -> i32 { // CHECK:STDOUT: ret i32 2147483647, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: define i32 @_CIntMin.Main() !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 -2147483648, !dbg !13 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -55,3 +64,5 @@ fn IntMax() -> i32 { // CHECK:STDOUT: !9 = !DILocation(line: 18, column: 3, scope: !8) // CHECK:STDOUT: !10 = distinct !DISubprogram(name: "IntMax", linkageName: "_CIntMax.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !11 = !DILocation(line: 22, column: 3, scope: !10) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "IntMin", linkageName: "_CIntMin.Main", scope: null, file: !3, line: 25, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 26, column: 3, scope: !12) From 8722548316ca8d0d306a5c49f41be34b01aa10a5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 20 Dec 2024 22:56:33 +0000 Subject: [PATCH 09/13] Address some review comments, split bit shift out into its own function. --- toolchain/check/eval.cpp | 217 ++++++++++++++++++++------------------- 1 file changed, 109 insertions(+), 108 deletions(-) diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index cb63a151f6fc8..a238076f06e7c 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -766,10 +766,10 @@ static auto DiagnoseDivisionByZero(Context& context, SemIRLoc loc) -> void { context.emitter().Emit(loc, CompileTimeDivisionByZero); } -// Get an integer at a suitable bit-width: either its actual width if it has a -// fixed width, or the canonical width from the value store if not. -static auto GetIntAtSuitableWidth(Context& context, IntId bit_width_id, - IntId int_id) -> llvm::APInt { +// Get an integer at a suitable bit-width: either `bit_width_id` if it is valid, +// or the canonical width from the value store if not. +static auto GetIntAtSuitableWidth(Context& context, IntId int_id, + IntId bit_width_id) -> llvm::APInt { return bit_width_id.is_valid() ? context.ints().GetAtWidth(int_id, bit_width_id) : context.ints().Get(int_id); @@ -783,7 +783,7 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc, auto op = context.insts().GetAs(arg_id); auto [is_signed, bit_width_id] = context.sem_ir().types().GetIntTypeInfo(op.type_id); - llvm::APInt op_val = GetIntAtSuitableWidth(context, bit_width_id, op.int_id); + llvm::APInt op_val = GetIntAtSuitableWidth(context, op.int_id, bit_width_id); switch (builtin_kind) { case SemIR::BuiltinFunctionKind::IntSNegate: @@ -832,9 +832,8 @@ struct APIntBinaryOperands { // Get a pair of integers at the same suitable bit-width: either their actual // width if they have a fixed width, or the smallest canonical width in which // they both fit otherwise. -static auto GetIntsAtSuitableWidth(Context& context, IntId bit_width_id, - IntId lhs_id, IntId rhs_id) - -> APIntBinaryOperands { +static auto GetIntsAtSuitableWidth(Context& context, IntId lhs_id, IntId rhs_id, + IntId bit_width_id) -> APIntBinaryOperands { // Unsized operands: take the wider of the bit widths. if (!bit_width_id.is_valid()) { APIntBinaryOperands result = {.lhs = context.ints().Get(lhs_id), @@ -943,7 +942,84 @@ static auto ComputeBinaryIntOpResult(SemIR::BuiltinFunctionKind builtin_kind, .op_token = op_token}; } -// Performs a builtin binary integer -> integer operation. +// Performs a builtin integer bit shift operation. +static auto PerformBuiltinIntShiftOp(Context& context, SemIRLoc loc, + SemIR::BuiltinFunctionKind builtin_kind, + SemIR::InstId lhs_id, SemIR::InstId rhs_id) + -> SemIR::ConstantId { + auto lhs = context.insts().GetAs(lhs_id); + auto rhs = context.insts().GetAs(rhs_id); + + auto [lhs_is_signed, lhs_bit_width_id] = + context.sem_ir().types().GetIntTypeInfo(lhs.type_id); + + llvm::APInt lhs_val = + GetIntAtSuitableWidth(context, lhs.int_id, lhs_bit_width_id); + const auto& rhs_orig_val = context.ints().Get(rhs.int_id); + if (lhs_bit_width_id.is_valid() && rhs_orig_val.uge(lhs_val.getBitWidth())) { + CARBON_DIAGNOSTIC( + CompileTimeShiftOutOfRange, Error, + "shift distance >= type width of {0} in `{1} {2:<<|>>} {3}`", unsigned, + TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), + {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + + if (rhs_orig_val.isNegative() && + context.sem_ir().types().IsSignedInt(rhs.type_id)) { + CARBON_DIAGNOSTIC(CompileTimeShiftNegative, Error, + "shift distance negative in `{0} {1:<<|>>} {2}`", + TypedInt, BoolAsSelect, TypedInt); + context.emitter().Emit( + loc, CompileTimeShiftNegative, {.type = lhs.type_id, .value = lhs_val}, + builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, + {.type = rhs.type_id, .value = rhs_orig_val}); + // TODO: Is it useful to recover by returning 0 or -1? + return SemIR::ErrorInst::SingletonConstantId; + } + + llvm::APInt result_val; + if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { + if (!lhs_bit_width_id.is_valid() && !lhs_val.isZero()) { + // Ensure we don't generate a ridiculously large integer through a bit + // shift. + auto width = rhs_orig_val.trySExtValue(); + if (!width || + *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { + CARBON_DIAGNOSTIC(CompileTimeUnsizedShiftOutOfRange, Error, + "shift distance of {0} would result in an " + "integer whose width is greater than the " + "maximum supported width of {1}", + TypedInt, int); + context.emitter().Emit(loc, CompileTimeUnsizedShiftOutOfRange, + {.type = rhs.type_id, .value = rhs_orig_val}, + IntStore::MaxIntWidth); + return SemIR::ErrorInst::SingletonConstantId; + } + lhs_val = lhs_val.sext( + IntStore::CanonicalBitWidth(lhs_val.getSignificantBits() + *width)); + } + + result_val = + lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } else if (lhs_is_signed) { + result_val = + lhs_val.ashr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } else { + CARBON_CHECK(lhs_bit_width_id.is_valid(), "Logical shift on unsized int"); + result_val = + lhs_val.lshr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); + } + return MakeIntResult(context, lhs.type_id, lhs_is_signed, + std::move(result_val)); +} + +// Performs a homogeneous builtin binary integer -> integer operation. static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, SemIR::BuiltinFunctionKind builtin_kind, SemIR::InstId lhs_id, @@ -952,13 +1028,20 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, auto lhs = context.insts().GetAs(lhs_id); auto rhs = context.insts().GetAs(rhs_id); + CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); + auto type_id = lhs.type_id; + auto [is_signed, bit_width_id] = + context.sem_ir().types().GetIntTypeInfo(type_id); + auto [lhs_val, rhs_val] = + GetIntsAtSuitableWidth(context, lhs.int_id, rhs.int_id, bit_width_id); + // Check for division by zero. switch (builtin_kind) { case SemIR::BuiltinFunctionKind::IntSDiv: case SemIR::BuiltinFunctionKind::IntSMod: case SemIR::BuiltinFunctionKind::IntUDiv: case SemIR::BuiltinFunctionKind::IntUMod: - if (context.ints().Get(rhs.int_id).isZero()) { + if (rhs_val.isZero()) { DiagnoseDivisionByZero(context, loc); return SemIR::ErrorInst::SingletonConstantId; } @@ -967,99 +1050,10 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, break; } - auto [lhs_is_signed, lhs_bit_width_id] = - context.sem_ir().types().GetIntTypeInfo(lhs.type_id); - - // First handle shift, which can directly use the canonical RHS and doesn't - // overflow. - switch (builtin_kind) { - // Bit shift. - case SemIR::BuiltinFunctionKind::IntLeftShift: - case SemIR::BuiltinFunctionKind::IntRightShift: { - llvm::APInt lhs_val = - GetIntAtSuitableWidth(context, lhs_bit_width_id, lhs.int_id); - const auto& rhs_orig_val = context.ints().Get(rhs.int_id); - if (lhs_bit_width_id.is_valid() && - rhs_orig_val.uge(lhs_val.getBitWidth())) { - CARBON_DIAGNOSTIC( - CompileTimeShiftOutOfRange, Error, - "shift distance >= type width of {0} in `{1} {2:<<|>>} {3}`", - unsigned, TypedInt, BoolAsSelect, TypedInt); - context.emitter().Emit( - loc, CompileTimeShiftOutOfRange, lhs_val.getBitWidth(), - {.type = lhs.type_id, .value = lhs_val}, - builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, - {.type = rhs.type_id, .value = rhs_orig_val}); - // TODO: Is it useful to recover by returning 0 or -1? - return SemIR::ErrorInst::SingletonConstantId; - } - - if (rhs_orig_val.isNegative() && - context.sem_ir().types().IsSignedInt(rhs.type_id)) { - CARBON_DIAGNOSTIC(CompileTimeShiftNegative, Error, - "shift distance negative in `{0} {1:<<|>>} {2}`", - TypedInt, BoolAsSelect, TypedInt); - context.emitter().Emit( - loc, CompileTimeShiftNegative, - {.type = lhs.type_id, .value = lhs_val}, - builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift, - {.type = rhs.type_id, .value = rhs_orig_val}); - // TODO: Is it useful to recover by returning 0 or -1? - return SemIR::ErrorInst::SingletonConstantId; - } - - llvm::APInt result_val; - if (builtin_kind == SemIR::BuiltinFunctionKind::IntLeftShift) { - if (!lhs_bit_width_id.is_valid() && !lhs_val.isZero()) { - // Ensure we don't generate a ridiculously large integer through a bit - // shift. - auto width = rhs_orig_val.trySExtValue(); - if (!width || - *width > IntStore::MaxIntWidth - lhs_val.getSignificantBits()) { - CARBON_DIAGNOSTIC(CompileTimeUnsizedShiftOutOfRange, Error, - "shift distance of {0} would result in an " - "integer whose width is greater than the " - "maximum supported width of {1}", - TypedInt, int); - context.emitter().Emit(loc, CompileTimeUnsizedShiftOutOfRange, - {.type = rhs.type_id, .value = rhs_orig_val}, - IntStore::MaxIntWidth); - return SemIR::ErrorInst::SingletonConstantId; - } - lhs_val = lhs_val.sext(IntStore::CanonicalBitWidth( - lhs_val.getSignificantBits() + *width)); - } - - result_val = - lhs_val.shl(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); - } else if (lhs_is_signed) { - result_val = - lhs_val.ashr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); - } else { - CARBON_CHECK(lhs_bit_width_id.is_valid(), - "Logical shift on unsized int"); - result_val = - lhs_val.lshr(rhs_orig_val.getLimitedValue(lhs_val.getBitWidth())); - } - return MakeIntResult(context, lhs.type_id, lhs_is_signed, - std::move(result_val)); - } - - default: - // Break to do additional setup for other builtin kinds. - break; - } - - // Other operations are already checked to be homogeneous, so we can extend - // the RHS with the LHS bit width. - CARBON_CHECK(rhs.type_id == lhs.type_id, "Heterogeneous builtin integer op!"); - auto [lhs_val, rhs_val] = - GetIntsAtSuitableWidth(context, lhs_bit_width_id, lhs.int_id, rhs.int_id); - BinaryIntOpResult result = ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); - if (result.overflow && !lhs_bit_width_id.is_valid()) { + if (result.overflow && !bit_width_id.is_valid()) { // Retry with a larger bit width. Most operations can only overflow by one // bit, but signed n-bit multiplication can overflow to 2n-1 bits. int new_width = @@ -1081,12 +1075,11 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, "integer overflow in calculation `{0} {1} {2}`", TypedInt, Lex::TokenKind, TypedInt); context.emitter().Emit(loc, CompileTimeIntegerOverflow, - {.type = lhs.type_id, .value = lhs_val}, - result.op_token, - {.type = rhs.type_id, .value = rhs_val}); + {.type = type_id, .value = lhs_val}, result.op_token, + {.type = type_id, .value = rhs_val}); } - return MakeIntResult(context, lhs.type_id, lhs_is_signed, + return MakeIntResult(context, type_id, is_signed, std::move(result.result_val)); } @@ -1297,7 +1290,7 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, return PerformBuiltinUnaryIntOp(context, loc, builtin_kind, arg_ids[0]); } - // Binary integer -> integer operations. + // Homogeneous binary integer -> integer operations. case SemIR::BuiltinFunctionKind::IntSAdd: case SemIR::BuiltinFunctionKind::IntSSub: case SemIR::BuiltinFunctionKind::IntSMul: @@ -1310,9 +1303,7 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, case SemIR::BuiltinFunctionKind::IntUMod: case SemIR::BuiltinFunctionKind::IntAnd: case SemIR::BuiltinFunctionKind::IntOr: - case SemIR::BuiltinFunctionKind::IntXor: - case SemIR::BuiltinFunctionKind::IntLeftShift: - case SemIR::BuiltinFunctionKind::IntRightShift: { + case SemIR::BuiltinFunctionKind::IntXor: { if (phase != Phase::Template) { break; } @@ -1320,6 +1311,16 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, arg_ids[1]); } + // Bit shift operations. + case SemIR::BuiltinFunctionKind::IntLeftShift: + case SemIR::BuiltinFunctionKind::IntRightShift: { + if (phase != Phase::Template) { + break; + } + return PerformBuiltinIntShiftOp(context, loc, builtin_kind, arg_ids[0], + arg_ids[1]); + } + // Integer comparisons. case SemIR::BuiltinFunctionKind::IntEq: case SemIR::BuiltinFunctionKind::IntNeq: From ab54ae8845a61470d76d85c67852bfe2ca49ca2f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 20 Dec 2024 23:49:01 +0000 Subject: [PATCH 10/13] Address some more review comments. --- .../check/testdata/builtins/int/and.carbon | 334 ++++++++- .../check/testdata/builtins/int/eq.carbon | 156 ++++- .../testdata/builtins/int/left_shift.carbon | 2 +- .../testdata/builtins/int/less_eq.carbon | 137 ++++ .../check/testdata/builtins/int/sadd.carbon | 234 ++++++- .../check/testdata/builtins/int/sdiv.carbon | 655 ++++++++++++++---- 6 files changed, 1319 insertions(+), 199 deletions(-) diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index 83ead6eed186f..ed67122452cd4 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -48,15 +48,76 @@ library "[[@TEST_NAME]]"; fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+6]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+7]]:10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] // CHECK:STDERR: return AndLit(5, a); // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-6]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] // CHECK:STDERR: fn AndLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: return AndLit(5, a); } +// --- fail_bad_decl.carbon + +library "[[@TEST_NAME]]"; + +// Heterogeneous "and" is not supported. +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.and"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAnd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.and"; + +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + +fn Test(n: Core.IntLiteral()) { + // OK + And(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(n, 1); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + And(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(1, n); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + And(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: And(n, n); + // CHECK:STDERR: ^~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn And(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.and"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + And(n, n); +} + // CHECK:STDOUT: --- int_and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -684,8 +745,273 @@ fn F(a: Core.IntLiteral()) -> Core.IntLiteral() { // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5] // CHECK:STDOUT: %a.ref: Core.IntLiteral = name_ref a, %a // CHECK:STDOUT: %int.and: init Core.IntLiteral = call %AndLit.ref(%int_5, %a.ref) -// CHECK:STDOUT: %.loc13_22.1: Core.IntLiteral = value_of_initializer %int.and -// CHECK:STDOUT: %.loc13_22.2: Core.IntLiteral = converted %int.and, %.loc13_22.1 -// CHECK:STDOUT: return %.loc13_22.2 +// CHECK:STDOUT: %.loc14_22.1: Core.IntLiteral = value_of_initializer %int.and +// CHECK:STDOUT: %.loc14_22.2: Core.IntLiteral = converted %int.and, %.loc14_22.1 +// CHECK:STDOUT: return %.loc14_22.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_bad_decl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %MixedAnd1.type: type = fn_type @MixedAnd1 [template] +// CHECK:STDOUT: %MixedAnd1: %MixedAnd1.type = struct_value () [template] +// CHECK:STDOUT: %MixedAnd2.type: type = fn_type @MixedAnd2 [template] +// CHECK:STDOUT: %MixedAnd2: %MixedAnd2.type = struct_value () [template] +// CHECK:STDOUT: %MixedAnd3.type: type = fn_type @MixedAnd3 [template] +// CHECK:STDOUT: %MixedAnd3: %MixedAnd3.type = struct_value () [template] +// CHECK:STDOUT: %MixedAnd4.type: type = fn_type @MixedAnd4 [template] +// CHECK:STDOUT: %MixedAnd4: %MixedAnd4.type = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .Int = %import_ref.1 +// CHECK:STDOUT: .IntLiteral = %import_ref.5 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .MixedAnd1 = %MixedAnd1.decl +// CHECK:STDOUT: .MixedAnd2 = %MixedAnd2.decl +// CHECK:STDOUT: .MixedAnd3 = %MixedAnd3.decl +// CHECK:STDOUT: .MixedAnd4 = %MixedAnd4.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %MixedAnd1.decl: %MixedAnd1.type = fn_decl @MixedAnd1 [template = constants.%MixedAnd1] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc9_47: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_47: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc9_17: type = splice_block %i32.loc9_17 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc9_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc9_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc9_41.3: type = splice_block %.loc9_41.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc9_41.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc9_41.2: type = converted %int_literal.make_type, %.loc9_41.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAnd2.decl: %MixedAnd2.type = fn_decl @MixedAnd2 [template = constants.%MixedAnd2] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc14_47: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_47: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc14_33.3: type = splice_block %.loc14_33.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc14_33.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc14_33.2: type = converted %int_literal.make_type, %.loc14_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc14_39: type = splice_block %i32.loc14_39 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc14_39: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_39: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAnd3.decl: %MixedAnd3.type = fn_decl @MixedAnd3 [template = constants.%MixedAnd3] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc19_47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc19_51: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc19_63: init type = call %IntLiteral.ref.loc19_51() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc19_63.1: type = value_of_initializer %int_literal.make_type.loc19_63 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc19_63.2: type = converted %int_literal.make_type.loc19_63, %.loc19_63.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc19_17: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc19_41.3: type = splice_block %.loc19_41.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc19_25: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc19_29: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc19_41: init type = call %IntLiteral.ref.loc19_29() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc19_41.1: type = value_of_initializer %int_literal.make_type.loc19_41 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc19_41.2: type = converted %int_literal.make_type.loc19_41, %.loc19_41.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAnd4.decl: %MixedAnd4.type = fn_decl @MixedAnd4 [template = constants.%MixedAnd4] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc24_47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc24_51: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc24_63: init type = call %IntLiteral.ref.loc24_51() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc24_63.1: type = value_of_initializer %int_literal.make_type.loc24_63 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc24_63.2: type = converted %int_literal.make_type.loc24_63, %.loc24_63.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc24_33.3: type = splice_block %.loc24_33.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc24_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc24_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc24_33: init type = call %IntLiteral.ref.loc24_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc24_33.1: type = value_of_initializer %int_literal.make_type.loc24_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc24_33.2: type = converted %int_literal.make_type.loc24_33, %.loc24_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc24_39: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAnd1(%a.param_patt: %i32, %b.param_patt: Core.IntLiteral) -> %i32; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAnd2(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> %i32; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAnd3(%a.param_patt: %i32, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAnd4(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> Core.IntLiteral; +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_runtime_literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %And.type: type = fn_type @And [template] +// CHECK:STDOUT: %And: %And.type = struct_value () [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .And = %And.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_55: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_59: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_71: init type = call %IntLiteral.ref.loc4_59() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.1: type = value_of_initializer %int_literal.make_type.loc4_71 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.2: type = converted %int_literal.make_type.loc4_71, %.loc4_71.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_27.3: type = splice_block %.loc4_27.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_11: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_15: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_27: init type = call %IntLiteral.ref.loc4_15() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int_literal.make_type.loc4_27 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int_literal.make_type.loc4_27, %.loc4_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc4_49.3: type = splice_block %.loc4_49.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_33: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_37: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_49: init type = call %IntLiteral.ref.loc4_37() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.1: type = value_of_initializer %int_literal.make_type.loc4_49 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.2: type = converted %int_literal.make_type.loc4_49, %.loc4_49.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %n.patt: Core.IntLiteral = binding_pattern n +// CHECK:STDOUT: %n.param_patt: Core.IntLiteral = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_28.3: type = splice_block %.loc6_28.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.2: type = converted %int_literal.make_type, %.loc6_28.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: Core.IntLiteral = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @And(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Test(%n.param_patt: Core.IntLiteral) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %And.ref.loc8: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_1.loc8_7: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc8_10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.and.loc8: init Core.IntLiteral = call %And.ref.loc8(%int_1.loc8_7, %int_1.loc8_10) [template = constants.%int_1] +// CHECK:STDOUT: %And.ref.loc16: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %n.ref.loc16: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.and.loc16: init Core.IntLiteral = call %And.ref.loc16(%n.ref.loc16, %int_1.loc16) +// CHECK:STDOUT: %And.ref.loc24: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %n.ref.loc24: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.and.loc24: init Core.IntLiteral = call %And.ref.loc24(%int_1.loc24, %n.ref.loc24) +// CHECK:STDOUT: %And.ref.loc31: %And.type = name_ref And, file.%And.decl [template = constants.%And] +// CHECK:STDOUT: %n.ref.loc31_7: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc31_10: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.and.loc31: init Core.IntLiteral = call %And.ref.loc31(%n.ref.loc31_7, %n.ref.loc31_10) +// CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 59d3a38075a54..61aa8d40c7ff0 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -30,9 +30,10 @@ fn RuntimeCall(a: i32, b: i32) -> bool { package FailBadDecl; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] // CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // --- literal.carbon @@ -67,6 +68,40 @@ fn F() { Test(Eq(-1, 1)) as Expect(false); } +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + +fn Test(n: Core.IntLiteral()) { + // OK + Eq(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(n, 1); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + Eq(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(1, n); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + Eq(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: Eq(n, n); + // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn Eq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Eq(n, n); +} + // CHECK:STDOUT: --- int_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -316,18 +351,18 @@ fn F() { // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc7_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc8_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc8_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc7_19: type = splice_block %i32.loc7_19 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc8_19: type = splice_block %i32.loc8_19 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc8_19: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc8_19: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc7_27: type = splice_block %i32.loc7_27 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc7_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc7_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc8_27: type = splice_block %i32.loc8_27 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc8_27: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc8_27: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 @@ -952,3 +987,106 @@ fn F() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- fail_runtime_literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %Eq.type: type = fn_type @Eq [template] +// CHECK:STDOUT: %Eq: %Eq.type = struct_value () [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eq = %Eq.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eq.decl: %Eq.type = fn_decl @Eq [template = constants.%Eq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_54.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_54.2: type = converted %bool.make_type, %.loc4_54.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_26.3: type = splice_block %.loc4_26.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_10: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_14: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_26: init type = call %IntLiteral.ref.loc4_14() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.1: type = value_of_initializer %int_literal.make_type.loc4_26 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_26.2: type = converted %int_literal.make_type.loc4_26, %.loc4_26.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc4_48.3: type = splice_block %.loc4_48.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_32: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_36: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_48: init type = call %IntLiteral.ref.loc4_36() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_48.1: type = value_of_initializer %int_literal.make_type.loc4_48 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_48.2: type = converted %int_literal.make_type.loc4_48, %.loc4_48.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %n.patt: Core.IntLiteral = binding_pattern n +// CHECK:STDOUT: %n.param_patt: Core.IntLiteral = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_28.3: type = splice_block %.loc6_28.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.2: type = converted %int_literal.make_type, %.loc6_28.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: Core.IntLiteral = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Eq(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> bool = "int.eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Test(%n.param_patt: Core.IntLiteral) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Eq.ref.loc8: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc8_6: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc8_9: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%int_1.loc8_6, %int_1.loc8_9) [template = constants.%true] +// CHECK:STDOUT: %Eq.ref.loc16: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %n.ref.loc16: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.eq.loc16: init bool = call %Eq.ref.loc16(%n.ref.loc16, %int_1.loc16) +// CHECK:STDOUT: %Eq.ref.loc24: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %n.ref.loc24: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.eq.loc24: init bool = call %Eq.ref.loc24(%int_1.loc24, %n.ref.loc24) +// CHECK:STDOUT: %Eq.ref.loc31: %Eq.type = name_ref Eq, file.%Eq.decl [template = constants.%Eq] +// CHECK:STDOUT: %n.ref.loc31_6: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc31_9: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.eq.loc31: init bool = call %Eq.ref.loc31(%n.ref.loc31_6, %n.ref.loc31_9) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index 8064a38188600..f2424157cc7a4 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -182,7 +182,7 @@ fn LeftShiftOfLit(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.left var a_lit: Core.IntLiteral() = 12; var an_i32: i32 = 34; -// This can't be valid: we don't have a compile-time or runtime integer value for `n`. +// This can't be valid: we don't have a compile-time or runtime integer value for `a_lit`. // CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+7]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] // CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index fff6688079295..f4a48896d329f 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -66,6 +66,40 @@ fn F() { Test(LessEq(1, -1)) as Expect(false); } +// --- fail_runtime_literal.carbon + +library "[[@TEST_NAME]]"; + +fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + +fn Test(n: Core.IntLiteral()) { + // OK + LessEq(1, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(n, 1); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-8]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + LessEq(n, 1); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+7]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(1, n); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-16]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + LessEq(1, n); + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+6]]:3: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: LessEq(n, n); + // CHECK:STDERR: ^~~~~~~~~~~~ + // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-24]]:1: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: fn LessEq(a: Core.IntLiteral(), b: Core.IntLiteral()) -> bool = "int.less_eq"; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + LessEq(n, n); +} + // CHECK:STDOUT: --- int_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -1105,3 +1139,106 @@ fn F() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- fail_runtime_literal.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template] +// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template] +// CHECK:STDOUT: %LessEq.type: type = fn_type @LessEq [template] +// CHECK:STDOUT: %LessEq: %LessEq.type = struct_value () [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %true: bool = bool_literal true [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Bool = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .LessEq = %LessEq.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %LessEq.decl: %LessEq.type = fn_decl @LessEq [template = constants.%LessEq] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: bool = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] +// CHECK:STDOUT: %.loc4_58.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc4_58.2: type = converted %bool.make_type, %.loc4_58.1 [template = bool] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_30.3: type = splice_block %.loc4_30.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_30: init type = call %IntLiteral.ref.loc4_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.1: type = value_of_initializer %int_literal.make_type.loc4_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_30.2: type = converted %int_literal.make_type.loc4_30, %.loc4_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc4_52.3: type = splice_block %.loc4_52.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_52: init type = call %IntLiteral.ref.loc4_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.1: type = value_of_initializer %int_literal.make_type.loc4_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_52.2: type = converted %int_literal.make_type.loc4_52, %.loc4_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 +// CHECK:STDOUT: %return: ref bool = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %n.patt: Core.IntLiteral = binding_pattern n +// CHECK:STDOUT: %n.param_patt: Core.IntLiteral = value_param_pattern %n.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %n.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc6_28.3: type = splice_block %.loc6_28.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_28.2: type = converted %int_literal.make_type, %.loc6_28.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %n: Core.IntLiteral = bind_name n, %n.param +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @LessEq(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> bool = "int.less_eq"; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Test(%n.param_patt: Core.IntLiteral) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %LessEq.ref.loc8: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc8_10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int_1.loc8_13: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.less_eq.loc8: init bool = call %LessEq.ref.loc8(%int_1.loc8_10, %int_1.loc8_13) [template = constants.%true] +// CHECK:STDOUT: %LessEq.ref.loc16: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %n.ref.loc16: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int_1.loc16: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %int.less_eq.loc16: init bool = call %LessEq.ref.loc16(%n.ref.loc16, %int_1.loc16) +// CHECK:STDOUT: %LessEq.ref.loc24: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %n.ref.loc24: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.less_eq.loc24: init bool = call %LessEq.ref.loc24(%int_1.loc24, %n.ref.loc24) +// CHECK:STDOUT: %LessEq.ref.loc31: %LessEq.type = name_ref LessEq, file.%LessEq.decl [template = constants.%LessEq] +// CHECK:STDOUT: %n.ref.loc31_10: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc31_13: Core.IntLiteral = name_ref n, %n +// CHECK:STDOUT: %int.less_eq.loc31: init bool = call %LessEq.ref.loc31(%n.ref.loc31_10, %n.ref.loc31_13) +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 7840980f89621..5d01c8cd92fdc 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -70,6 +70,28 @@ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; fn JustRight(a: i32, b: i32) -> i32 = "int.sadd"; +// Heterogeneous "add" is not supported. +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd1(a: i32, b: Core.IntLiteral()) -> i32 = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd2(a: Core.IntLiteral(), b: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd3(a: i32, b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: fn MixedAdd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.sadd"; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +fn MixedAdd4(a: Core.IntLiteral(), b: i32) -> Core.IntLiteral() = "int.sadd"; + // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr] // CHECK:STDERR: var too_few: [i32; TooFew(1)]; // CHECK:STDERR: ^~~~~~~~~ @@ -89,7 +111,7 @@ var bad_return_type: [i32; BadReturnType(1, 2)]; // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch] // CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)]; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-43]]:1: note: calling function declared here [InCallToEntity] // CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: @@ -1003,6 +1025,16 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %BadReturnType: %BadReturnType.type = struct_value () [template] // CHECK:STDOUT: %JustRight.type: type = fn_type @JustRight [template] // CHECK:STDOUT: %JustRight: %JustRight.type = struct_value () [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %MixedAdd1.type: type = fn_type @MixedAdd1 [template] +// CHECK:STDOUT: %MixedAdd1: %MixedAdd1.type = struct_value () [template] +// CHECK:STDOUT: %MixedAdd2.type: type = fn_type @MixedAdd2 [template] +// CHECK:STDOUT: %MixedAdd2: %MixedAdd2.type = struct_value () [template] +// CHECK:STDOUT: %MixedAdd3.type: type = fn_type @MixedAdd3 [template] +// CHECK:STDOUT: %MixedAdd3: %MixedAdd3.type = struct_value () [template] +// CHECK:STDOUT: %MixedAdd4.type: type = fn_type @MixedAdd4 [template] +// CHECK:STDOUT: %MixedAdd4: %MixedAdd4.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooFew.type: type = fn_type @RuntimeCallTooFew [template] // CHECK:STDOUT: %RuntimeCallTooFew: %RuntimeCallTooFew.type = struct_value () [template] // CHECK:STDOUT: %RuntimeCallTooMany.type: type = fn_type @RuntimeCallTooMany [template] @@ -1015,10 +1047,12 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 // CHECK:STDOUT: .Bool = %import_ref.5 -// CHECK:STDOUT: .ImplicitAs = %import_ref.6 +// CHECK:STDOUT: .IntLiteral = %import_ref.6 +// CHECK:STDOUT: .ImplicitAs = %import_ref.7 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.6: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1028,6 +1062,10 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: .TooMany = %TooMany.decl // CHECK:STDOUT: .BadReturnType = %BadReturnType.decl // CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .MixedAdd1 = %MixedAdd1.decl +// CHECK:STDOUT: .MixedAdd2 = %MixedAdd2.decl +// CHECK:STDOUT: .MixedAdd3 = %MixedAdd3.decl +// CHECK:STDOUT: .MixedAdd4 = %MixedAdd4.decl // CHECK:STDOUT: .too_few = %too_few // CHECK:STDOUT: .too_many = %too_many // CHECK:STDOUT: .bad_return_type = %bad_return_type @@ -1138,6 +1176,124 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAdd1.decl: %MixedAdd1.type = fn_decl @MixedAdd1 [template = constants.%MixedAdd1] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc26_47: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc26_47: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc26_17: type = splice_block %i32.loc26_17 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc26_17: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc26_17: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc26_41.3: type = splice_block %.loc26_41.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc26_41.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc26_41.2: type = converted %int_literal.make_type, %.loc26_41.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAdd2.decl: %MixedAdd2.type = fn_decl @MixedAdd2 [template = constants.%MixedAdd2] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %int_32.loc31_47: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc31_47: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc31_33.3: type = splice_block %.loc31_33.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc31_33.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc31_33.2: type = converted %int_literal.make_type, %.loc31_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc31_39: type = splice_block %i32.loc31_39 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc31_39: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc31_39: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 +// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAdd3.decl: %MixedAdd3.type = fn_decl @MixedAdd3 [template = constants.%MixedAdd3] { +// CHECK:STDOUT: %a.patt: %i32 = binding_pattern a +// CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc36_47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc36_51: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc36_63: init type = call %IntLiteral.ref.loc36_51() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc36_63.1: type = value_of_initializer %int_literal.make_type.loc36_63 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc36_63.2: type = converted %int_literal.make_type.loc36_63, %.loc36_63.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 +// CHECK:STDOUT: %.loc36_17: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: %i32 = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc36_41.3: type = splice_block %.loc36_41.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc36_25: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc36_29: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc36_41: init type = call %IntLiteral.ref.loc36_29() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc36_41.1: type = value_of_initializer %int_literal.make_type.loc36_41 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc36_41.2: type = converted %int_literal.make_type.loc36_41, %.loc36_41.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %MixedAdd4.decl: %MixedAdd4.type = fn_decl @MixedAdd4 [template = constants.%MixedAdd4] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: %i32 = binding_pattern b +// CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc41_47: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc41_51: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc41_63: init type = call %IntLiteral.ref.loc41_51() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc41_63.1: type = value_of_initializer %int_literal.make_type.loc41_63 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc41_63.2: type = converted %int_literal.make_type.loc41_63, %.loc41_63.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc41_33.3: type = splice_block %.loc41_33.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc41_17: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc41_21: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.6 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc41_33: init type = call %IntLiteral.ref.loc41_21() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc41_33.1: type = value_of_initializer %int_literal.make_type.loc41_33 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc41_33.2: type = converted %int_literal.make_type.loc41_33, %.loc41_33.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 +// CHECK:STDOUT: %.loc41_39: type = splice_block %i32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: %i32 = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var // CHECK:STDOUT: %too_many.var: ref = var too_many @@ -1152,12 +1308,12 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc46_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc68_33: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc68_33: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc46: type = splice_block %i32.loc46_25 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc46_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc46_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc68: type = splice_block %i32.loc68_25 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc68_25: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc68_25: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 @@ -1173,24 +1329,24 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param3 // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc50_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %int_32.loc72_50: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc72_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc50_26: type = splice_block %i32.loc50_26 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc72_26: type = splice_block %i32.loc72_26 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc72_26: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc72_26: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc50_34: type = splice_block %i32.loc50_34 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc72_34: type = splice_block %i32.loc72_34 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc72_34: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc72_34: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param // CHECK:STDOUT: %c.param: %i32 = value_param runtime_param2 -// CHECK:STDOUT: %.loc50_42: type = splice_block %i32.loc50_42 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc50_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc50_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc72_42: type = splice_block %i32.loc72_42 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc72_42: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc72_42: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %i32 = bind_name c, %c.param // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param3 @@ -1205,18 +1361,18 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %return.param_patt: bool = out_param_pattern %return.patt, runtime_param2 // CHECK:STDOUT: } { // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool] -// CHECK:STDOUT: %.loc54_48.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc54_48.2: type = converted %bool.make_type, %.loc54_48.1 [template = bool] +// CHECK:STDOUT: %.loc76_48.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc76_48.2: type = converted %bool.make_type, %.loc76_48.1 [template = bool] // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0 -// CHECK:STDOUT: %.loc54_32: type = splice_block %i32.loc54_32 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc54_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc76_32: type = splice_block %i32.loc76_32 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc76_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc76_32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param // CHECK:STDOUT: %b.param: %i32 = value_param runtime_param1 -// CHECK:STDOUT: %.loc54_40: type = splice_block %i32.loc54_40 [template = constants.%i32] { -// CHECK:STDOUT: %int_32.loc54_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %.loc76_40: type = splice_block %i32.loc76_40 [template = constants.%i32] { +// CHECK:STDOUT: %int_32.loc76_40: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc76_40: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param runtime_param2 @@ -1232,14 +1388,22 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @JustRight(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sadd"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAdd1(%a.param_patt: %i32, %b.param_patt: Core.IntLiteral) -> %i32; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAdd2(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> %i32; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAdd3(%a.param_patt: %i32, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral; +// CHECK:STDOUT: +// CHECK:STDOUT: fn @MixedAdd4(%a.param_patt: Core.IntLiteral, %b.param_patt: %i32) -> Core.IntLiteral; +// CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a.param_patt: %i32) -> %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TooFew.ref: %TooFew.type = name_ref TooFew, file.%TooFew.decl [template = constants.%TooFew] // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init %i32 = call %TooFew.ref(%a.ref) -// CHECK:STDOUT: %.loc47_19.1: %i32 = value_of_initializer %TooFew.call -// CHECK:STDOUT: %.loc47_19.2: %i32 = converted %TooFew.call, %.loc47_19.1 -// CHECK:STDOUT: return %.loc47_19.2 +// CHECK:STDOUT: %.loc69_19.1: %i32 = value_of_initializer %TooFew.call +// CHECK:STDOUT: %.loc69_19.2: %i32 = converted %TooFew.call, %.loc69_19.1 +// CHECK:STDOUT: return %.loc69_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a.param_patt: %i32, %b.param_patt: %i32, %c.param_patt: %i32) -> %i32 { @@ -1249,9 +1413,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: %i32 = name_ref c, %c // CHECK:STDOUT: %TooMany.call: init %i32 = call %TooMany.ref(%a.ref, %b.ref, %c.ref) -// CHECK:STDOUT: %.loc51_26.1: %i32 = value_of_initializer %TooMany.call -// CHECK:STDOUT: %.loc51_26.2: %i32 = converted %TooMany.call, %.loc51_26.1 -// CHECK:STDOUT: return %.loc51_26.2 +// CHECK:STDOUT: %.loc73_26.1: %i32 = value_of_initializer %TooMany.call +// CHECK:STDOUT: %.loc73_26.2: %i32 = converted %TooMany.call, %.loc73_26.1 +// CHECK:STDOUT: return %.loc73_26.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a.param_patt: %i32, %b.param_patt: %i32) -> bool { @@ -1260,9 +1424,9 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: %a.ref: %i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: %i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc55_29.1: bool = value_of_initializer %BadReturnType.call -// CHECK:STDOUT: %.loc55_29.2: bool = converted %BadReturnType.call, %.loc55_29.1 -// CHECK:STDOUT: return %.loc55_29.2 +// CHECK:STDOUT: %.loc77_29.1: bool = value_of_initializer %BadReturnType.call +// CHECK:STDOUT: %.loc77_29.2: bool = converted %BadReturnType.call, %.loc77_29.1 +// CHECK:STDOUT: return %.loc77_29.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_overflow.carbon diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 85fa8302efd39..edc10b3242983 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -28,23 +28,38 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; fn Negate(a: i32) -> i32 = "int.snegate"; // -0x7FFF_FFFF / -1 is OK. -let a: i32 = Div(Negate(0x7FFF_FFFF), Negate(1)); +let a: i32 = Div(-0x7FFF_FFFF, -1); // -0x8000_0000 / 1 is OK. -let b: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), 1); +let b: i32 = Div(-0x8000_0000, 1); // -0x8000_0000 / -1 overflows. // CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] -// CHECK:STDERR: let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: let c: i32 = Div(-0x8000_0000, -1); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); +let c: i32 = Div(-0x8000_0000, -1); + +// --- literal_no_overflow.carbon + +library "[[@TEST_NAME]]"; + +fn Div(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sdiv"; + +class Expect(N:! Core.IntLiteral()) {} +fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; } + +fn F() { + Test(Div(-0x8000_0000, -1)) as Expect(0x8000_0000); + Test(Div(-0x8000_0000_0000_0000, -1)) as Expect(0x8000_0000_0000_0000); +} // --- fail_div_by_zero.carbon package FailDivByZero; fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; +fn DivLit(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.sdiv"; // CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let a: i32 = Div(1, 0); @@ -52,11 +67,24 @@ fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero] // CHECK:STDERR: let b: i32 = Div(0, 0); // CHECK:STDERR: ^~~~~~~~~ +// CHECK:STDERR: let b: i32 = Div(0, 0); +// IntLiteral allows "overflow" by widening its representation, but not overflow to infinity. +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:28: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: let c: Core.IntLiteral() = DivLit(1, 0); +// CHECK:STDERR: ^~~~~~~~~~~~ +// CHECK:STDERR: +let c: Core.IntLiteral() = DivLit(1, 0); + +// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:28: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: let d: Core.IntLiteral() = DivLit(0, 0); +// CHECK:STDERR: ^~~~~~~~~~~~ +let d: Core.IntLiteral() = DivLit(0, 0); + // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -176,26 +204,42 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %Negate.type.1: type = fn_type @Negate.1 [template] // CHECK:STDOUT: %Negate: %Negate.type.1 = struct_value () [template] // CHECK:STDOUT: %int_2147483647.1: Core.IntLiteral = int_value 2147483647 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_2147483647.1, %Op.2 [template] +// CHECK:STDOUT: %int_-2147483647.1: Core.IntLiteral = int_value -2147483647 [template] +// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_1.1, %Op.2 [template] +// CHECK:STDOUT: %int_-1.1: Core.IntLiteral = int_value -1 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.1(%int_32) [template] +// CHECK:STDOUT: %Convert.type.10: type = fn_type @Convert.2, @impl.7(%int_32) [template] // CHECK:STDOUT: %Convert.10: %Convert.type.10 = struct_value () [template] -// CHECK:STDOUT: %interface.19: = interface_witness (%Convert.10) [template] -// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_2147483647.1, %Convert.10 [template] +// CHECK:STDOUT: %interface.20: = interface_witness (%Convert.10) [template] +// CHECK:STDOUT: %Convert.bound.1: = bound_method %int_-2147483647.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.2(%int_32) [template] -// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] -// CHECK:STDOUT: %int_-2147483647: %i32 = int_value -2147483647 [template] -// CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %int_-2147483647.2: %i32 = int_value -2147483647 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_-1.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-1.2: %i32 = int_value -1 [template] +// CHECK:STDOUT: %int_2147483647.2: %i32 = int_value 2147483647 [template] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_2147483648, %Op.2 [template] +// CHECK:STDOUT: %int_-2147483648.1: Core.IntLiteral = int_value -2147483648 [template] +// CHECK:STDOUT: %Convert.bound.3: = bound_method %int_-2147483648.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.3: = specific_function %Convert.bound.3, @Convert.2(%int_32) [template] +// CHECK:STDOUT: %int_-2147483648.2: %i32 = int_value -2147483648 [template] +// CHECK:STDOUT: %Convert.bound.4: = bound_method %int_1.1, %Convert.10 [template] +// CHECK:STDOUT: %Convert.specific_fn.4: = specific_function %Convert.bound.4, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] -// CHECK:STDOUT: %int_-1: %i32 = int_value -1 [template] -// CHECK:STDOUT: %int_-2147483648: %i32 = int_value -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .Negate = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.43 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -290,107 +334,359 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Div.ref.loc9: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Negate.ref.loc9_18: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc9: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc9_25: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_25: = bound_method %int_2147483647.loc9, %impl.elem0.loc9_25 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc9_25: = specific_function %Convert.bound.loc9_25, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc9_25: init %i32 = call %Convert.specific_fn.loc9_25(%int_2147483647.loc9) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.1: %i32 = value_of_initializer %int.convert_checked.loc9_25 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_25.2: %i32 = converted %int_2147483647.loc9, %.loc9_25.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc9_36: init %i32 = call %Negate.ref.loc9_18(%.loc9_25.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %Negate.ref.loc9_39: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] +// CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] +// CHECK:STDOUT: %impl.elem0.loc9_18.1: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc9_18: = bound_method %int_2147483647, %impl.elem0.loc9_18.1 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc9_18: init Core.IntLiteral = call %Op.bound.loc9_18(%int_2147483647) [template = constants.%int_-2147483647.1] // CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc9_46: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc9_46: = bound_method %int_1.loc9, %impl.elem0.loc9_46 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc9_46: = specific_function %Convert.bound.loc9_46, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc9_46: init %i32 = call %Convert.specific_fn.loc9_46(%int_1.loc9) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.1: %i32 = value_of_initializer %int.convert_checked.loc9_46 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc9_46.2: %i32 = converted %int_1.loc9, %.loc9_46.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc9_47: init %i32 = call %Negate.ref.loc9_39(%.loc9_46.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_36.1: %i32 = value_of_initializer %int.snegate.loc9_36 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_36.2: %i32 = converted %int.snegate.loc9_36, %.loc9_36.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc9_47.1: %i32 = value_of_initializer %int.snegate.loc9_47 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc9_47.2: %i32 = converted %int.snegate.loc9_47, %.loc9_47.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.sdiv.loc9: init %i32 = call %Div.ref.loc9(%.loc9_36.2, %.loc9_47.2) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_49.1: %i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc9_49.2: %i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_49.2 +// CHECK:STDOUT: %impl.elem0.loc9_32.1: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc9_32: = bound_method %int_1.loc9, %impl.elem0.loc9_32.1 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc9_32: init Core.IntLiteral = call %Op.bound.loc9_32(%int_1.loc9) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc9_18.2: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc9_18: = bound_method %int.snegate.loc9_18, %impl.elem0.loc9_18.2 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc9_18: = specific_function %Convert.bound.loc9_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %.loc9_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc9_18 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %.loc9_18.2: Core.IntLiteral = converted %int.snegate.loc9_18, %.loc9_18.1 [template = constants.%int_-2147483647.1] +// CHECK:STDOUT: %int.convert_checked.loc9_18: init %i32 = call %Convert.specific_fn.loc9_18(%.loc9_18.2) [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %.loc9_18.3: %i32 = value_of_initializer %int.convert_checked.loc9_18 [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %.loc9_18.4: %i32 = converted %int.snegate.loc9_18, %.loc9_18.3 [template = constants.%int_-2147483647.2] +// CHECK:STDOUT: %impl.elem0.loc9_32.2: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc9_32: = bound_method %int.snegate.loc9_32, %impl.elem0.loc9_32.2 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc9_32: = specific_function %Convert.bound.loc9_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %.loc9_32.1: Core.IntLiteral = value_of_initializer %int.snegate.loc9_32 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc9_32.2: Core.IntLiteral = converted %int.snegate.loc9_32, %.loc9_32.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc9_32: init %i32 = call %Convert.specific_fn.loc9_32(%.loc9_32.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc9_32.3: %i32 = value_of_initializer %int.convert_checked.loc9_32 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc9_32.4: %i32 = converted %int.snegate.loc9_32, %.loc9_32.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.sdiv.loc9: init %i32 = call %Div.ref.loc9(%.loc9_18.4, %.loc9_32.4) [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc9_35.1: %i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %.loc9_35.2: %i32 = converted %int.sdiv.loc9, %.loc9_35.1 [template = constants.%int_2147483647.2] +// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc9_35.2 // CHECK:STDOUT: %Div.ref.loc12: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc12: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc12: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc12: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc12_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_29: = bound_method %int_2147483647.loc12, %impl.elem0.loc12_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc12_29: = specific_function %Convert.bound.loc12_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc12_29: init %i32 = call %Convert.specific_fn.loc12_29(%int_2147483647.loc12) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.1: %i32 = value_of_initializer %int.convert_checked.loc12_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc12_29.2: %i32 = converted %int_2147483647.loc12, %.loc12_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc12: init %i32 = call %Negate.ref.loc12(%.loc12_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc12_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_40.1: %i32 = value_of_initializer %int.snegate.loc12 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc12_40.2: %i32 = converted %int.snegate.loc12, %.loc12_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc12_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_43: = bound_method %int_1.loc12_43, %impl.elem0.loc12_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_43: = specific_function %Convert.bound.loc12_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_43: init %i32 = call %Convert.specific_fn.loc12_43(%int_1.loc12_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.1: %i32 = value_of_initializer %int.convert_checked.loc12_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_43.2: %i32 = converted %int_1.loc12_43, %.loc12_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc12: init %i32 = call %Sub.ref.loc12(%.loc12_40.2, %.loc12_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %int_1.loc12_47: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc12_44.1: %i32 = value_of_initializer %int.ssub.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_44.2: %i32 = converted %int.ssub.loc12, %.loc12_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %impl.elem0.loc12_47: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc12_47: = bound_method %int_1.loc12_47, %impl.elem0.loc12_47 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc12_47: = specific_function %Convert.bound.loc12_47, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc12_47: init %i32 = call %Convert.specific_fn.loc12_47(%int_1.loc12_47) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.1: %i32 = value_of_initializer %int.convert_checked.loc12_47 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc12_47.2: %i32 = converted %int_1.loc12_47, %.loc12_47.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.sdiv.loc12: init %i32 = call %Div.ref.loc12(%.loc12_44.2, %.loc12_47.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc12_49.2: %i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_49.2 +// CHECK:STDOUT: %int_2147483648.loc12: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %impl.elem0.loc12_18.1: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc12: = bound_method %int_2147483648.loc12, %impl.elem0.loc12_18.1 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc12: init Core.IntLiteral = call %Op.bound.loc12(%int_2147483648.loc12) [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc12_18.2: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_18: = bound_method %int.snegate.loc12, %impl.elem0.loc12_18.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc12_18: = specific_function %Convert.bound.loc12_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc12_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc12 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %.loc12_18.2: Core.IntLiteral = converted %int.snegate.loc12, %.loc12_18.1 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %int.convert_checked.loc12_18: init %i32 = call %Convert.specific_fn.loc12_18(%.loc12_18.2) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc12_18.3: %i32 = value_of_initializer %int.convert_checked.loc12_18 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc12_18.4: %i32 = converted %int.snegate.loc12, %.loc12_18.3 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %impl.elem0.loc12_32: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc12_32: = bound_method %int_1.loc12, %impl.elem0.loc12_32 [template = constants.%Convert.bound.4] +// CHECK:STDOUT: %Convert.specific_fn.loc12_32: = specific_function %Convert.bound.loc12_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.4] +// CHECK:STDOUT: %int.convert_checked.loc12_32: init %i32 = call %Convert.specific_fn.loc12_32(%int_1.loc12) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_32.1: %i32 = value_of_initializer %int.convert_checked.loc12_32 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc12_32.2: %i32 = converted %int_1.loc12, %.loc12_32.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %int.sdiv.loc12: init %i32 = call %Div.ref.loc12(%.loc12_18.4, %.loc12_32.2) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc12_34.1: %i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc12_34.2: %i32 = converted %int.sdiv.loc12, %.loc12_34.1 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc12_34.2 // CHECK:STDOUT: %Div.ref.loc19: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %Sub.ref.loc19: %Sub.type.1 = name_ref Sub, file.%Sub.decl [template = constants.%Sub] -// CHECK:STDOUT: %Negate.ref.loc19_22: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_2147483647.loc19: Core.IntLiteral = int_value 2147483647 [template = constants.%int_2147483647.1] -// CHECK:STDOUT: %impl.elem0.loc19_29: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_29: = bound_method %int_2147483647.loc19, %impl.elem0.loc19_29 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc19_29: = specific_function %Convert.bound.loc19_29, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc19_29: init %i32 = call %Convert.specific_fn.loc19_29(%int_2147483647.loc19) [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc19_29.1: %i32 = value_of_initializer %int.convert_checked.loc19_29 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %.loc19_29.2: %i32 = converted %int_2147483647.loc19, %.loc19_29.1 [template = constants.%int_2147483647.2] -// CHECK:STDOUT: %int.snegate.loc19_40: init %i32 = call %Negate.ref.loc19_22(%.loc19_29.2) [template = constants.%int_-2147483647] -// CHECK:STDOUT: %int_1.loc19_43: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %.loc19_40.1: %i32 = value_of_initializer %int.snegate.loc19_40 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %.loc19_40.2: %i32 = converted %int.snegate.loc19_40, %.loc19_40.1 [template = constants.%int_-2147483647] -// CHECK:STDOUT: %impl.elem0.loc19_43: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_43: = bound_method %int_1.loc19_43, %impl.elem0.loc19_43 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc19_43: = specific_function %Convert.bound.loc19_43, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc19_43: init %i32 = call %Convert.specific_fn.loc19_43(%int_1.loc19_43) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_43.1: %i32 = value_of_initializer %int.convert_checked.loc19_43 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_43.2: %i32 = converted %int_1.loc19_43, %.loc19_43.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.ssub.loc19: init %i32 = call %Sub.ref.loc19(%.loc19_40.2, %.loc19_43.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %Negate.ref.loc19_47: %Negate.type.1 = name_ref Negate, file.%Negate.decl [template = constants.%Negate] -// CHECK:STDOUT: %int_1.loc19_54: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %impl.elem0.loc19_54: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc19_54: = bound_method %int_1.loc19_54, %impl.elem0.loc19_54 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc19_54: = specific_function %Convert.bound.loc19_54, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc19_54: init %i32 = call %Convert.specific_fn.loc19_54(%int_1.loc19_54) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_54.1: %i32 = value_of_initializer %int.convert_checked.loc19_54 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc19_54.2: %i32 = converted %int_1.loc19_54, %.loc19_54.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %int.snegate.loc19_55: init %i32 = call %Negate.ref.loc19_47(%.loc19_54.2) [template = constants.%int_-1] -// CHECK:STDOUT: %.loc19_44.1: %i32 = value_of_initializer %int.ssub.loc19 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_44.2: %i32 = converted %int.ssub.loc19, %.loc19_44.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_55.1: %i32 = value_of_initializer %int.snegate.loc19_55 [template = constants.%int_-1] -// CHECK:STDOUT: %.loc19_55.2: %i32 = converted %int.snegate.loc19_55, %.loc19_55.1 [template = constants.%int_-1] -// CHECK:STDOUT: %int.sdiv.loc19: init %i32 = call %Div.ref.loc19(%.loc19_44.2, %.loc19_55.2) [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_57.1: %i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %.loc19_57.2: %i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%int_-2147483648] -// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc19_57.2 +// CHECK:STDOUT: %int_2147483648.loc19: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %impl.elem0.loc19_18.1: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_18: = bound_method %int_2147483648.loc19, %impl.elem0.loc19_18.1 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc19_18: init Core.IntLiteral = call %Op.bound.loc19_18(%int_2147483648.loc19) [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %impl.elem0.loc19_32.1: %Op.type.1 = interface_witness_access constants.%interface.1, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc19_32: = bound_method %int_1.loc19, %impl.elem0.loc19_32.1 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc19_32: init Core.IntLiteral = call %Op.bound.loc19_32(%int_1.loc19) [template = constants.%int_-1.1] +// CHECK:STDOUT: %impl.elem0.loc19_18.2: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc19_18: = bound_method %int.snegate.loc19_18, %impl.elem0.loc19_18.2 [template = constants.%Convert.bound.3] +// CHECK:STDOUT: %Convert.specific_fn.loc19_18: = specific_function %Convert.bound.loc19_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.3] +// CHECK:STDOUT: %.loc19_18.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_18 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %.loc19_18.2: Core.IntLiteral = converted %int.snegate.loc19_18, %.loc19_18.1 [template = constants.%int_-2147483648.1] +// CHECK:STDOUT: %int.convert_checked.loc19_18: init %i32 = call %Convert.specific_fn.loc19_18(%.loc19_18.2) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc19_18.3: %i32 = value_of_initializer %int.convert_checked.loc19_18 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc19_18.4: %i32 = converted %int.snegate.loc19_18, %.loc19_18.3 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %impl.elem0.loc19_32.2: %Convert.type.2 = interface_witness_access constants.%interface.20, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc19_32: = bound_method %int.snegate.loc19_32, %impl.elem0.loc19_32.2 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc19_32: = specific_function %Convert.bound.loc19_32, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %.loc19_32.1: Core.IntLiteral = value_of_initializer %int.snegate.loc19_32 [template = constants.%int_-1.1] +// CHECK:STDOUT: %.loc19_32.2: Core.IntLiteral = converted %int.snegate.loc19_32, %.loc19_32.1 [template = constants.%int_-1.1] +// CHECK:STDOUT: %int.convert_checked.loc19_32: init %i32 = call %Convert.specific_fn.loc19_32(%.loc19_32.2) [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc19_32.3: %i32 = value_of_initializer %int.convert_checked.loc19_32 [template = constants.%int_-1.2] +// CHECK:STDOUT: %.loc19_32.4: %i32 = converted %int.snegate.loc19_32, %.loc19_32.3 [template = constants.%int_-1.2] +// CHECK:STDOUT: %int.sdiv.loc19: init %i32 = call %Div.ref.loc19(%.loc19_18.4, %.loc19_32.4) [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc19_35.1: %i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %.loc19_35.2: %i32 = converted %int.sdiv.loc19, %.loc19_35.1 [template = constants.%int_-2147483648.2] +// CHECK:STDOUT: %c: %i32 = bind_name c, %.loc19_35.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- literal_no_overflow.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] +// CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] +// CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic] +// CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic] +// CHECK:STDOUT: %Expect.type: type = generic_class_type @Expect [template] +// CHECK:STDOUT: %Expect.generic: %Expect.type = struct_value () [template] +// CHECK:STDOUT: %Expect.1: type = class_type @Expect, @Expect(%N) [symbolic] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %Test.type: type = fn_type @Test [template] +// CHECK:STDOUT: %Test: %Test.type = struct_value () [template] +// CHECK:STDOUT: %require_complete: = require_complete_type %Expect.1 [symbolic] +// CHECK:STDOUT: %Expect.val.1: %Expect.1 = struct_value () [symbolic] +// CHECK:STDOUT: %F.type: type = fn_type @F [template] +// CHECK:STDOUT: %F: %F.type = struct_value () [template] +// CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %Op.bound.1: = bound_method %int_2147483648, %Op.2 [template] +// CHECK:STDOUT: %int_-2147483648: Core.IntLiteral = int_value -2147483648 [template] +// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template] +// CHECK:STDOUT: %Op.bound.2: = bound_method %int_1, %Op.2 [template] +// CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template] +// CHECK:STDOUT: %Expect.2: type = class_type @Expect, @Expect(%int_2147483648) [template] +// CHECK:STDOUT: %Test.specific_fn.1: = specific_function %Test, @Test(%int_2147483648) [template] +// CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [template] +// CHECK:STDOUT: %Op.bound.3: = bound_method %int_9223372036854775808, %Op.2 [template] +// CHECK:STDOUT: %int_-9223372036854775808: Core.IntLiteral = int_value -9223372036854775808 [template] +// CHECK:STDOUT: %Expect.3: type = class_type @Expect, @Expect(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Test.specific_fn.2: = specific_function %Test, @Test(%int_9223372036854775808) [template] +// CHECK:STDOUT: %Expect.val.2: %Expect.2 = struct_value () [template] +// CHECK:STDOUT: %Expect.val.3: %Expect.3 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { +// CHECK:STDOUT: .IntLiteral = %import_ref.1 +// CHECK:STDOUT: .Negate = %import_ref.2 +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: import Core//prelude/... +// CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.1: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Div = %Div.decl +// CHECK:STDOUT: .Expect = %Expect.decl +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc4_55: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_59: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_71: init type = call %IntLiteral.ref.loc4_59() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.1: type = value_of_initializer %int_literal.make_type.loc4_71 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_71.2: type = converted %int_literal.make_type.loc4_71, %.loc4_71.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc4_27.3: type = splice_block %.loc4_27.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_11: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_15: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_27: init type = call %IntLiteral.ref.loc4_15() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.1: type = value_of_initializer %int_literal.make_type.loc4_27 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_27.2: type = converted %int_literal.make_type.loc4_27, %.loc4_27.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc4_49.3: type = splice_block %.loc4_49.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc4_33: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc4_37: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc4_49: init type = call %IntLiteral.ref.loc4_37() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.1: type = value_of_initializer %int_literal.make_type.loc4_49 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc4_49.2: type = converted %int_literal.make_type.loc4_49, %.loc4_49.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %Expect.decl: %Expect.type = class_decl @Expect [template = constants.%Expect.generic] { +// CHECK:STDOUT: %N.patt.loc6_14.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_14.1, runtime_param [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %.loc6_34.3: type = splice_block %.loc6_34.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc6_34.2: type = converted %int_literal.make_type, %.loc6_34.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %N.loc6_14.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] { +// CHECK:STDOUT: %N.patt.loc7_9.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_9.1, runtime_param [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %return.patt: @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) = out_param_pattern %return.patt, runtime_param0 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Expect.ref: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc7_9.1 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %Expect.loc7_43.1: type = class_type @Expect, @Expect(constants.%N) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param +// CHECK:STDOUT: %.loc7_29.3: type = splice_block %.loc7_29.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.1 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc7_29.2: type = converted %int_literal.make_type, %.loc7_29.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %N.loc7_9.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %return.param: ref @Test.%Expect.loc7_43.2 (%Expect.1) = out_param runtime_param0 +// CHECK:STDOUT: %return: ref @Test.%Expect.loc7_43.2 (%Expect.1) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic class @Expect(%N.loc6_14.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc6_14.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_14.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc6_14.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_14.2 (constants.%N.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: class { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Expect.1 +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Div.1(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv"; +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Test(%N.loc7_9.1: Core.IntLiteral) { +// CHECK:STDOUT: %N.loc7_9.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_9.2 (constants.%N)] +// CHECK:STDOUT: %N.patt.loc7_9.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_9.2 (constants.%N.patt)] +// CHECK:STDOUT: %Expect.loc7_43.2: type = class_type @Expect, @Expect(%N.loc7_9.2) [symbolic = %Expect.loc7_43.2 (constants.%Expect.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete: = require_complete_type @Test.%Expect.loc7_43.2 (%Expect.1) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %Expect.val: @Test.%Expect.loc7_43.2 (%Expect.1) = struct_value () [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%N.param_patt: Core.IntLiteral) -> %return.param_patt: @Test.%Expect.loc7_43.2 (%Expect.1) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc7_55.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc7_55.2: init @Test.%Expect.loc7_43.2 (%Expect.1) = class_init (), %return [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: %.loc7_56: init @Test.%Expect.loc7_43.2 (%Expect.1) = converted %.loc7_55.1, %.loc7_55.2 [symbolic = %Expect.val (constants.%Expect.val.1)] +// CHECK:STDOUT: return %.loc7_56 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Test.ref.loc10: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Div.ref.loc10: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] +// CHECK:STDOUT: %int_2147483648.loc10_13: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %impl.elem0.loc10_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc10_12: = bound_method %int_2147483648.loc10_13, %impl.elem0.loc10_12 [template = constants.%Op.bound.1] +// CHECK:STDOUT: %int.snegate.loc10_12: init Core.IntLiteral = call %Op.bound.loc10_12(%int_2147483648.loc10_13) [template = constants.%int_-2147483648] +// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc10_26: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc10_26: = bound_method %int_1.loc10, %impl.elem0.loc10_26 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc10_26: init Core.IntLiteral = call %Op.bound.loc10_26(%int_1.loc10) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc10_12 [template = constants.%int_-2147483648] +// CHECK:STDOUT: %.loc10_12.2: Core.IntLiteral = converted %int.snegate.loc10_12, %.loc10_12.1 [template = constants.%int_-2147483648] +// CHECK:STDOUT: %.loc10_26.1: Core.IntLiteral = value_of_initializer %int.snegate.loc10_26 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc10_26.2: Core.IntLiteral = converted %int.snegate.loc10_26, %.loc10_26.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.sdiv.loc10: init Core.IntLiteral = call %Div.ref.loc10(%.loc10_12.2, %.loc10_26.2) [template = constants.%int_2147483648] +// CHECK:STDOUT: %.loc10_29.1: Core.IntLiteral = value_of_initializer %int.sdiv.loc10 [template = constants.%int_2147483648] +// CHECK:STDOUT: %.loc10_29.2: Core.IntLiteral = converted %int.sdiv.loc10, %.loc10_29.1 [template = constants.%int_2147483648] +// CHECK:STDOUT: %Test.specific_fn.loc10: = specific_function %Test.ref.loc10, @Test(constants.%int_2147483648) [template = constants.%Test.specific_fn.1] +// CHECK:STDOUT: %.loc10_29.3: ref %Expect.2 = temporary_storage +// CHECK:STDOUT: %Test.call.loc10: init %Expect.2 = call %Test.specific_fn.loc10() to %.loc10_29.3 +// CHECK:STDOUT: %Expect.ref.loc10: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_2147483648.loc10_41: Core.IntLiteral = int_value 2147483648 [template = constants.%int_2147483648] +// CHECK:STDOUT: %Expect.loc10: type = class_type @Expect, @Expect(constants.%int_2147483648) [template = constants.%Expect.2] +// CHECK:STDOUT: %.loc10_29.4: ref %Expect.2 = temporary %.loc10_29.3, %Test.call.loc10 +// CHECK:STDOUT: %Test.ref.loc11: %Test.type = name_ref Test, file.%Test.decl [template = constants.%Test] +// CHECK:STDOUT: %Div.ref.loc11: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] +// CHECK:STDOUT: %int_9223372036854775808.loc11_13: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %impl.elem0.loc11_12: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc11_12: = bound_method %int_9223372036854775808.loc11_13, %impl.elem0.loc11_12 [template = constants.%Op.bound.3] +// CHECK:STDOUT: %int.snegate.loc11_12: init Core.IntLiteral = call %Op.bound.loc11_12(%int_9223372036854775808.loc11_13) [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1] +// CHECK:STDOUT: %impl.elem0.loc11_36: %Op.type.1 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %Op.bound.loc11_36: = bound_method %int_1.loc11, %impl.elem0.loc11_36 [template = constants.%Op.bound.2] +// CHECK:STDOUT: %int.snegate.loc11_36: init Core.IntLiteral = call %Op.bound.loc11_36(%int_1.loc11) [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_12.1: Core.IntLiteral = value_of_initializer %int.snegate.loc11_12 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc11_12.2: Core.IntLiteral = converted %int.snegate.loc11_12, %.loc11_12.1 [template = constants.%int_-9223372036854775808] +// CHECK:STDOUT: %.loc11_36.1: Core.IntLiteral = value_of_initializer %int.snegate.loc11_36 [template = constants.%int_-1] +// CHECK:STDOUT: %.loc11_36.2: Core.IntLiteral = converted %int.snegate.loc11_36, %.loc11_36.1 [template = constants.%int_-1] +// CHECK:STDOUT: %int.sdiv.loc11: init Core.IntLiteral = call %Div.ref.loc11(%.loc11_12.2, %.loc11_36.2) [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc11_39.1: Core.IntLiteral = value_of_initializer %int.sdiv.loc11 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %.loc11_39.2: Core.IntLiteral = converted %int.sdiv.loc11, %.loc11_39.1 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Test.specific_fn.loc11: = specific_function %Test.ref.loc11, @Test(constants.%int_9223372036854775808) [template = constants.%Test.specific_fn.2] +// CHECK:STDOUT: %.loc11_39.3: ref %Expect.3 = temporary_storage +// CHECK:STDOUT: %Test.call.loc11: init %Expect.3 = call %Test.specific_fn.loc11() to %.loc11_39.3 +// CHECK:STDOUT: %Expect.ref.loc11: %Expect.type = name_ref Expect, file.%Expect.decl [template = constants.%Expect.generic] +// CHECK:STDOUT: %int_9223372036854775808.loc11_51: Core.IntLiteral = int_value 9223372036854775808 [template = constants.%int_9223372036854775808] +// CHECK:STDOUT: %Expect.loc11: type = class_type @Expect, @Expect(constants.%int_9223372036854775808) [template = constants.%Expect.3] +// CHECK:STDOUT: %.loc11_39.4: ref %Expect.3 = temporary %.loc11_39.3, %Test.call.loc11 +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%N) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%N +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(@Test.%N.loc7_9.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%N) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%N +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%N +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_2147483648) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_2147483648 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_2147483648 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.2 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_2147483648) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_2147483648 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_2147483648 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Test(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc7_9.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %Expect.loc7_43.2 => constants.%Expect.3 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %require_complete => constants.%complete_type +// CHECK:STDOUT: %Expect.val => constants.%Expect.val.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Expect(constants.%int_9223372036854775808) { +// CHECK:STDOUT: %N.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: %N.patt.loc6_14.2 => constants.%int_9223372036854775808 +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -398,6 +694,10 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] // CHECK:STDOUT: %Div.type.1: type = fn_type @Div.1 [template] // CHECK:STDOUT: %Div: %Div.type.1 = struct_value () [template] +// CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template] +// CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template] +// CHECK:STDOUT: %DivLit.type: type = fn_type @DivLit [template] +// CHECK:STDOUT: %DivLit: %DivLit.type = struct_value () [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] @@ -415,18 +715,23 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [template] { // CHECK:STDOUT: .Int = %import_ref.1 -// CHECK:STDOUT: .ImplicitAs = %import_ref.5 +// CHECK:STDOUT: .IntLiteral = %import_ref.5 +// CHECK:STDOUT: .ImplicitAs = %import_ref.6 // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %import_ref.5: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .Div = %Div.decl +// CHECK:STDOUT: .DivLit = %DivLit.decl // CHECK:STDOUT: .a = @__global_init.%a // CHECK:STDOUT: .b = @__global_init.%b +// CHECK:STDOUT: .c = @__global_init.%c +// CHECK:STDOUT: .d = @__global_init.%d // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Div.decl: %Div.type.1 = fn_decl @Div.1 [template = constants.%Div] { @@ -454,50 +759,100 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } +// CHECK:STDOUT: %DivLit.decl: %DivLit.type = fn_decl @DivLit [template = constants.%DivLit] { +// CHECK:STDOUT: %a.patt: Core.IntLiteral = binding_pattern a +// CHECK:STDOUT: %a.param_patt: Core.IntLiteral = value_param_pattern %a.patt, runtime_param0 +// CHECK:STDOUT: %b.patt: Core.IntLiteral = binding_pattern b +// CHECK:STDOUT: %b.param_patt: Core.IntLiteral = value_param_pattern %b.patt, runtime_param1 +// CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: Core.IntLiteral = out_param_pattern %return.patt, runtime_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Core.ref.loc5_58: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_62: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_74: init type = call %IntLiteral.ref.loc5_62() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_74.1: type = value_of_initializer %int_literal.make_type.loc5_74 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_74.2: type = converted %int_literal.make_type.loc5_74, %.loc5_74.1 [template = Core.IntLiteral] +// CHECK:STDOUT: %a.param: Core.IntLiteral = value_param runtime_param0 +// CHECK:STDOUT: %.loc5_30.3: type = splice_block %.loc5_30.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc5_14: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_18: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_30: init type = call %IntLiteral.ref.loc5_18() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_30.1: type = value_of_initializer %int_literal.make_type.loc5_30 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_30.2: type = converted %int_literal.make_type.loc5_30, %.loc5_30.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %a: Core.IntLiteral = bind_name a, %a.param +// CHECK:STDOUT: %b.param: Core.IntLiteral = value_param runtime_param1 +// CHECK:STDOUT: %.loc5_52.3: type = splice_block %.loc5_52.2 [template = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc5_36: = name_ref Core, imports.%Core [template = imports.%Core] +// CHECK:STDOUT: %IntLiteral.ref.loc5_40: %IntLiteral.type = name_ref IntLiteral, imports.%import_ref.5 [template = constants.%IntLiteral] +// CHECK:STDOUT: %int_literal.make_type.loc5_52: init type = call %IntLiteral.ref.loc5_40() [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_52.1: type = value_of_initializer %int_literal.make_type.loc5_52 [template = Core.IntLiteral] +// CHECK:STDOUT: %.loc5_52.2: type = converted %int_literal.make_type.loc5_52, %.loc5_52.1 [template = Core.IntLiteral] +// CHECK:STDOUT: } +// CHECK:STDOUT: %b: Core.IntLiteral = bind_name b, %b.param +// CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param runtime_param2 +// CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Div.1(%a.param_patt: %i32, %b.param_patt: %i32) -> %i32 = "int.sdiv"; // CHECK:STDOUT: +// CHECK:STDOUT: fn @DivLit(%a.param_patt: Core.IntLiteral, %b.param_patt: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv"; +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref.loc10: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] -// CHECK:STDOUT: %int_0.loc10: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc10_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_18: = bound_method %int_1, %impl.elem0.loc10_18 [template = constants.%Convert.bound.1] -// CHECK:STDOUT: %Convert.specific_fn.loc10_18: = specific_function %Convert.bound.loc10_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] -// CHECK:STDOUT: %int.convert_checked.loc10_18: init %i32 = call %Convert.specific_fn.loc10_18(%int_1) [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.1: %i32 = value_of_initializer %int.convert_checked.loc10_18 [template = constants.%int_1.2] -// CHECK:STDOUT: %.loc10_18.2: %i32 = converted %int_1, %.loc10_18.1 [template = constants.%int_1.2] -// CHECK:STDOUT: %impl.elem0.loc10_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc10_21: = bound_method %int_0.loc10, %impl.elem0.loc10_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc10_21: = specific_function %Convert.bound.loc10_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc10_21: init %i32 = call %Convert.specific_fn.loc10_21(%int_0.loc10) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.1: %i32 = value_of_initializer %int.convert_checked.loc10_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc10_21.2: %i32 = converted %int_0.loc10, %.loc10_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.sdiv.loc10: init %i32 = call %Div.ref.loc10(%.loc10_18.2, %.loc10_21.2) [template = ] -// CHECK:STDOUT: %.loc10_23.1: %i32 = value_of_initializer %int.sdiv.loc10 [template = ] -// CHECK:STDOUT: %.loc10_23.2: %i32 = converted %int.sdiv.loc10, %.loc10_23.1 [template = ] -// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] -// CHECK:STDOUT: %int_0.loc15_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %int_0.loc15_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] -// CHECK:STDOUT: %impl.elem0.loc15_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_18: = bound_method %int_0.loc15_18, %impl.elem0.loc15_18 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_18: = specific_function %Convert.bound.loc15_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_18: init %i32 = call %Convert.specific_fn.loc15_18(%int_0.loc15_18) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.1: %i32 = value_of_initializer %int.convert_checked.loc15_18 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_18.2: %i32 = converted %int_0.loc15_18, %.loc15_18.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc15_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] -// CHECK:STDOUT: %Convert.bound.loc15_21: = bound_method %int_0.loc15_21, %impl.elem0.loc15_21 [template = constants.%Convert.bound.2] -// CHECK:STDOUT: %Convert.specific_fn.loc15_21: = specific_function %Convert.bound.loc15_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] -// CHECK:STDOUT: %int.convert_checked.loc15_21: init %i32 = call %Convert.specific_fn.loc15_21(%int_0.loc15_21) [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.1: %i32 = value_of_initializer %int.convert_checked.loc15_21 [template = constants.%int_0.2] -// CHECK:STDOUT: %.loc15_21.2: %i32 = converted %int_0.loc15_21, %.loc15_21.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %int.sdiv.loc15: init %i32 = call %Div.ref.loc15(%.loc15_18.2, %.loc15_21.2) [template = ] -// CHECK:STDOUT: %.loc15_23.1: %i32 = value_of_initializer %int.sdiv.loc15 [template = ] -// CHECK:STDOUT: %.loc15_23.2: %i32 = converted %int.sdiv.loc15, %.loc15_23.1 [template = ] -// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc15_23.2 +// CHECK:STDOUT: %Div.ref.loc11: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] +// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_0.loc11: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc11_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_18: = bound_method %int_1.loc11, %impl.elem0.loc11_18 [template = constants.%Convert.bound.1] +// CHECK:STDOUT: %Convert.specific_fn.loc11_18: = specific_function %Convert.bound.loc11_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.1] +// CHECK:STDOUT: %int.convert_checked.loc11_18: init %i32 = call %Convert.specific_fn.loc11_18(%int_1.loc11) [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_18.1: %i32 = value_of_initializer %int.convert_checked.loc11_18 [template = constants.%int_1.2] +// CHECK:STDOUT: %.loc11_18.2: %i32 = converted %int_1.loc11, %.loc11_18.1 [template = constants.%int_1.2] +// CHECK:STDOUT: %impl.elem0.loc11_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc11_21: = bound_method %int_0.loc11, %impl.elem0.loc11_21 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc11_21: = specific_function %Convert.bound.loc11_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc11_21: init %i32 = call %Convert.specific_fn.loc11_21(%int_0.loc11) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_21.1: %i32 = value_of_initializer %int.convert_checked.loc11_21 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_0.loc11, %.loc11_21.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.sdiv.loc11: init %i32 = call %Div.ref.loc11(%.loc11_18.2, %.loc11_21.2) [template = ] +// CHECK:STDOUT: %.loc11_23.1: %i32 = value_of_initializer %int.sdiv.loc11 [template = ] +// CHECK:STDOUT: %.loc11_23.2: %i32 = converted %int.sdiv.loc11, %.loc11_23.1 [template = ] +// CHECK:STDOUT: %a: %i32 = bind_name a, %.loc11_23.2 +// CHECK:STDOUT: %Div.ref.loc17: %Div.type.1 = name_ref Div, file.%Div.decl [template = constants.%Div] +// CHECK:STDOUT: %int_0.loc17_18: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc17_21: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %impl.elem0.loc17_18: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_18: = bound_method %int_0.loc17_18, %impl.elem0.loc17_18 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc17_18: = specific_function %Convert.bound.loc17_18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc17_18: init %i32 = call %Convert.specific_fn.loc17_18(%int_0.loc17_18) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc17_18.1: %i32 = value_of_initializer %int.convert_checked.loc17_18 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc17_18.2: %i32 = converted %int_0.loc17_18, %.loc17_18.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %impl.elem0.loc17_21: %Convert.type.2 = interface_witness_access constants.%interface.19, element0 [template = constants.%Convert.10] +// CHECK:STDOUT: %Convert.bound.loc17_21: = bound_method %int_0.loc17_21, %impl.elem0.loc17_21 [template = constants.%Convert.bound.2] +// CHECK:STDOUT: %Convert.specific_fn.loc17_21: = specific_function %Convert.bound.loc17_21, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.2] +// CHECK:STDOUT: %int.convert_checked.loc17_21: init %i32 = call %Convert.specific_fn.loc17_21(%int_0.loc17_21) [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc17_21.1: %i32 = value_of_initializer %int.convert_checked.loc17_21 [template = constants.%int_0.2] +// CHECK:STDOUT: %.loc17_21.2: %i32 = converted %int_0.loc17_21, %.loc17_21.1 [template = constants.%int_0.2] +// CHECK:STDOUT: %int.sdiv.loc17: init %i32 = call %Div.ref.loc17(%.loc17_18.2, %.loc17_21.2) [template = ] +// CHECK:STDOUT: %.loc17_23.1: %i32 = value_of_initializer %int.sdiv.loc17 [template = ] +// CHECK:STDOUT: %.loc17_23.2: %i32 = converted %int.sdiv.loc17, %.loc17_23.1 [template = ] +// CHECK:STDOUT: %b: %i32 = bind_name b, %.loc17_23.2 +// CHECK:STDOUT: %DivLit.ref.loc24: %DivLit.type = name_ref DivLit, file.%DivLit.decl [template = constants.%DivLit] +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [template = constants.%int_1.1] +// CHECK:STDOUT: %int_0.loc24: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int.sdiv.loc24: init Core.IntLiteral = call %DivLit.ref.loc24(%int_1.loc24, %int_0.loc24) [template = ] +// CHECK:STDOUT: %.loc24_40.1: Core.IntLiteral = value_of_initializer %int.sdiv.loc24 [template = ] +// CHECK:STDOUT: %.loc24_40.2: Core.IntLiteral = converted %int.sdiv.loc24, %.loc24_40.1 [template = ] +// CHECK:STDOUT: %c: Core.IntLiteral = bind_name c, %.loc24_40.2 +// CHECK:STDOUT: %DivLit.ref.loc29: %DivLit.type = name_ref DivLit, file.%DivLit.decl [template = constants.%DivLit] +// CHECK:STDOUT: %int_0.loc29_35: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int_0.loc29_38: Core.IntLiteral = int_value 0 [template = constants.%int_0.1] +// CHECK:STDOUT: %int.sdiv.loc29: init Core.IntLiteral = call %DivLit.ref.loc29(%int_0.loc29_35, %int_0.loc29_38) [template = ] +// CHECK:STDOUT: %.loc29_40.1: Core.IntLiteral = value_of_initializer %int.sdiv.loc29 [template = ] +// CHECK:STDOUT: %.loc29_40.2: Core.IntLiteral = converted %int.sdiv.loc29, %.loc29_40.1 [template = ] +// CHECK:STDOUT: %d: Core.IntLiteral = bind_name d, %.loc29_40.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: From 26d9bc7d52fd9e86812f911c4a2659bc5de65720 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 20 Dec 2024 23:58:01 +0000 Subject: [PATCH 11/13] Add test for lowering mixed comparisons. --- toolchain/lower/testdata/builtins/int.carbon | 142 +++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index 12d0f65437fa0..d9273ef196cef 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -103,6 +103,32 @@ fn TestLeftShiftLargerUU(a: u16, b: u32) -> u16 { return LeftShiftLargerUU(a, b) fn RightShiftLargerUU(a: u16, b: u32) -> u16 = "int.right_shift"; fn TestRightShiftLargerUU(a: u16, b: u32) -> u16 { return RightShiftLargerUU(a, b); } +// --- mixed_compare.carbon + +fn Eq_u16_u32(a: u16, b: u32) -> bool = "int.eq"; +fn Eq_i16_u32(a: i16, b: u32) -> bool = "int.eq"; +fn Eq_u16_i32(a: u16, b: i32) -> bool = "int.eq"; +fn Eq_i16_i32(a: i16, b: i32) -> bool = "int.eq"; +fn Eq_i32_u32(a: i32, b: u32) -> bool = "int.eq"; + +fn TestEq_u16_u32(a: u16, b: u32) -> bool { return Eq_u16_u32(a, b); } +fn TestEq_i16_u32(a: i16, b: u32) -> bool { return Eq_i16_u32(a, b); } +fn TestEq_u16_i32(a: u16, b: i32) -> bool { return Eq_u16_i32(a, b); } +fn TestEq_i16_i32(a: i16, b: i32) -> bool { return Eq_i16_i32(a, b); } +fn TestEq_i32_u32(a: i32, b: u32) -> bool { return Eq_i32_u32(a, b); } + +fn Less_u16_u32(a: u16, b: u32) -> bool = "int.less"; +fn Less_i16_u32(a: i16, b: u32) -> bool = "int.less"; +fn Less_u16_i32(a: u16, b: i32) -> bool = "int.less"; +fn Less_i16_i32(a: i16, b: i32) -> bool = "int.less"; +fn Less_i32_u32(a: i32, b: u32) -> bool = "int.less"; + +fn TestLess_u16_u32(a: u16, b: u32) -> bool { return Less_u16_u32(a, b); } +fn TestLess_i16_u32(a: i16, b: u32) -> bool { return Less_i16_u32(a, b); } +fn TestLess_u16_i32(a: u16, b: i32) -> bool { return Less_u16_i32(a, b); } +fn TestLess_i16_i32(a: i16, b: i32) -> bool { return Less_i16_i32(a, b); } +fn TestLess_i32_u32(a: i32, b: u32) -> bool { return Less_i32_u32(a, b); } + // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: @@ -398,3 +424,119 @@ fn TestRightShiftLargerUU(a: u16, b: u32) -> u16 { return RightShiftLargerUU(a, // CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestRightShiftLargerUU", linkageName: "_CTestRightShiftLargerUU.Main", scope: null, file: !3, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2) // CHECK:STDOUT: !34 = !DILocation(line: 32, column: 59, scope: !33) // CHECK:STDOUT: !35 = !DILocation(line: 32, column: 52, scope: !33) +// CHECK:STDOUT: ; ModuleID = 'mixed_compare.carbon' +// CHECK:STDOUT: source_filename = "mixed_compare.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !7 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !7 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i33, !dbg !10 +// CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !10 +// CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !10 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = zext i16 %a to i32, !dbg !13 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !13 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = sext i16 %a to i32, !dbg !16 +// CHECK:STDOUT: %int.eq = icmp eq i32 %int.eq.lhs, %b, !dbg !16 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.eq.lhs = sext i32 %a to i33, !dbg !19 +// CHECK:STDOUT: %int.eq.rhs = zext i32 %b to i33, !dbg !19 +// CHECK:STDOUT: %int.eq = icmp eq i33 %int.eq.lhs, %int.eq.rhs, !dbg !19 +// CHECK:STDOUT: ret i1 %int.eq, !dbg !20 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !22 +// CHECK:STDOUT: %int.less = icmp ult i32 %int.less.lhs, %b, !dbg !22 +// CHECK:STDOUT: ret i1 %int.less, !dbg !23 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less.lhs = sext i16 %a to i33, !dbg !25 +// CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !25 +// CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !25 +// CHECK:STDOUT: ret i1 %int.less, !dbg !26 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less.lhs = zext i16 %a to i32, !dbg !28 +// CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !28 +// CHECK:STDOUT: ret i1 %int.less, !dbg !29 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less.lhs = sext i16 %a to i32, !dbg !31 +// CHECK:STDOUT: %int.less = icmp slt i32 %int.less.lhs, %b, !dbg !31 +// CHECK:STDOUT: ret i1 %int.less, !dbg !32 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %int.less.lhs = sext i32 %a to i33, !dbg !34 +// CHECK:STDOUT: %int.less.rhs = zext i32 %b to i33, !dbg !34 +// CHECK:STDOUT: %int.less = icmp slt i33 %int.less.lhs, %int.less.rhs, !dbg !34 +// CHECK:STDOUT: ret i1 %int.less, !dbg !35 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "mixed_compare.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestEq_u16_u32", linkageName: "_CTestEq_u16_u32.Main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 8, column: 52, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 8, column: 45, scope: !4) +// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestEq_i16_u32", linkageName: "_CTestEq_i16_u32.Main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !10 = !DILocation(line: 9, column: 52, scope: !9) +// CHECK:STDOUT: !11 = !DILocation(line: 9, column: 45, scope: !9) +// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestEq_u16_i32", linkageName: "_CTestEq_u16_i32.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !13 = !DILocation(line: 10, column: 52, scope: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 10, column: 45, scope: !12) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestEq_i16_i32", linkageName: "_CTestEq_i16_i32.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 11, column: 52, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 11, column: 45, scope: !15) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "TestEq_i32_u32", linkageName: "_CTestEq_i32_u32.Main", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DILocation(line: 12, column: 52, scope: !18) +// CHECK:STDOUT: !20 = !DILocation(line: 12, column: 45, scope: !18) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "TestLess_u16_u32", linkageName: "_CTestLess_u16_u32.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 54, scope: !21) +// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 47, scope: !21) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "TestLess_i16_u32", linkageName: "_CTestLess_i16_u32.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !25 = !DILocation(line: 21, column: 54, scope: !24) +// CHECK:STDOUT: !26 = !DILocation(line: 21, column: 47, scope: !24) +// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "TestLess_u16_i32", linkageName: "_CTestLess_u16_i32.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !28 = !DILocation(line: 22, column: 54, scope: !27) +// CHECK:STDOUT: !29 = !DILocation(line: 22, column: 47, scope: !27) +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "TestLess_i16_i32", linkageName: "_CTestLess_i16_i32.Main", scope: null, file: !3, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !31 = !DILocation(line: 23, column: 54, scope: !30) +// CHECK:STDOUT: !32 = !DILocation(line: 23, column: 47, scope: !30) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "TestLess_i32_u32", linkageName: "_CTestLess_i32_u32.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !34 = !DILocation(line: 24, column: 54, scope: !33) +// CHECK:STDOUT: !35 = !DILocation(line: 24, column: 47, scope: !33) From 93cd66c26e5f3a646ac6d0bc075f1b860fc79a41 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 30 Dec 2024 21:37:18 +0000 Subject: [PATCH 12/13] Comments and CHECKs for review comments. --- toolchain/check/eval.cpp | 12 +++++++++++- toolchain/lower/handle_call.cpp | 7 +++++-- toolchain/sem_ir/builtin_function_kind.cpp | 12 ++++++++---- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index a238076f06e7c..aa25e17109603 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -1055,7 +1055,16 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, if (result.overflow && !bit_width_id.is_valid()) { // Retry with a larger bit width. Most operations can only overflow by one - // bit, but signed n-bit multiplication can overflow to 2n-1 bits. + // bit, but signed n-bit multiplication can overflow to 2n-1 bits. We don't + // need to handle unsigned multiplication here because it's not permitted + // for unsized integers. + // + // Note that we speculatively first perform the calculation in the width of + // the wider operand: smaller operations are faster and overflow to a wider + // integer is unlikely to be needed, especially given that the width will + // have been rounded up to a multiple of 64 bits by the int store. + CARBON_CHECK(builtin_kind != SemIR::BuiltinFunctionKind::IntUMul, + "Unsigned arithmetic requires a fixed bitwidth"); int new_width = builtin_kind == SemIR::BuiltinFunctionKind::IntSMul ? lhs_val.getBitWidth() * 2 @@ -1068,6 +1077,7 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc, // `MaxIntWidth`. In that case we fall through to the signed overflow // diagnostic below. result = ComputeBinaryIntOpResult(builtin_kind, lhs_val, rhs_val); + CARBON_CHECK(!result.overflow || new_width == IntStore::MaxIntWidth); } if (result.overflow) { diff --git a/toolchain/lower/handle_call.cpp b/toolchain/lower/handle_call.cpp index 96f3ce4628d23..d246ed27455d5 100644 --- a/toolchain/lower/handle_call.cpp +++ b/toolchain/lower/handle_call.cpp @@ -83,9 +83,12 @@ static auto HandleIntShift(FunctionContext& context, SemIR::InstId inst_id, // Weirdly, LLVM requires the operands of bit shift operators to be of the // same type. We can always use the width of the LHS, because if the RHS - // doesn't fit in that then the cast is out of range anyway. + // doesn't fit in that then the cast is out of range anyway. Zero-extending is + // always fine because it's an error for the RHS to be negative. // - // TODO: In a development build we should trap in that case. + // TODO: In a development build we should trap if the RHS is signed and + // negative or greater than or equal to the number of bits in the left-hand + // type. rhs = context.builder().CreateZExtOrTrunc(rhs, lhs->getType(), "rhs"); context.SetLocal(inst_id, context.builder().CreateBinOp(bin_op, lhs, rhs)); diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index b6a54192cd6d4..8eb83d8521ca0 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -448,8 +448,10 @@ auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, case IntRightShift: // Shifts by an integer literal amount are compile-time only. We don't // have a value for the shift amount at runtime in general. - // TODO: We could allow these in the case where the shift amount has a - // compile-time value. + // TODO: Decide how shifting a non-literal by a literal amount should + // work. We could support these with a builtin in the case where the shift + // amount has a compile-time value, or we could perform a conversion in + // the prelude. if (sem_ir.types().Is( sem_ir.insts().Get(arg_ids[1]).type_id())) { return true; @@ -469,8 +471,10 @@ auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, // Comparisons involving an integer literal operand are compile-time only. // We don't have a value for an integer literal operand argument at // runtime in general. - // TODO: We could allow these in the case where the operand has a - // compile-time value. + // TODO: Figure out how mixed literal / non-literal comparisons should + // work. We could support these with builtins in the case where the + // operand has a compile-time value, or we could perform a conversion in + // the prelude. return sem_ir.types().Is( sem_ir.insts().Get(arg_ids[0]).type_id()) || sem_ir.types().Is( From 0f947d7754c809aea9e06748afcbae0dab3c5c68 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 31 Dec 2024 01:59:08 +0000 Subject: [PATCH 13/13] Add a big comment explaining what's going on for integer literal builtins. --- toolchain/sem_ir/builtin_function_kind.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 8eb83d8521ca0..875165cf6ef9f 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -424,6 +424,18 @@ auto BuiltinFunctionKind::IsValidType(const File& sem_ir, auto BuiltinFunctionKind::IsCompTimeOnly(const File& sem_ir, llvm::ArrayRef arg_ids, TypeId return_type_id) const -> bool { + // Some builtin functions are unconditionally compile-time-only, or + // unconditionally usable at runtime. However, we need to take extra care for + // builtins operating on an arbitrary integer type, because `Core.IntLiteral` + // has an empty runtime representation and a value of that type isn't + // necessarily a compile-time constant. For example, given: + // + // var n: Core.IntLiteral() = 123; + // + // we would be unable to lower a runtime operation such as `(1 as i32) << n` + // because the runtime representation of `n` doesn't track its value at all. + // So we treat operations involving `Core.IntLiteral` as being + // compile-time-only. switch (*this) { case IntConvertChecked: // Checked integer conversions are compile-time only.