mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Abbreviate Integer and FloatingPoint (#3435)
I was suggesting this because `FloatingPoint` is pretty long. `int` and `float` should be familiar abbreviations. `unsigned` should be familiar to developers too, but `UnsignedInt` still feels usefully clearer for the additional chars.
This commit is contained in:
@@ -48,16 +48,16 @@ class Real : public Printable<Real> {
|
||||
};
|
||||
|
||||
// Corresponds to an integer value represented by an APInt.
|
||||
struct IntegerId : public IndexBase, public Printable<IntegerId> {
|
||||
struct IntId : public IndexBase, public Printable<IntId> {
|
||||
using IndexedType = const llvm::APInt;
|
||||
static const IntegerId Invalid;
|
||||
static const IntId Invalid;
|
||||
using IndexBase::IndexBase;
|
||||
auto Print(llvm::raw_ostream& out) const -> void {
|
||||
out << "int";
|
||||
IndexBase::Print(out);
|
||||
}
|
||||
};
|
||||
constexpr IntegerId IntegerId::Invalid(IntegerId::InvalidIndex);
|
||||
constexpr IntId IntId::Invalid(IntId::InvalidIndex);
|
||||
|
||||
// Corresponds to a Real value.
|
||||
struct RealId : public IndexBase, public Printable<RealId> {
|
||||
@@ -244,8 +244,8 @@ class SharedValueStores : public Yaml::Printable<SharedValueStores> {
|
||||
auto identifiers() const -> const StringStoreWrapper<IdentifierId>& {
|
||||
return identifiers_;
|
||||
}
|
||||
auto integers() -> ValueStore<IntegerId>& { return integers_; }
|
||||
auto integers() const -> const ValueStore<IntegerId>& { return integers_; }
|
||||
auto ints() -> ValueStore<IntId>& { return ints_; }
|
||||
auto ints() const -> const ValueStore<IntId>& { return ints_; }
|
||||
auto reals() -> ValueStore<RealId>& { return reals_; }
|
||||
auto reals() const -> const ValueStore<RealId>& { return reals_; }
|
||||
auto string_literals() -> StringStoreWrapper<StringLiteralId>& {
|
||||
@@ -263,7 +263,7 @@ class SharedValueStores : public Yaml::Printable<SharedValueStores> {
|
||||
}
|
||||
map.Add("shared_values",
|
||||
Yaml::OutputMapping([&](Yaml::OutputMapping::Map map) {
|
||||
map.Add("integers", integers_.OutputYaml());
|
||||
map.Add("ints", ints_.OutputYaml());
|
||||
map.Add("reals", reals_.OutputYaml());
|
||||
map.Add("strings", strings_.OutputYaml());
|
||||
}));
|
||||
@@ -271,7 +271,7 @@ class SharedValueStores : public Yaml::Printable<SharedValueStores> {
|
||||
}
|
||||
|
||||
private:
|
||||
ValueStore<IntegerId> integers_;
|
||||
ValueStore<IntId> ints_;
|
||||
ValueStore<RealId> reals_;
|
||||
|
||||
ValueStore<StringId> strings_;
|
||||
|
||||
@@ -19,17 +19,17 @@ using ::testing::IsEmpty;
|
||||
using ::testing::Not;
|
||||
using ::testing::Pair;
|
||||
|
||||
TEST(ValueStore, Integer) {
|
||||
TEST(ValueStore, Int) {
|
||||
SharedValueStores value_stores;
|
||||
IntegerId id1 = value_stores.integers().Add(llvm::APInt(64, 1));
|
||||
IntegerId id2 = value_stores.integers().Add(llvm::APInt(64, 2));
|
||||
IntId id1 = value_stores.ints().Add(llvm::APInt(64, 1));
|
||||
IntId id2 = value_stores.ints().Add(llvm::APInt(64, 2));
|
||||
|
||||
ASSERT_TRUE(id1.is_valid());
|
||||
ASSERT_TRUE(id2.is_valid());
|
||||
EXPECT_THAT(id1, Not(Eq(id2)));
|
||||
|
||||
EXPECT_THAT(value_stores.integers().Get(id1), Eq(1));
|
||||
EXPECT_THAT(value_stores.integers().Get(id2), Eq(2));
|
||||
EXPECT_THAT(value_stores.ints().Get(id1), Eq(1));
|
||||
EXPECT_THAT(value_stores.ints().Get(id2), Eq(2));
|
||||
}
|
||||
|
||||
TEST(ValueStore, Real) {
|
||||
@@ -79,12 +79,12 @@ TEST(ValueStore, String) {
|
||||
EXPECT_THAT(value_stores.identifiers().Add(b).index, Eq(b_id.index));
|
||||
}
|
||||
|
||||
auto MatchSharedValues(testing::Matcher<Yaml::MappingValue> integers,
|
||||
auto MatchSharedValues(testing::Matcher<Yaml::MappingValue> ints,
|
||||
testing::Matcher<Yaml::MappingValue> reals,
|
||||
testing::Matcher<Yaml::MappingValue> strings) -> auto {
|
||||
return Yaml::IsYaml(Yaml::Sequence(ElementsAre(Yaml::Mapping(ElementsAre(Pair(
|
||||
"shared_values",
|
||||
Yaml::Mapping(ElementsAre(Pair("integers", Yaml::Mapping(integers)),
|
||||
Yaml::Mapping(ElementsAre(Pair("ints", Yaml::Mapping(ints)),
|
||||
Pair("reals", Yaml::Mapping(reals)),
|
||||
Pair("strings", Yaml::Mapping(strings))))))))));
|
||||
}
|
||||
@@ -100,7 +100,7 @@ TEST(ValueStore, PrintEmpty) {
|
||||
TEST(ValueStore, PrintVals) {
|
||||
SharedValueStores value_stores;
|
||||
llvm::APInt apint(64, 8, /*isSigned=*/true);
|
||||
value_stores.integers().Add(apint);
|
||||
value_stores.ints().Add(apint);
|
||||
value_stores.reals().Add(
|
||||
Real{.mantissa = apint, .exponent = apint, .is_decimal = true});
|
||||
value_stores.string_literals().Add("foo'\"baz");
|
||||
|
||||
@@ -717,8 +717,8 @@ class TypeCompleter {
|
||||
case SemIR::BuiltinKind::Error:
|
||||
case SemIR::BuiltinKind::Invalid:
|
||||
case SemIR::BuiltinKind::BoolType:
|
||||
case SemIR::BuiltinKind::IntegerType:
|
||||
case SemIR::BuiltinKind::FloatingPointType:
|
||||
case SemIR::BuiltinKind::IntType:
|
||||
case SemIR::BuiltinKind::FloatType:
|
||||
case SemIR::BuiltinKind::NamespaceType:
|
||||
case SemIR::BuiltinKind::FunctionType:
|
||||
case SemIR::BuiltinKind::BoundMethodType:
|
||||
@@ -855,7 +855,7 @@ class TypeCompleter {
|
||||
case SemIR::FunctionDecl::Kind:
|
||||
case SemIR::Import::Kind:
|
||||
case SemIR::InitializeFrom::Kind:
|
||||
case SemIR::IntegerLiteral::Kind:
|
||||
case SemIR::IntLiteral::Kind:
|
||||
case SemIR::NameRef::Kind:
|
||||
case SemIR::Namespace::Kind:
|
||||
case SemIR::NoOp::Kind:
|
||||
|
||||
@@ -297,7 +297,7 @@ class Context {
|
||||
auto identifiers() -> StringStoreWrapper<IdentifierId>& {
|
||||
return sem_ir().identifiers();
|
||||
}
|
||||
auto integers() -> ValueStore<IntegerId>& { return sem_ir().integers(); }
|
||||
auto ints() -> ValueStore<IntId>& { return sem_ir().ints(); }
|
||||
auto reals() -> ValueStore<RealId>& { return sem_ir().reals(); }
|
||||
auto string_literals() -> StringStoreWrapper<StringLiteralId>& {
|
||||
return sem_ir().string_literals();
|
||||
|
||||
@@ -133,9 +133,9 @@ static auto MakeElementAccessInst(Context& context, Parse::NodeId parse_node,
|
||||
// TODO: Add a new instruction kind for indexing an array at a constant
|
||||
// index so that we don't need an integer literal instruction here, and
|
||||
// remove this special case.
|
||||
auto index_id = block.AddInst(SemIR::IntegerLiteral{
|
||||
parse_node, context.GetBuiltinType(SemIR::BuiltinKind::IntegerType),
|
||||
context.sem_ir().integers().Add(llvm::APInt(32, i))});
|
||||
auto index_id = block.AddInst(SemIR::IntLiteral{
|
||||
parse_node, context.GetBuiltinType(SemIR::BuiltinKind::IntType),
|
||||
context.sem_ir().ints().Add(llvm::APInt(32, i))});
|
||||
return block.AddInst(
|
||||
AccessInstT{parse_node, elem_type_id, aggregate_id, index_id});
|
||||
} else {
|
||||
|
||||
@@ -33,8 +33,8 @@ auto HandleArrayExpr(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
.PopAndDiscardSoloParseNode<Parse::NodeKind::ArrayExprSemi>();
|
||||
auto element_type_inst_id = context.node_stack().PopExpr();
|
||||
auto bound_inst = context.insts().Get(bound_inst_id);
|
||||
if (auto literal = bound_inst.TryAs<SemIR::IntegerLiteral>()) {
|
||||
const auto& bound_value = context.integers().Get(literal->integer_id);
|
||||
if (auto literal = bound_inst.TryAs<SemIR::IntLiteral>()) {
|
||||
const auto& bound_value = context.ints().Get(literal->int_id);
|
||||
// TODO: Produce an error if the array type is too large.
|
||||
if (bound_value.getActiveBits() <= 64) {
|
||||
context.AddInstAndPush(
|
||||
|
||||
@@ -15,14 +15,13 @@ auto HandleIndexExprStart(Context& /*context*/, Parse::NodeId /*parse_node*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Validates that the index (required to be an IntegerLiteral) is valid within
|
||||
// Validates that the index (required to be an IntLiteral) is valid within
|
||||
// the array or tuple size. Returns the index on success, or nullptr on failure.
|
||||
static auto ValidateIntegerLiteralBound(Context& context,
|
||||
Parse::NodeId parse_node,
|
||||
SemIR::Inst operand_inst,
|
||||
SemIR::IntegerLiteral index_inst,
|
||||
int size) -> const llvm::APInt* {
|
||||
const auto& index_val = context.integers().Get(index_inst.integer_id);
|
||||
static auto ValidateIntLiteralBound(Context& context, Parse::NodeId parse_node,
|
||||
SemIR::Inst operand_inst,
|
||||
SemIR::IntLiteral index_inst, int size)
|
||||
-> const llvm::APInt* {
|
||||
const auto& index_val = context.ints().Get(index_inst.int_id);
|
||||
if (index_val.uge(size)) {
|
||||
CARBON_DIAGNOSTIC(IndexOutOfBounds, Error,
|
||||
"Index `{0}` is past the end of `{1}`.", llvm::APSInt,
|
||||
@@ -51,16 +50,16 @@ auto HandleIndexExpr(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
auto array_type = operand_type_inst.As<SemIR::ArrayType>();
|
||||
// We can check whether integers are in-bounds, although it doesn't affect
|
||||
// the IR for an array.
|
||||
if (auto index_literal = index_inst.TryAs<SemIR::IntegerLiteral>();
|
||||
if (auto index_literal = index_inst.TryAs<SemIR::IntLiteral>();
|
||||
index_literal &&
|
||||
!ValidateIntegerLiteralBound(
|
||||
!ValidateIntLiteralBound(
|
||||
context, parse_node, operand_inst, *index_literal,
|
||||
context.sem_ir().GetArrayBoundValue(array_type.bound_id))) {
|
||||
index_inst_id = SemIR::InstId::BuiltinError;
|
||||
}
|
||||
auto cast_index_id = ConvertToValueOfType(
|
||||
context, index_inst.parse_node(), index_inst_id,
|
||||
context.GetBuiltinType(SemIR::BuiltinKind::IntegerType));
|
||||
context.GetBuiltinType(SemIR::BuiltinKind::IntType));
|
||||
auto array_cat =
|
||||
SemIR::GetExprCategory(context.sem_ir(), operand_inst_id);
|
||||
if (array_cat == SemIR::ExprCategory::Value) {
|
||||
@@ -84,20 +83,20 @@ auto HandleIndexExpr(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
}
|
||||
case SemIR::TupleType::Kind: {
|
||||
SemIR::TypeId element_type_id = SemIR::TypeId::Error;
|
||||
if (auto index_literal = index_inst.TryAs<SemIR::IntegerLiteral>()) {
|
||||
if (auto index_literal = index_inst.TryAs<SemIR::IntLiteral>()) {
|
||||
auto type_block = context.type_blocks().Get(
|
||||
operand_type_inst.As<SemIR::TupleType>().elements_id);
|
||||
if (const auto* index_val = ValidateIntegerLiteralBound(
|
||||
context, parse_node, operand_inst, *index_literal,
|
||||
type_block.size())) {
|
||||
if (const auto* index_val =
|
||||
ValidateIntLiteralBound(context, parse_node, operand_inst,
|
||||
*index_literal, type_block.size())) {
|
||||
element_type_id = type_block[index_val->getZExtValue()];
|
||||
} else {
|
||||
index_inst_id = SemIR::InstId::BuiltinError;
|
||||
}
|
||||
} else if (index_inst.type_id() != SemIR::TypeId::Error) {
|
||||
CARBON_DIAGNOSTIC(TupleIndexIntegerLiteral, Error,
|
||||
CARBON_DIAGNOSTIC(TupleIndexIntLiteral, Error,
|
||||
"Tuples indices must be integer literals.");
|
||||
context.emitter().Emit(parse_node, TupleIndexIntegerLiteral);
|
||||
context.emitter().Emit(parse_node, TupleIndexIntLiteral);
|
||||
index_inst_id = SemIR::InstId::BuiltinError;
|
||||
}
|
||||
context.AddInstAndPush(parse_node,
|
||||
|
||||
@@ -25,24 +25,23 @@ auto HandleBoolLiteralTrue(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleIntegerLiteral(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
auto HandleIntLiteral(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
context.AddInstAndPush(
|
||||
parse_node,
|
||||
SemIR::IntegerLiteral{
|
||||
parse_node, context.GetBuiltinType(SemIR::BuiltinKind::IntegerType),
|
||||
context.tokens().GetIntegerLiteral(
|
||||
context.parse_tree().node_token(parse_node))});
|
||||
SemIR::IntLiteral{parse_node,
|
||||
context.GetBuiltinType(SemIR::BuiltinKind::IntType),
|
||||
context.tokens().GetIntLiteral(
|
||||
context.parse_tree().node_token(parse_node))});
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleRealLiteral(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
context.AddInstAndPush(
|
||||
parse_node,
|
||||
SemIR::RealLiteral{
|
||||
parse_node,
|
||||
context.GetBuiltinType(SemIR::BuiltinKind::FloatingPointType),
|
||||
context.tokens().GetRealLiteral(
|
||||
context.parse_tree().node_token(parse_node))});
|
||||
SemIR::RealLiteral{parse_node,
|
||||
context.GetBuiltinType(SemIR::BuiltinKind::FloatType),
|
||||
context.tokens().GetRealLiteral(
|
||||
context.parse_tree().node_token(parse_node))});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,31 +60,29 @@ auto HandleBoolTypeLiteral(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleIntegerTypeLiteral(Context& context, Parse::NodeId parse_node)
|
||||
-> bool {
|
||||
auto HandleIntTypeLiteral(Context& context, Parse::NodeId parse_node) -> bool {
|
||||
auto text = context.tokens().GetTokenText(
|
||||
context.parse_tree().node_token(parse_node));
|
||||
if (text != "i32") {
|
||||
return context.TODO(parse_node, "Currently only i32 is allowed");
|
||||
}
|
||||
context.node_stack().Push(parse_node, SemIR::InstId::BuiltinIntegerType);
|
||||
context.node_stack().Push(parse_node, SemIR::InstId::BuiltinIntType);
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleUnsignedIntegerTypeLiteral(Context& context,
|
||||
Parse::NodeId parse_node) -> bool {
|
||||
auto HandleUnsignedIntTypeLiteral(Context& context, Parse::NodeId parse_node)
|
||||
-> bool {
|
||||
return context.TODO(parse_node, "Need to support unsigned type literals");
|
||||
}
|
||||
|
||||
auto HandleFloatingPointTypeLiteral(Context& context, Parse::NodeId parse_node)
|
||||
auto HandleFloatTypeLiteral(Context& context, Parse::NodeId parse_node)
|
||||
-> bool {
|
||||
auto text = context.tokens().GetTokenText(
|
||||
context.parse_tree().node_token(parse_node));
|
||||
if (text != "f64") {
|
||||
return context.TODO(parse_node, "Currently only f64 is allowed");
|
||||
}
|
||||
context.node_stack().Push(parse_node,
|
||||
SemIR::InstId::BuiltinFloatingPointType);
|
||||
context.node_stack().Push(parse_node, SemIR::InstId::BuiltinFloatType);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
// CHECK:STDOUT: instTypeType: {kind: CrossRef, arg0: ir0, arg1: instTypeType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instError: {kind: CrossRef, arg0: ir0, arg1: instError, type: typeError}
|
||||
// CHECK:STDOUT: instBoolType: {kind: CrossRef, arg0: ir0, arg1: instBoolType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instIntegerType: {kind: CrossRef, arg0: ir0, arg1: instIntegerType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instFloatingPointType: {kind: CrossRef, arg0: ir0, arg1: instFloatingPointType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instIntType: {kind: CrossRef, arg0: ir0, arg1: instIntType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instFloatType: {kind: CrossRef, arg0: ir0, arg1: instFloatType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instStringType: {kind: CrossRef, arg0: ir0, arg1: instStringType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instFunctionType: {kind: CrossRef, arg0: ir0, arg1: instFunctionType, type: typeTypeType}
|
||||
// CHECK:STDOUT: instBoundMethodType: {kind: CrossRef, arg0: ir0, arg1: instBoundMethodType, type: typeTypeType}
|
||||
|
||||
@@ -20,9 +20,9 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: function0: {name: name0, param_refs: block1, return_type: type3, return_slot: inst+5, body: [block4]}
|
||||
// CHECK:STDOUT: classes: {}
|
||||
// CHECK:STDOUT: types:
|
||||
// CHECK:STDOUT: type0: {inst: instIntegerType, value_rep: {kind: copy, type: type0}}
|
||||
// CHECK:STDOUT: type0: {inst: instIntType, value_rep: {kind: copy, type: type0}}
|
||||
// CHECK:STDOUT: type1: {inst: inst+1, value_rep: {kind: unknown, type: type<invalid>}}
|
||||
// CHECK:STDOUT: type2: {inst: instFloatingPointType, value_rep: {kind: copy, type: type2}}
|
||||
// CHECK:STDOUT: type2: {inst: instFloatType, value_rep: {kind: copy, type: type2}}
|
||||
// CHECK:STDOUT: type3: {inst: inst+3, value_rep: {kind: pointer, type: type4}}
|
||||
// CHECK:STDOUT: type4: {inst: inst+6, value_rep: {kind: copy, type: type4}}
|
||||
// CHECK:STDOUT: type5: {inst: instFunctionType, value_rep: {kind: copy, type: type5}}
|
||||
@@ -43,7 +43,7 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: inst+6: {kind: PointerType, arg0: type3, type: typeTypeType}
|
||||
// CHECK:STDOUT: inst+7: {kind: FunctionDecl, arg0: function0, type: type5}
|
||||
// CHECK:STDOUT: inst+8: {kind: NameRef, arg0: name1, arg1: inst+0, type: type0}
|
||||
// CHECK:STDOUT: inst+9: {kind: IntegerLiteral, arg0: int3, type: type0}
|
||||
// CHECK:STDOUT: inst+9: {kind: IntLiteral, arg0: int3, type: type0}
|
||||
// CHECK:STDOUT: inst+10: {kind: BinaryOperatorAdd, arg0: inst+8, arg1: inst+9, type: type0}
|
||||
// CHECK:STDOUT: inst+11: {kind: RealLiteral, arg0: real0, type: type2}
|
||||
// CHECK:STDOUT: inst+12: {kind: TupleLiteral, arg0: block5, type: type3}
|
||||
@@ -59,8 +59,8 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: block1:
|
||||
// CHECK:STDOUT: 0: inst+0
|
||||
// CHECK:STDOUT: block2:
|
||||
// CHECK:STDOUT: 0: instIntegerType
|
||||
// CHECK:STDOUT: 1: instFloatingPointType
|
||||
// CHECK:STDOUT: 0: instIntType
|
||||
// CHECK:STDOUT: 1: instFloatType
|
||||
// CHECK:STDOUT: block3:
|
||||
// CHECK:STDOUT: 0: inst+0
|
||||
// CHECK:STDOUT: 1: inst+2
|
||||
|
||||
+5
-5
@@ -20,9 +20,9 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: function0: {name: name0, param_refs: block1, return_type: type3, return_slot: inst+5, body: [block4]}
|
||||
// CHECK:STDOUT: classes: {}
|
||||
// CHECK:STDOUT: types:
|
||||
// CHECK:STDOUT: type0: {inst: instIntegerType, value_rep: {kind: copy, type: type0}}
|
||||
// CHECK:STDOUT: type0: {inst: instIntType, value_rep: {kind: copy, type: type0}}
|
||||
// CHECK:STDOUT: type1: {inst: inst+1, value_rep: {kind: unknown, type: type<invalid>}}
|
||||
// CHECK:STDOUT: type2: {inst: instFloatingPointType, value_rep: {kind: copy, type: type2}}
|
||||
// CHECK:STDOUT: type2: {inst: instFloatType, value_rep: {kind: copy, type: type2}}
|
||||
// CHECK:STDOUT: type3: {inst: inst+3, value_rep: {kind: pointer, type: type4}}
|
||||
// CHECK:STDOUT: type4: {inst: inst+6, value_rep: {kind: copy, type: type4}}
|
||||
// CHECK:STDOUT: type5: {inst: instFunctionType, value_rep: {kind: copy, type: type5}}
|
||||
@@ -43,7 +43,7 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: inst+6: {kind: PointerType, arg0: type3, type: typeTypeType}
|
||||
// CHECK:STDOUT: inst+7: {kind: FunctionDecl, arg0: function0, type: type5}
|
||||
// CHECK:STDOUT: inst+8: {kind: NameRef, arg0: name1, arg1: inst+0, type: type0}
|
||||
// CHECK:STDOUT: inst+9: {kind: IntegerLiteral, arg0: int3, type: type0}
|
||||
// CHECK:STDOUT: inst+9: {kind: IntLiteral, arg0: int3, type: type0}
|
||||
// CHECK:STDOUT: inst+10: {kind: BinaryOperatorAdd, arg0: inst+8, arg1: inst+9, type: type0}
|
||||
// CHECK:STDOUT: inst+11: {kind: RealLiteral, arg0: real0, type: type2}
|
||||
// CHECK:STDOUT: inst+12: {kind: TupleLiteral, arg0: block5, type: type3}
|
||||
@@ -59,8 +59,8 @@ fn Foo(n: i32) -> (i32, f64) {
|
||||
// CHECK:STDOUT: block1:
|
||||
// CHECK:STDOUT: 0: inst+0
|
||||
// CHECK:STDOUT: block2:
|
||||
// CHECK:STDOUT: 0: instIntegerType
|
||||
// CHECK:STDOUT: 1: instFloatingPointType
|
||||
// CHECK:STDOUT: 0: instIntType
|
||||
// CHECK:STDOUT: 1: instFloatType
|
||||
// CHECK:STDOUT: block3:
|
||||
// CHECK:STDOUT: 0: inst+0
|
||||
// CHECK:STDOUT: 1: inst+2
|
||||
|
||||
@@ -186,7 +186,7 @@ CARBON_DIAGNOSTIC_KIND(StructInitMissingFieldInLiteral)
|
||||
CARBON_DIAGNOSTIC_KIND(StructInitMissingFieldInConversion)
|
||||
CARBON_DIAGNOSTIC_KIND(StructNameDuplicate)
|
||||
CARBON_DIAGNOSTIC_KIND(StructNamePrevious)
|
||||
CARBON_DIAGNOSTIC_KIND(TupleIndexIntegerLiteral)
|
||||
CARBON_DIAGNOSTIC_KIND(TupleIndexIntLiteral)
|
||||
CARBON_DIAGNOSTIC_KIND(TupleInitElementCountMismatch)
|
||||
CARBON_DIAGNOSTIC_KIND(ReturnedVarHere)
|
||||
CARBON_DIAGNOSTIC_KIND(ReturnedVarShadowed)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ var str2: String = "ab'\"c";
|
||||
// CHECK:STDOUT: ---
|
||||
// CHECK:STDOUT: filename: dump_shared_values.carbon
|
||||
// CHECK:STDOUT: shared_values:
|
||||
// CHECK:STDOUT: integers:
|
||||
// CHECK:STDOUT: ints:
|
||||
// CHECK:STDOUT: int0: 32
|
||||
// CHECK:STDOUT: int1: 1
|
||||
// CHECK:STDOUT: int2: 32
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
namespace Carbon::Lex {
|
||||
|
||||
auto CanLexInteger(DiagnosticEmitter<const char*>& emitter,
|
||||
llvm::StringRef text) -> bool {
|
||||
auto CanLexInt(DiagnosticEmitter<const char*>& emitter, llvm::StringRef text)
|
||||
-> bool {
|
||||
// llvm::getAsInteger is used for parsing, but it's quadratic and visibly slow
|
||||
// on large integer values. This limit exists to avoid hitting those limits.
|
||||
// Per https://github.com/carbon-language/carbon-lang/issues/980, it may be
|
||||
@@ -15,7 +15,7 @@ auto CanLexInteger(DiagnosticEmitter<const char*>& emitter,
|
||||
// this limit becomes an issue.
|
||||
//
|
||||
// 2^128 would be 39 decimal digits or 128 binary. In either case, this limit
|
||||
// is far above the threshold for normal integers.
|
||||
// is far above the threshold for normal ints.
|
||||
constexpr size_t DigitLimit = 1000;
|
||||
if (text.size() > DigitLimit) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Carbon::Lex {
|
||||
|
||||
// Should guard calls to getAsInteger due to performance issues with large
|
||||
// integers. Emits an error if the text cannot be lexed.
|
||||
auto CanLexInteger(DiagnosticEmitter<const char*>& emitter,
|
||||
llvm::StringRef text) -> bool;
|
||||
auto CanLexInt(DiagnosticEmitter<const char*>& emitter, llvm::StringRef text)
|
||||
-> bool;
|
||||
|
||||
} // namespace Carbon::Lex
|
||||
|
||||
|
||||
+10
-10
@@ -899,12 +899,12 @@ auto Lexer::LexNumericLiteral(llvm::StringRef source_text, ssize_t& position)
|
||||
|
||||
return VariantMatch(
|
||||
literal->ComputeValue(emitter_),
|
||||
[&](NumericLiteral::IntegerValue&& value) {
|
||||
auto token = buffer_.AddToken({.kind = TokenKind::IntegerLiteral,
|
||||
[&](NumericLiteral::IntValue&& value) {
|
||||
auto token = buffer_.AddToken({.kind = TokenKind::IntLiteral,
|
||||
.token_line = current_line(),
|
||||
.column = int_column});
|
||||
buffer_.GetTokenInfo(token).integer_id =
|
||||
buffer_.value_stores_->integers().Add(std::move(value.value));
|
||||
buffer_.GetTokenInfo(token).int_id =
|
||||
buffer_.value_stores_->ints().Add(std::move(value.value));
|
||||
return token;
|
||||
},
|
||||
[&](NumericLiteral::RealValue&& value) {
|
||||
@@ -1080,20 +1080,20 @@ auto Lexer::LexWordAsTypeLiteralToken(llvm::StringRef word, int column)
|
||||
std::optional<TokenKind> kind;
|
||||
switch (word.front()) {
|
||||
case 'i':
|
||||
kind = TokenKind::IntegerTypeLiteral;
|
||||
kind = TokenKind::IntTypeLiteral;
|
||||
break;
|
||||
case 'u':
|
||||
kind = TokenKind::UnsignedIntegerTypeLiteral;
|
||||
kind = TokenKind::UnsignedIntTypeLiteral;
|
||||
break;
|
||||
case 'f':
|
||||
kind = TokenKind::FloatingPointTypeLiteral;
|
||||
kind = TokenKind::FloatTypeLiteral;
|
||||
break;
|
||||
default:
|
||||
return LexResult::NoMatch();
|
||||
};
|
||||
|
||||
llvm::StringRef suffix = word.substr(1);
|
||||
if (!CanLexInteger(emitter_, suffix)) {
|
||||
if (!CanLexInt(emitter_, suffix)) {
|
||||
return buffer_.AddToken(
|
||||
{.kind = TokenKind::Error,
|
||||
.token_line = current_line(),
|
||||
@@ -1107,8 +1107,8 @@ auto Lexer::LexWordAsTypeLiteralToken(llvm::StringRef word, int column)
|
||||
|
||||
auto token = buffer_.AddToken(
|
||||
{.kind = *kind, .token_line = current_line(), .column = column});
|
||||
buffer_.GetTokenInfo(token).integer_id =
|
||||
buffer_.value_stores_->integers().Add(std::move(suffix_value));
|
||||
buffer_.GetTokenInfo(token).int_id =
|
||||
buffer_.value_stores_->ints().Add(std::move(suffix_value));
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class NumericLiteral::Parser {
|
||||
public:
|
||||
Parser(DiagnosticEmitter<const char*>& emitter, NumericLiteral literal);
|
||||
|
||||
auto IsInteger() -> bool {
|
||||
auto IsInt() -> bool {
|
||||
return literal_.radix_point_ == static_cast<int>(literal_.text_.size());
|
||||
}
|
||||
|
||||
@@ -200,8 +200,8 @@ auto NumericLiteral::Parser::Check() -> bool {
|
||||
// parsing 123.456e7, we want to decompose it into an integer mantissa
|
||||
// (123456) and an exponent (7 - 3 = 4), and this routine is given the
|
||||
// "123.456" to parse as the mantissa.
|
||||
static auto ParseInteger(llvm::StringRef digits, NumericLiteral::Radix radix,
|
||||
bool needs_cleaning) -> llvm::APInt {
|
||||
static auto ParseInt(llvm::StringRef digits, NumericLiteral::Radix radix,
|
||||
bool needs_cleaning) -> llvm::APInt {
|
||||
llvm::SmallString<32> cleaned;
|
||||
if (needs_cleaning) {
|
||||
cleaned.reserve(digits.size());
|
||||
@@ -219,9 +219,9 @@ static auto ParseInteger(llvm::StringRef digits, NumericLiteral::Radix radix,
|
||||
}
|
||||
|
||||
auto NumericLiteral::Parser::GetMantissa() -> llvm::APInt {
|
||||
const char* end = IsInteger() ? int_part_.end() : fract_part_.end();
|
||||
const char* end = IsInt() ? int_part_.end() : fract_part_.end();
|
||||
llvm::StringRef digits(int_part_.begin(), end - int_part_.begin());
|
||||
return ParseInteger(digits, radix_, mantissa_needs_cleaning_);
|
||||
return ParseInt(digits, radix_, mantissa_needs_cleaning_);
|
||||
}
|
||||
|
||||
auto NumericLiteral::Parser::GetExponent() -> llvm::APInt {
|
||||
@@ -230,7 +230,7 @@ auto NumericLiteral::Parser::GetExponent() -> llvm::APInt {
|
||||
llvm::APInt exponent(64, 0);
|
||||
if (!exponent_part_.empty()) {
|
||||
exponent =
|
||||
ParseInteger(exponent_part_, Radix::Decimal, exponent_needs_cleaning_);
|
||||
ParseInt(exponent_part_, Radix::Decimal, exponent_needs_cleaning_);
|
||||
|
||||
// The exponent is a signed integer, and the number we just parsed is
|
||||
// non-negative, so ensure we have a wide enough representation to
|
||||
@@ -327,7 +327,7 @@ auto NumericLiteral::Parser::CheckDigitSequence(llvm::StringRef text,
|
||||
CheckDigitSeparatorPlacement(text, radix, num_digit_separators);
|
||||
}
|
||||
|
||||
if (!CanLexInteger(emitter_, text)) {
|
||||
if (!CanLexInt(emitter_, text)) {
|
||||
return {.ok = false};
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ auto NumericLiteral::Parser::CheckIntPart() -> bool {
|
||||
// Check the fractional part (after the '.' and before the exponent, if any)
|
||||
// is valid.
|
||||
auto NumericLiteral::Parser::CheckFractionalPart() -> bool {
|
||||
if (IsInteger()) {
|
||||
if (IsInt()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -450,8 +450,8 @@ auto NumericLiteral::ComputeValue(DiagnosticEmitter<const char*>& emitter) const
|
||||
return UnrecoverableError();
|
||||
}
|
||||
|
||||
if (parser.IsInteger()) {
|
||||
return IntegerValue{.value = parser.GetMantissa()};
|
||||
if (parser.IsInt()) {
|
||||
return IntValue{.value = parser.GetMantissa()};
|
||||
}
|
||||
|
||||
return RealValue{
|
||||
|
||||
@@ -20,7 +20,7 @@ class NumericLiteral {
|
||||
enum class Radix : int8_t { Binary = 2, Decimal = 10, Hexadecimal = 16 };
|
||||
|
||||
// Value of an integer literal.
|
||||
struct IntegerValue {
|
||||
struct IntValue {
|
||||
// An unsigned literal value.
|
||||
llvm::APInt value;
|
||||
};
|
||||
@@ -37,7 +37,7 @@ class NumericLiteral {
|
||||
|
||||
struct UnrecoverableError {};
|
||||
|
||||
using Value = std::variant<IntegerValue, RealValue, UnrecoverableError>;
|
||||
using Value = std::variant<IntValue, RealValue, UnrecoverableError>;
|
||||
|
||||
// Extract a numeric literal from the given text, if it has a suitable form.
|
||||
//
|
||||
|
||||
@@ -17,7 +17,7 @@ static void BM_Lex_Float(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
static void BM_Lex_Integer(benchmark::State& state) {
|
||||
static void BM_Lex_Int(benchmark::State& state) {
|
||||
for (auto _ : state) {
|
||||
CARBON_CHECK(NumericLiteral::Lex("1_234_567_890"));
|
||||
}
|
||||
@@ -32,7 +32,7 @@ static void BM_ComputeValue_Float(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
static void BM_ComputeValue_Integer(benchmark::State& state) {
|
||||
static void BM_ComputeValue_Int(benchmark::State& state) {
|
||||
auto val = NumericLiteral::Lex("1_234_567_890");
|
||||
auto emitter = NullDiagnosticEmitter<const char*>();
|
||||
CARBON_CHECK(val);
|
||||
@@ -42,9 +42,9 @@ static void BM_ComputeValue_Integer(benchmark::State& state) {
|
||||
}
|
||||
|
||||
BENCHMARK(BM_Lex_Float);
|
||||
BENCHMARK(BM_Lex_Integer);
|
||||
BENCHMARK(BM_Lex_Int);
|
||||
BENCHMARK(BM_ComputeValue_Float);
|
||||
BENCHMARK(BM_ComputeValue_Integer);
|
||||
BENCHMARK(BM_ComputeValue_Int);
|
||||
|
||||
} // namespace
|
||||
} // namespace Carbon::Lex
|
||||
|
||||
@@ -42,12 +42,12 @@ class NumericLiteralTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
// Matcher for signed llvm::APInt.
|
||||
auto IsSignedInteger(int64_t value) -> Matcher<llvm::APInt> {
|
||||
auto IsSignedInt(int64_t value) -> Matcher<llvm::APInt> {
|
||||
return Property(&llvm::APInt::getSExtValue, value);
|
||||
}
|
||||
|
||||
// Matcher for unsigned llvm::APInt.
|
||||
auto IsUnsignedInteger(uint64_t value) -> Matcher<llvm::APInt> {
|
||||
auto IsUnsignedInt(uint64_t value) -> Matcher<llvm::APInt> {
|
||||
return Property(&llvm::APInt::getZExtValue, value);
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ auto IsUnsignedInteger(uint64_t value) -> Matcher<llvm::APInt> {
|
||||
template <typename ValueMatcher>
|
||||
auto HasIntValue(const ValueMatcher& value_matcher)
|
||||
-> Matcher<NumericLiteral::Value> {
|
||||
return VariantWith<NumericLiteral::IntegerValue>(
|
||||
Field(&NumericLiteral::IntegerValue::value, value_matcher));
|
||||
return VariantWith<NumericLiteral::IntValue>(
|
||||
Field(&NumericLiteral::IntValue::value, value_matcher));
|
||||
}
|
||||
|
||||
struct RealMatcher {
|
||||
@@ -79,7 +79,7 @@ auto HasUnrecoverableError() -> Matcher<NumericLiteral::Value> {
|
||||
return VariantWith<NumericLiteral::UnrecoverableError>(_);
|
||||
}
|
||||
|
||||
TEST_F(NumericLiteralTest, HandlesIntegerLiteral) {
|
||||
TEST_F(NumericLiteralTest, HandlesIntLiteral) {
|
||||
struct Testcase {
|
||||
llvm::StringLiteral token;
|
||||
uint64_t value;
|
||||
@@ -94,7 +94,7 @@ TEST_F(NumericLiteralTest, HandlesIntegerLiteral) {
|
||||
for (Testcase testcase : testcases) {
|
||||
error_tracker.Reset();
|
||||
EXPECT_THAT(Parse(testcase.token),
|
||||
HasIntValue(IsUnsignedInteger(testcase.value)))
|
||||
HasIntValue(IsUnsignedInt(testcase.value)))
|
||||
<< testcase.token;
|
||||
EXPECT_FALSE(error_tracker.seen_error()) << testcase.token;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ TEST_F(NumericLiteralTest, ValidatesBaseSpecifier) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(NumericLiteralTest, ValidatesIntegerDigitSeparators) {
|
||||
TEST_F(NumericLiteralTest, ValidatesIntDigitSeparators) {
|
||||
llvm::StringLiteral valid[] = {
|
||||
// Decimal literals optionally have digit separators every 3 places.
|
||||
"1_234",
|
||||
@@ -234,8 +234,8 @@ TEST_F(NumericLiteralTest, HandlesRealLiteral) {
|
||||
error_tracker.Reset();
|
||||
EXPECT_THAT(Parse(testcase.token),
|
||||
HasRealValue({.radix = (testcase.radix == 10 ? 10 : 2),
|
||||
.mantissa = IsUnsignedInteger(testcase.mantissa),
|
||||
.exponent = IsSignedInteger(testcase.exponent)}))
|
||||
.mantissa = IsUnsignedInt(testcase.mantissa),
|
||||
.exponent = IsSignedInt(testcase.exponent)}))
|
||||
<< testcase.token;
|
||||
EXPECT_EQ(error_tracker.seen_error(), testcase.radix == 2)
|
||||
<< testcase.token;
|
||||
@@ -248,7 +248,7 @@ TEST_F(NumericLiteralTest, HandlesRealLiteralOverflow) {
|
||||
EXPECT_THAT(
|
||||
Parse(input),
|
||||
HasRealValue({.radix = 2,
|
||||
.mantissa = IsUnsignedInteger(0x1000001),
|
||||
.mantissa = IsUnsignedInt(0x1000001),
|
||||
.exponent = Truly([](llvm::APInt exponent) {
|
||||
return (exponent + 9223372036854775800).getSExtValue() ==
|
||||
-24;
|
||||
|
||||
@@ -226,7 +226,7 @@ static auto ExpandUnicodeEscapeSequence(LexerDiagnosticEmitter& emitter,
|
||||
llvm::StringRef digits,
|
||||
char*& buffer_cursor) -> bool {
|
||||
unsigned code_point;
|
||||
if (!CanLexInteger(emitter, digits)) {
|
||||
if (!CanLexInt(emitter, digits)) {
|
||||
return false;
|
||||
}
|
||||
if (digits.getAsInteger(16, code_point) || code_point > 0x10FFFF) {
|
||||
|
||||
+9
-9
@@ -5,32 +5,32 @@
|
||||
// AUTOUPDATE
|
||||
// CHECK:STDOUT: - filename: fail_bad_raw_identifier.carbon
|
||||
// CHECK:STDOUT: tokens: [
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
|
||||
// Missing the character after `#`.
|
||||
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+3]]:2: ERROR: Encountered unrecognized characters while parsing.
|
||||
// CHECK:STDERR: r#
|
||||
// CHECK:STDERR: ^
|
||||
r#
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#', has_trailing_space: true },
|
||||
|
||||
// Not a valid identifier.
|
||||
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+3]]:2: ERROR: Encountered unrecognized characters while parsing.
|
||||
// CHECK:STDERR: r#3
|
||||
// CHECK:STDERR: ^
|
||||
r#3
|
||||
// CHECK:STDOUT: { index: 3, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#' },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: '3', value: `3`, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 3, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#' },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'IntLiteral', line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: '3', value: `3`, has_trailing_space: true },
|
||||
|
||||
// Non ascii start to identifier.
|
||||
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+3]]:2: ERROR: Encountered unrecognized characters while parsing.
|
||||
// CHECK:STDERR: r#á
|
||||
// CHECK:STDERR: ^
|
||||
r#á
|
||||
// CHECK:STDOUT: { index: 6, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#á', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 6, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#á', has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 8, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: { index: 8, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+23
-23
@@ -23,28 +23,28 @@ var c: i32 = 0.4; // still more trailing comment
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDOUT: - filename: fail_trailing_comments.carbon
|
||||
// CHECK:STDOUT: tokens: [
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-19]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-20]], column: 5, indent: 1, spelling: 'a', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-21]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'IntegerTypeLiteral', line: {{ *}}[[@LINE-22]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-23]], column: 12, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 6, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-24]], column: 14, indent: 1, spelling: '1', value: `1` },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Semi', line: {{ *}}[[@LINE-25]], column: 15, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 8, kind: 'Var', line: {{ *}}[[@LINE-25]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 9, kind: 'Identifier', line: {{ *}}[[@LINE-26]], column: 5, indent: 1, spelling: 'b', identifier: 1 },
|
||||
// CHECK:STDOUT: { index: 10, kind: 'Colon', line: {{ *}}[[@LINE-27]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 11, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-28]], column: 8, indent: 1, spelling: '32', value: `32`, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 12, kind: 'Equal', line: {{ *}}[[@LINE-29]], column: 11, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 13, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-30]], column: 13, indent: 1, spelling: '13', value: `13` },
|
||||
// CHECK:STDOUT: { index: 14, kind: 'Semi', line: {{ *}}[[@LINE-31]], column: 15, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 15, kind: 'Var', line: {{ *}}[[@LINE-31]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 16, kind: 'Identifier', line: {{ *}}[[@LINE-32]], column: 5, indent: 1, spelling: 'c', identifier: 2 },
|
||||
// CHECK:STDOUT: { index: 17, kind: 'Colon', line: {{ *}}[[@LINE-33]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 18, kind: 'IntegerTypeLiteral', line: {{ *}}[[@LINE-34]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 19, kind: 'Equal', line: {{ *}}[[@LINE-35]], column: 12, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 20, kind: 'RealLiteral', line: {{ *}}[[@LINE-36]], column: 14, indent: 1, spelling: '0.4', value: `4*10^-1` },
|
||||
// CHECK:STDOUT: { index: 21, kind: 'Semi', line: {{ *}}[[@LINE-37]], column: 17, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-19]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-20]], column: 5, indent: 1, spelling: 'a', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-21]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-22]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-23]], column: 12, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 6, kind: 'IntLiteral', line: {{ *}}[[@LINE-24]], column: 14, indent: 1, spelling: '1', value: `1` },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Semi', line: {{ *}}[[@LINE-25]], column: 15, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 8, kind: 'Var', line: {{ *}}[[@LINE-25]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 9, kind: 'Identifier', line: {{ *}}[[@LINE-26]], column: 5, indent: 1, spelling: 'b', identifier: 1 },
|
||||
// CHECK:STDOUT: { index: 10, kind: 'Colon', line: {{ *}}[[@LINE-27]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 11, kind: 'IntLiteral', line: {{ *}}[[@LINE-28]], column: 8, indent: 1, spelling: '32', value: `32`, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 12, kind: 'Equal', line: {{ *}}[[@LINE-29]], column: 11, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 13, kind: 'IntLiteral', line: {{ *}}[[@LINE-30]], column: 13, indent: 1, spelling: '13', value: `13` },
|
||||
// CHECK:STDOUT: { index: 14, kind: 'Semi', line: {{ *}}[[@LINE-31]], column: 15, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 15, kind: 'Var', line: {{ *}}[[@LINE-31]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 16, kind: 'Identifier', line: {{ *}}[[@LINE-32]], column: 5, indent: 1, spelling: 'c', identifier: 2 },
|
||||
// CHECK:STDOUT: { index: 17, kind: 'Colon', line: {{ *}}[[@LINE-33]], column: 6, indent: 1, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 18, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-34]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 19, kind: 'Equal', line: {{ *}}[[@LINE-35]], column: 12, indent: 1, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 20, kind: 'RealLiteral', line: {{ *}}[[@LINE-36]], column: 14, indent: 1, spelling: '0.4', value: `4*10^-1` },
|
||||
// CHECK:STDOUT: { index: 21, kind: 'Semi', line: {{ *}}[[@LINE-37]], column: 17, indent: 1, spelling: ';', has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 22, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: { index: 22, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+56
-56
@@ -5,82 +5,82 @@
|
||||
// AUTOUPDATE
|
||||
// CHECK:STDOUT: - filename: numeric_literals.carbon
|
||||
// CHECK:STDOUT: tokens: [
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Fn', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'fn', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: 'F', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 3, kind: 'OpenParen', line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: '(', closing_token: 4 },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'CloseParen', line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ')', opening_token: 3, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'OpenCurlyBrace', line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: '{', closing_token: 54, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'Fn', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'fn', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: 'F', identifier: 0 },
|
||||
// CHECK:STDOUT: { index: 3, kind: 'OpenParen', line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: '(', closing_token: 4 },
|
||||
// CHECK:STDOUT: { index: 4, kind: 'CloseParen', line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ')', opening_token: 3, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 5, kind: 'OpenCurlyBrace', line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: '{', closing_token: 54, has_trailing_space: true },
|
||||
// 8 and 9 trigger special behavior in APInt when mishandling signed versus
|
||||
// unsigned, so we pay extra attention to those.
|
||||
var ints: [i32; 5] = (
|
||||
// CHECK:STDOUT: { index: 6, kind: 'Var', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: 'ints', identifier: 1 },
|
||||
// CHECK:STDOUT: { index: 8, kind: 'Colon', line: {{ *}}[[@LINE-3]], column: 11, indent: 3, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 9, kind: 'OpenSquareBracket', line: {{ *}}[[@LINE-4]], column: 13, indent: 3, spelling: '[', closing_token: 13 },
|
||||
// CHECK:STDOUT: { index: 10, kind: 'IntegerTypeLiteral', line: {{ *}}[[@LINE-5]], column: 14, indent: 3, spelling: 'i32' },
|
||||
// CHECK:STDOUT: { index: 11, kind: 'Semi', line: {{ *}}[[@LINE-6]], column: 17, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 12, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-7]], column: 19, indent: 3, spelling: '5', value: `5` },
|
||||
// CHECK:STDOUT: { index: 13, kind: 'CloseSquareBracket', line: {{ *}}[[@LINE-8]], column: 20, indent: 3, spelling: ']', opening_token: 9, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 14, kind: 'Equal', line: {{ *}}[[@LINE-9]], column: 22, indent: 3, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 15, kind: 'OpenParen', line: {{ *}}[[@LINE-10]], column: 24, indent: 3, spelling: '(', closing_token: 26, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 6, kind: 'Var', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 7, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: 'ints', identifier: 1 },
|
||||
// CHECK:STDOUT: { index: 8, kind: 'Colon', line: {{ *}}[[@LINE-3]], column: 11, indent: 3, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 9, kind: 'OpenSquareBracket', line: {{ *}}[[@LINE-4]], column: 13, indent: 3, spelling: '[', closing_token: 13 },
|
||||
// CHECK:STDOUT: { index: 10, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-5]], column: 14, indent: 3, spelling: 'i32' },
|
||||
// CHECK:STDOUT: { index: 11, kind: 'Semi', line: {{ *}}[[@LINE-6]], column: 17, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 12, kind: 'IntLiteral', line: {{ *}}[[@LINE-7]], column: 19, indent: 3, spelling: '5', value: `5` },
|
||||
// CHECK:STDOUT: { index: 13, kind: 'CloseSquareBracket', line: {{ *}}[[@LINE-8]], column: 20, indent: 3, spelling: ']', opening_token: 9, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 14, kind: 'Equal', line: {{ *}}[[@LINE-9]], column: 22, indent: 3, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 15, kind: 'OpenParen', line: {{ *}}[[@LINE-10]], column: 24, indent: 3, spelling: '(', closing_token: 26, has_trailing_space: true },
|
||||
8,
|
||||
// CHECK:STDOUT: { index: 16, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '8', value: `8` },
|
||||
// CHECK:STDOUT: { index: 17, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 16, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '8', value: `8` },
|
||||
// CHECK:STDOUT: { index: 17, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
9,
|
||||
// CHECK:STDOUT: { index: 18, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '9', value: `9` },
|
||||
// CHECK:STDOUT: { index: 19, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 18, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '9', value: `9` },
|
||||
// CHECK:STDOUT: { index: 19, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
0x8,
|
||||
// CHECK:STDOUT: { index: 20, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0x8', value: `8` },
|
||||
// CHECK:STDOUT: { index: 21, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 20, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0x8', value: `8` },
|
||||
// CHECK:STDOUT: { index: 21, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
0b1000,
|
||||
// CHECK:STDOUT: { index: 22, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0b1000', value: `8` },
|
||||
// CHECK:STDOUT: { index: 23, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 22, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0b1000', value: `8` },
|
||||
// CHECK:STDOUT: { index: 23, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
39999999999999999993,
|
||||
// CHECK:STDOUT: { index: 24, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '39999999999999999993', value: `39999999999999999993` },
|
||||
// CHECK:STDOUT: { index: 25, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 25, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 24, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '39999999999999999993', value: `39999999999999999993` },
|
||||
// CHECK:STDOUT: { index: 25, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 25, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
);
|
||||
// CHECK:STDOUT: { index: 26, kind: 'CloseParen', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ')', opening_token: 15 },
|
||||
// CHECK:STDOUT: { index: 27, kind: 'Semi', line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 26, kind: 'CloseParen', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ')', opening_token: 15 },
|
||||
// CHECK:STDOUT: { index: 27, kind: 'Semi', line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
var floats: [f64; 7] = (
|
||||
// CHECK:STDOUT: { index: 28, kind: 'Var', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 29, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: 'floats', identifier: 2 },
|
||||
// CHECK:STDOUT: { index: 30, kind: 'Colon', line: {{ *}}[[@LINE-3]], column: 13, indent: 3, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 31, kind: 'OpenSquareBracket', line: {{ *}}[[@LINE-4]], column: 15, indent: 3, spelling: '[', closing_token: 35 },
|
||||
// CHECK:STDOUT: { index: 32, kind: 'FloatingPointTypeLiteral', line: {{ *}}[[@LINE-5]], column: 16, indent: 3, spelling: 'f64' },
|
||||
// CHECK:STDOUT: { index: 33, kind: 'Semi', line: {{ *}}[[@LINE-6]], column: 19, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 34, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-7]], column: 21, indent: 3, spelling: '7', value: `7` },
|
||||
// CHECK:STDOUT: { index: 35, kind: 'CloseSquareBracket', line: {{ *}}[[@LINE-8]], column: 22, indent: 3, spelling: ']', opening_token: 31, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 36, kind: 'Equal', line: {{ *}}[[@LINE-9]], column: 24, indent: 3, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 37, kind: 'OpenParen', line: {{ *}}[[@LINE-10]], column: 26, indent: 3, spelling: '(', closing_token: 52, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 28, kind: 'Var', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: 'var', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 29, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: 'floats', identifier: 2 },
|
||||
// CHECK:STDOUT: { index: 30, kind: 'Colon', line: {{ *}}[[@LINE-3]], column: 13, indent: 3, spelling: ':', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 31, kind: 'OpenSquareBracket', line: {{ *}}[[@LINE-4]], column: 15, indent: 3, spelling: '[', closing_token: 35 },
|
||||
// CHECK:STDOUT: { index: 32, kind: 'FloatTypeLiteral', line: {{ *}}[[@LINE-5]], column: 16, indent: 3, spelling: 'f64' },
|
||||
// CHECK:STDOUT: { index: 33, kind: 'Semi', line: {{ *}}[[@LINE-6]], column: 19, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 34, kind: 'IntLiteral', line: {{ *}}[[@LINE-7]], column: 21, indent: 3, spelling: '7', value: `7` },
|
||||
// CHECK:STDOUT: { index: 35, kind: 'CloseSquareBracket', line: {{ *}}[[@LINE-8]], column: 22, indent: 3, spelling: ']', opening_token: 31, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 36, kind: 'Equal', line: {{ *}}[[@LINE-9]], column: 24, indent: 3, spelling: '=', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 37, kind: 'OpenParen', line: {{ *}}[[@LINE-10]], column: 26, indent: 3, spelling: '(', closing_token: 52, has_trailing_space: true },
|
||||
0.9,
|
||||
// CHECK:STDOUT: { index: 38, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0.9', value: `9*10^-1` },
|
||||
// CHECK:STDOUT: { index: 39, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 38, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '0.9', value: `9*10^-1` },
|
||||
// CHECK:STDOUT: { index: 39, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
8.0,
|
||||
// CHECK:STDOUT: { index: 40, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '8.0', value: `80*10^-1` },
|
||||
// CHECK:STDOUT: { index: 41, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 40, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '8.0', value: `80*10^-1` },
|
||||
// CHECK:STDOUT: { index: 41, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
80.0,
|
||||
// CHECK:STDOUT: { index: 42, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '80.0', value: `800*10^-1` },
|
||||
// CHECK:STDOUT: { index: 43, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 9, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 42, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '80.0', value: `800*10^-1` },
|
||||
// CHECK:STDOUT: { index: 43, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 9, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
1.0e7,
|
||||
// CHECK:STDOUT: { index: 44, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e7', value: `10*10^6` },
|
||||
// CHECK:STDOUT: { index: 45, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 44, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e7', value: `10*10^6` },
|
||||
// CHECK:STDOUT: { index: 45, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
1.0e8,
|
||||
// CHECK:STDOUT: { index: 46, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e8', value: `10*10^7` },
|
||||
// CHECK:STDOUT: { index: 47, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 46, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e8', value: `10*10^7` },
|
||||
// CHECK:STDOUT: { index: 47, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
1.0e-8,
|
||||
// CHECK:STDOUT: { index: 48, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e-8', value: `10*10^-9` },
|
||||
// CHECK:STDOUT: { index: 49, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 48, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '1.0e-8', value: `10*10^-9` },
|
||||
// CHECK:STDOUT: { index: 49, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
39999999999999999993.0e39999999999999999993,
|
||||
// CHECK:STDOUT: { index: 50, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '39999999999999999993.0e39999999999999999993', value: `399999999999999999930*10^39999999999999999992` },
|
||||
// CHECK:STDOUT: { index: 51, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 48, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 50, kind: 'RealLiteral', line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: '39999999999999999993.0e39999999999999999993', value: `399999999999999999930*10^39999999999999999992` },
|
||||
// CHECK:STDOUT: { index: 51, kind: 'Comma', line: {{ *}}[[@LINE-2]], column: 48, indent: 5, spelling: ',', has_trailing_space: true },
|
||||
);
|
||||
// CHECK:STDOUT: { index: 52, kind: 'CloseParen', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ')', opening_token: 37 },
|
||||
// CHECK:STDOUT: { index: 53, kind: 'Semi', line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 52, kind: 'CloseParen', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ')', opening_token: 37 },
|
||||
// CHECK:STDOUT: { index: 53, kind: 'Semi', line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ';', has_trailing_space: true },
|
||||
}
|
||||
// CHECK:STDOUT: { index: 54, kind: 'CloseCurlyBrace', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '}', opening_token: 5, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 54, kind: 'CloseCurlyBrace', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '}', opening_token: 5, has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 55, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: { index: 55, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@
|
||||
// AUTOUPDATE
|
||||
// CHECK:STDOUT: - filename: printing_integer_literal.carbon
|
||||
// CHECK:STDOUT: tokens: [
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
|
||||
123
|
||||
// CHECK:STDOUT: { index: 1, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '123', value: `123`, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '123', value: `123`, has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 2, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@
|
||||
// AUTOUPDATE
|
||||
// CHECK:STDOUT: - filename: printing_token.carbon
|
||||
// CHECK:STDOUT: tokens: [
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true },
|
||||
|
||||
0x9
|
||||
// CHECK:STDOUT: { index: 1, kind: 'IntegerLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '0x9', value: `9`, has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 1, kind: 'IntLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '0x9', value: `9`, has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 2, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: { index: 2, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ r#i32
|
||||
|
||||
// The same type literal, for comparison.
|
||||
i32
|
||||
// CHECK:STDOUT: { index: 6, kind: 'IntegerTypeLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
// CHECK:STDOUT: { index: 6, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'i32', has_trailing_space: true },
|
||||
|
||||
// CHECK:STDOUT: { index: 7, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' },
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -207,12 +207,12 @@ CARBON_KEYWORD_TOKEN(While, "while")
|
||||
#undef CARBON_KEYWORD_TOKEN
|
||||
|
||||
CARBON_TOKEN(Identifier)
|
||||
CARBON_TOKEN(IntegerLiteral)
|
||||
CARBON_TOKEN(IntLiteral)
|
||||
CARBON_TOKEN(RealLiteral)
|
||||
CARBON_TOKEN(StringLiteral)
|
||||
CARBON_TOKEN(IntegerTypeLiteral)
|
||||
CARBON_TOKEN(UnsignedIntegerTypeLiteral)
|
||||
CARBON_TOKEN(FloatingPointTypeLiteral)
|
||||
CARBON_TOKEN(IntTypeLiteral)
|
||||
CARBON_TOKEN(UnsignedIntTypeLiteral)
|
||||
CARBON_TOKEN(FloatTypeLiteral)
|
||||
CARBON_TOKEN(FileStart)
|
||||
CARBON_TOKEN(FileEnd)
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ class TokenKind : public CARBON_ENUM_BASE(TokenKind) {
|
||||
|
||||
// Test whether this kind of token is a sized type literal.
|
||||
auto is_sized_type_literal() const -> bool {
|
||||
return *this == TokenKind::IntegerTypeLiteral ||
|
||||
*this == TokenKind::UnsignedIntegerTypeLiteral ||
|
||||
*this == TokenKind::FloatingPointTypeLiteral;
|
||||
return *this == TokenKind::IntTypeLiteral ||
|
||||
*this == TokenKind::UnsignedIntTypeLiteral ||
|
||||
*this == TokenKind::FloatTypeLiteral;
|
||||
};
|
||||
|
||||
// If this token kind has a fixed spelling when in source code, returns it.
|
||||
|
||||
@@ -50,7 +50,7 @@ auto TokenizedBuffer::GetTokenText(TokenIndex token) const -> llvm::StringRef {
|
||||
|
||||
// Refer back to the source text to preserve oddities like radix or digit
|
||||
// separators the author included.
|
||||
if (token_info.kind == TokenKind::IntegerLiteral ||
|
||||
if (token_info.kind == TokenKind::IntLiteral ||
|
||||
token_info.kind == TokenKind::RealLiteral) {
|
||||
const auto& line_info = GetLineInfo(token_info.token_line);
|
||||
int64_t token_start = line_info.start + token_info.column;
|
||||
@@ -96,10 +96,10 @@ auto TokenizedBuffer::GetIdentifier(TokenIndex token) const -> IdentifierId {
|
||||
return token_info.ident_id;
|
||||
}
|
||||
|
||||
auto TokenizedBuffer::GetIntegerLiteral(TokenIndex token) const -> IntegerId {
|
||||
auto TokenizedBuffer::GetIntLiteral(TokenIndex token) const -> IntId {
|
||||
const auto& token_info = GetTokenInfo(token);
|
||||
CARBON_CHECK(token_info.kind == TokenKind::IntegerLiteral) << token_info.kind;
|
||||
return token_info.integer_id;
|
||||
CARBON_CHECK(token_info.kind == TokenKind::IntLiteral) << token_info.kind;
|
||||
return token_info.int_id;
|
||||
}
|
||||
|
||||
auto TokenizedBuffer::GetRealLiteral(TokenIndex token) const -> RealId {
|
||||
@@ -119,7 +119,7 @@ auto TokenizedBuffer::GetTypeLiteralSize(TokenIndex token) const
|
||||
-> const llvm::APInt& {
|
||||
const auto& token_info = GetTokenInfo(token);
|
||||
CARBON_CHECK(token_info.kind.is_sized_type_literal()) << token_info.kind;
|
||||
return value_stores_->integers().Get(token_info.integer_id);
|
||||
return value_stores_->ints().Get(token_info.int_id);
|
||||
}
|
||||
|
||||
auto TokenizedBuffer::GetMatchedClosingToken(TokenIndex opening_token) const
|
||||
@@ -257,10 +257,10 @@ auto TokenizedBuffer::PrintToken(llvm::raw_ostream& output_stream,
|
||||
case TokenKind::Identifier:
|
||||
output_stream << ", identifier: " << GetIdentifier(token).index;
|
||||
break;
|
||||
case TokenKind::IntegerLiteral:
|
||||
case TokenKind::IntLiteral:
|
||||
output_stream << ", value: `";
|
||||
value_stores_->integers()
|
||||
.Get(GetIntegerLiteral(token))
|
||||
value_stores_->ints()
|
||||
.Get(GetIntLiteral(token))
|
||||
.print(output_stream, /*isSigned=*/false);
|
||||
output_stream << "`";
|
||||
break;
|
||||
|
||||
@@ -151,8 +151,8 @@ class TokenizedBuffer : public Printable<TokenizedBuffer> {
|
||||
// an `Identifier`.
|
||||
auto GetIdentifier(TokenIndex token) const -> IdentifierId;
|
||||
|
||||
// Returns the value of an `IntegerLiteral()` token.
|
||||
auto GetIntegerLiteral(TokenIndex token) const -> IntegerId;
|
||||
// Returns the value of an `IntLiteral()` token.
|
||||
auto GetIntLiteral(TokenIndex token) const -> IntId;
|
||||
|
||||
// Returns the value of an `RealLiteral()` token.
|
||||
auto GetRealLiteral(TokenIndex token) const -> RealId;
|
||||
@@ -294,7 +294,7 @@ class TokenizedBuffer : public Printable<TokenizedBuffer> {
|
||||
|
||||
IdentifierId ident_id = IdentifierId::Invalid;
|
||||
StringLiteralId string_literal_id;
|
||||
IntegerId integer_id;
|
||||
IntId int_id;
|
||||
RealId real_id;
|
||||
TokenIndex closing_token;
|
||||
TokenIndex opening_token;
|
||||
|
||||
@@ -106,7 +106,7 @@ TEST_F(LexerTest, HandlesNumericLiteral) {
|
||||
ASSERT_THAT(buffer,
|
||||
HasTokens(llvm::ArrayRef<ExpectedToken>{
|
||||
{.kind = TokenKind::FileStart, .line = 1, .column = 1},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 1,
|
||||
.column = 1,
|
||||
.indent_column = 1,
|
||||
@@ -115,32 +115,32 @@ TEST_F(LexerTest, HandlesNumericLiteral) {
|
||||
.line = 1,
|
||||
.column = 3,
|
||||
.indent_column = 1},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 1,
|
||||
.column = 4,
|
||||
.indent_column = 1,
|
||||
.text = "578"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 2,
|
||||
.column = 3,
|
||||
.indent_column = 3,
|
||||
.text = "1"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 2,
|
||||
.column = 6,
|
||||
.indent_column = 3,
|
||||
.text = "2"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 3,
|
||||
.column = 1,
|
||||
.indent_column = 1,
|
||||
.text = "0x12_3ABC"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 4,
|
||||
.column = 1,
|
||||
.indent_column = 1,
|
||||
.text = "0b10_10_11"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 5,
|
||||
.column = 1,
|
||||
.indent_column = 1,
|
||||
@@ -154,29 +154,22 @@ TEST_F(LexerTest, HandlesNumericLiteral) {
|
||||
}));
|
||||
auto token_start = buffer.tokens().begin();
|
||||
auto token_12 = token_start + 1;
|
||||
EXPECT_EQ(value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_12)),
|
||||
12);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_12)), 12);
|
||||
auto token_578 = token_12 + 2;
|
||||
EXPECT_EQ(value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_578)),
|
||||
578);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_578)), 578);
|
||||
auto token_1 = token_578 + 1;
|
||||
EXPECT_EQ(value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_1)),
|
||||
1);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_1)), 1);
|
||||
auto token_2 = token_1 + 1;
|
||||
EXPECT_EQ(value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_2)),
|
||||
2);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_2)), 2);
|
||||
auto token_0x12_3abc = token_2 + 1;
|
||||
EXPECT_EQ(
|
||||
value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_0x12_3abc)),
|
||||
0x12'3abc);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_0x12_3abc)),
|
||||
0x12'3abc);
|
||||
auto token_0b10_10_11 = token_0x12_3abc + 1;
|
||||
EXPECT_EQ(
|
||||
value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_0b10_10_11)),
|
||||
0b10'10'11);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_0b10_10_11)),
|
||||
0b10'10'11);
|
||||
auto token_1_234_567 = token_0b10_10_11 + 1;
|
||||
EXPECT_EQ(
|
||||
value_stores_.integers().Get(buffer.GetIntegerLiteral(*token_1_234_567)),
|
||||
1'234'567);
|
||||
EXPECT_EQ(value_stores_.ints().Get(buffer.GetIntLiteral(*token_1_234_567)),
|
||||
1'234'567);
|
||||
auto token_1_5e9 = token_1_234_567 + 1;
|
||||
auto value_1_5e9 =
|
||||
value_stores_.reals().Get(buffer.GetRealLiteral(*token_1_5e9));
|
||||
@@ -196,7 +189,7 @@ TEST_F(LexerTest, HandlesInvalidNumericLiterals) {
|
||||
.column = 1,
|
||||
.indent_column = 1,
|
||||
.text = "14x"},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
{.kind = TokenKind::IntLiteral,
|
||||
.line = 1,
|
||||
.column = 5,
|
||||
.indent_column = 1,
|
||||
@@ -240,13 +233,13 @@ TEST_F(LexerTest, SplitsNumericLiteralsProperly) {
|
||||
EXPECT_TRUE(buffer.has_errors());
|
||||
EXPECT_THAT(buffer, HasTokens(llvm::ArrayRef<ExpectedToken>{
|
||||
{.kind = TokenKind::FileStart},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "1"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "1"},
|
||||
{.kind = TokenKind::Period},
|
||||
// newline
|
||||
{.kind = TokenKind::Period},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "2"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "2"},
|
||||
// newline
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "3"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "3"},
|
||||
{.kind = TokenKind::Period},
|
||||
{.kind = TokenKind::Plus},
|
||||
{.kind = TokenKind::Identifier, .text = "foo"},
|
||||
@@ -257,18 +250,18 @@ TEST_F(LexerTest, SplitsNumericLiteralsProperly) {
|
||||
// newline
|
||||
{.kind = TokenKind::RealLiteral, .text = "5.0e+123"},
|
||||
{.kind = TokenKind::Plus},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "456"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "456"},
|
||||
// newline
|
||||
{.kind = TokenKind::Error, .text = "6.0e+1e"},
|
||||
{.kind = TokenKind::Plus},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "2"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "2"},
|
||||
// newline
|
||||
{.kind = TokenKind::Error, .text = "1e7"},
|
||||
// newline
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "8"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "8"},
|
||||
{.kind = TokenKind::Period},
|
||||
{.kind = TokenKind::Period},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "10"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "10"},
|
||||
// newline
|
||||
{.kind = TokenKind::RealLiteral, .text = "9.0"},
|
||||
{.kind = TokenKind::Period},
|
||||
@@ -282,9 +275,9 @@ TEST_F(LexerTest, SplitsNumericLiteralsProperly) {
|
||||
// newline
|
||||
{.kind = TokenKind::Error, .text = "12e"},
|
||||
{.kind = TokenKind::Plus},
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "1"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "1"},
|
||||
// newline
|
||||
{.kind = TokenKind::IntegerLiteral, .text = "13"},
|
||||
{.kind = TokenKind::IntLiteral, .text = "13"},
|
||||
{.kind = TokenKind::Period},
|
||||
{.kind = TokenKind::Underscore},
|
||||
// newline
|
||||
@@ -312,10 +305,7 @@ TEST_F(LexerTest, HandlesGarbageCharacters) {
|
||||
.line = 2,
|
||||
.column = 1,
|
||||
.text = llvm::StringRef("$\0$", 3)},
|
||||
{.kind = TokenKind::IntegerLiteral,
|
||||
.line = 2,
|
||||
.column = 4,
|
||||
.text = "12"},
|
||||
{.kind = TokenKind::IntLiteral, .line = 2, .column = 4, .text = "12"},
|
||||
{.kind = TokenKind::Error, .line = 2, .column = 6, .text = "$"},
|
||||
// newline
|
||||
{.kind = TokenKind::Backslash, .line = 3, .column = 1, .text = "\\"},
|
||||
@@ -885,17 +875,17 @@ TEST_F(LexerTest, TypeLiterals) {
|
||||
.column = 5,
|
||||
.indent_column = 5,
|
||||
.text = {"i0"}},
|
||||
{.kind = TokenKind::IntegerTypeLiteral,
|
||||
{.kind = TokenKind::IntTypeLiteral,
|
||||
.line = 2,
|
||||
.column = 8,
|
||||
.indent_column = 5,
|
||||
.text = {"i1"}},
|
||||
{.kind = TokenKind::IntegerTypeLiteral,
|
||||
{.kind = TokenKind::IntTypeLiteral,
|
||||
.line = 2,
|
||||
.column = 11,
|
||||
.indent_column = 5,
|
||||
.text = {"i20"}},
|
||||
{.kind = TokenKind::IntegerTypeLiteral,
|
||||
{.kind = TokenKind::IntTypeLiteral,
|
||||
.line = 2,
|
||||
.column = 15,
|
||||
.indent_column = 5,
|
||||
@@ -911,12 +901,12 @@ TEST_F(LexerTest, TypeLiterals) {
|
||||
.column = 5,
|
||||
.indent_column = 5,
|
||||
.text = {"u0"}},
|
||||
{.kind = TokenKind::UnsignedIntegerTypeLiteral,
|
||||
{.kind = TokenKind::UnsignedIntTypeLiteral,
|
||||
.line = 3,
|
||||
.column = 8,
|
||||
.indent_column = 5,
|
||||
.text = {"u1"}},
|
||||
{.kind = TokenKind::UnsignedIntegerTypeLiteral,
|
||||
{.kind = TokenKind::UnsignedIntTypeLiteral,
|
||||
.line = 3,
|
||||
.column = 11,
|
||||
.indent_column = 5,
|
||||
@@ -927,17 +917,17 @@ TEST_F(LexerTest, TypeLiterals) {
|
||||
.indent_column = 5,
|
||||
.text = {"u64b"}},
|
||||
|
||||
{.kind = TokenKind::FloatingPointTypeLiteral,
|
||||
{.kind = TokenKind::FloatTypeLiteral,
|
||||
.line = 4,
|
||||
.column = 5,
|
||||
.indent_column = 5,
|
||||
.text = {"f32"}},
|
||||
{.kind = TokenKind::FloatingPointTypeLiteral,
|
||||
{.kind = TokenKind::FloatTypeLiteral,
|
||||
.line = 4,
|
||||
.column = 9,
|
||||
.indent_column = 5,
|
||||
.text = {"f80"}},
|
||||
{.kind = TokenKind::FloatingPointTypeLiteral,
|
||||
{.kind = TokenKind::FloatTypeLiteral,
|
||||
.line = 4,
|
||||
.column = 13,
|
||||
.indent_column = 5,
|
||||
|
||||
@@ -231,10 +231,10 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id)
|
||||
|
||||
auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* {
|
||||
switch (inst_id.index) {
|
||||
case SemIR::BuiltinKind::FloatingPointType.AsInt():
|
||||
case SemIR::BuiltinKind::FloatType.AsInt():
|
||||
// TODO: Handle different sizes.
|
||||
return llvm::Type::getDoubleTy(*llvm_context_);
|
||||
case SemIR::BuiltinKind::IntegerType.AsInt():
|
||||
case SemIR::BuiltinKind::IntType.AsInt():
|
||||
// TODO: Handle different sizes.
|
||||
return llvm::Type::getInt32Ty(*llvm_context_);
|
||||
case SemIR::BuiltinKind::BoolType.AsInt():
|
||||
|
||||
@@ -200,9 +200,9 @@ auto HandleInitializeFrom(FunctionContext& context, SemIR::InstId /*inst_id*/,
|
||||
context.FinishInit(storage_type_id, inst.dest_id, inst.src_id);
|
||||
}
|
||||
|
||||
auto HandleIntegerLiteral(FunctionContext& context, SemIR::InstId inst_id,
|
||||
SemIR::IntegerLiteral inst) -> void {
|
||||
const llvm::APInt& i = context.sem_ir().integers().Get(inst.integer_id);
|
||||
auto HandleIntLiteral(FunctionContext& context, SemIR::InstId inst_id,
|
||||
SemIR::IntLiteral inst) -> void {
|
||||
const llvm::APInt& i = context.sem_ir().ints().Get(inst.int_id);
|
||||
// TODO: This won't offer correct semantics, but seems close enough for now.
|
||||
llvm::Value* v =
|
||||
llvm::ConstantInt::get(context.builder().getInt32Ty(), i.getZExtValue());
|
||||
|
||||
@@ -258,9 +258,8 @@ auto HandleTupleAccess(FunctionContext& context, SemIR::InstId inst_id,
|
||||
auto HandleTupleIndex(FunctionContext& context, SemIR::InstId inst_id,
|
||||
SemIR::TupleIndex inst) -> void {
|
||||
auto index_inst =
|
||||
context.sem_ir().insts().GetAs<SemIR::IntegerLiteral>(inst.index_id);
|
||||
auto index =
|
||||
context.sem_ir().integers().Get(index_inst.integer_id).getZExtValue();
|
||||
context.sem_ir().insts().GetAs<SemIR::IntLiteral>(inst.index_id);
|
||||
auto index = context.sem_ir().ints().Get(index_inst.int_id).getZExtValue();
|
||||
context.SetLocal(inst_id, GetAggregateElement(context, inst.tuple_id,
|
||||
SemIR::MemberIndex(index),
|
||||
inst.type_id, "tuple.index"));
|
||||
|
||||
@@ -241,8 +241,7 @@ auto Context::SkipTo(Lex::TokenIndex t) -> void {
|
||||
// operand according to the rules for infix operator parsing.
|
||||
static auto IsAssumedStartOfOperand(Lex::TokenKind kind) -> bool {
|
||||
return kind.IsOneOf({Lex::TokenKind::OpenParen, Lex::TokenKind::Identifier,
|
||||
Lex::TokenKind::IntegerLiteral,
|
||||
Lex::TokenKind::RealLiteral,
|
||||
Lex::TokenKind::IntLiteral, Lex::TokenKind::RealLiteral,
|
||||
Lex::TokenKind::StringLiteral});
|
||||
}
|
||||
|
||||
@@ -252,7 +251,7 @@ static auto IsAssumedEndOfOperand(Lex::TokenKind kind) -> bool {
|
||||
return kind.IsOneOf(
|
||||
{Lex::TokenKind::CloseParen, Lex::TokenKind::CloseCurlyBrace,
|
||||
Lex::TokenKind::CloseSquareBracket, Lex::TokenKind::Identifier,
|
||||
Lex::TokenKind::IntegerLiteral, Lex::TokenKind::RealLiteral,
|
||||
Lex::TokenKind::IntLiteral, Lex::TokenKind::RealLiteral,
|
||||
Lex::TokenKind::StringLiteral});
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ auto HandleExprInPostfix(Context& context) -> void {
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::IntegerLiteral: {
|
||||
context.AddLeafNode(NodeKind::IntegerLiteral, context.Consume());
|
||||
case Lex::TokenKind::IntLiteral: {
|
||||
context.AddLeafNode(NodeKind::IntLiteral, context.Consume());
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
@@ -107,20 +107,18 @@ auto HandleExprInPostfix(Context& context) -> void {
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::IntegerTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::IntegerTypeLiteral, context.Consume());
|
||||
case Lex::TokenKind::IntTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::IntTypeLiteral, context.Consume());
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::UnsignedIntegerTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::UnsignedIntegerTypeLiteral,
|
||||
context.Consume());
|
||||
case Lex::TokenKind::UnsignedIntTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::UnsignedIntTypeLiteral, context.Consume());
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::FloatingPointTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::FloatingPointTypeLiteral,
|
||||
context.Consume());
|
||||
case Lex::TokenKind::FloatTypeLiteral: {
|
||||
context.AddLeafNode(NodeKind::FloatTypeLiteral, context.Consume());
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -427,19 +427,19 @@ CARBON_PARSE_NODE_KIND_CHILD_COUNT(PointerMemberAccessExpr, 2,
|
||||
// A value literal.
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(BoolLiteralFalse, CARBON_TOKEN(False))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(BoolLiteralTrue, CARBON_TOKEN(True))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(IntegerLiteral,
|
||||
CARBON_TOKEN(IntegerLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(IntLiteral,
|
||||
CARBON_TOKEN(IntLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(RealLiteral, CARBON_TOKEN(RealLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(StringLiteral, CARBON_TOKEN(StringLiteral))
|
||||
|
||||
// A type literal.
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(BoolTypeLiteral, CARBON_TOKEN(Bool))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(IntegerTypeLiteral,
|
||||
CARBON_TOKEN(IntegerTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(UnsignedIntegerTypeLiteral,
|
||||
CARBON_TOKEN(UnsignedIntegerTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(FloatingPointTypeLiteral,
|
||||
CARBON_TOKEN(FloatingPointTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(IntTypeLiteral,
|
||||
CARBON_TOKEN(IntTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(UnsignedIntTypeLiteral,
|
||||
CARBON_TOKEN(UnsignedIntTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(FloatTypeLiteral,
|
||||
CARBON_TOKEN(FloatTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(StringTypeLiteral,
|
||||
CARBON_TOKEN(StringTypeLiteral))
|
||||
CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(TypeTypeLiteral, CARBON_TOKEN(Type))
|
||||
|
||||
+3
-3
@@ -75,7 +75,7 @@ var x: [i32];
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ']', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 6},
|
||||
@@ -118,7 +118,7 @@ var x: [i32];
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', has_error: yes, subtree_size: 5},
|
||||
@@ -132,7 +132,7 @@ var x: [i32];
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ']', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 6},
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@ var x: [i32; 10];
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '10'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '10'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ var x: [i32;];
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 6},
|
||||
|
||||
+3
-3
@@ -13,14 +13,14 @@ var test_str: String = "Test";
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'test_i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'test_f64'},
|
||||
// CHECK:STDOUT: {kind: 'FloatingPointTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'FloatTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'RealLiteral', text: '0.1'},
|
||||
|
||||
+9
-9
@@ -36,31 +36,31 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'ints'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '5'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '5'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'ParenExprOrTupleLiteralStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '8'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '8'},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteralComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '9'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '9'},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteralComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0x8'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0x8'},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteralComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0b1000'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0b1000'},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteralComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '39999999999999999993'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '39999999999999999993'},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteralComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'TupleLiteral', text: ')', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 22},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'floats'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'FloatingPointTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'FloatTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExprSemi', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '7'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '7'},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
|
||||
+2
-2
@@ -15,10 +15,10 @@ fn F(n: i32) -> i32 {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
|
||||
|
||||
+3
-3
@@ -29,7 +29,7 @@ class Foo {
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 8},
|
||||
@@ -43,7 +43,7 @@ class Foo {
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
|
||||
@@ -67,7 +67,7 @@ class Foo {
|
||||
// CHECK:STDOUT: {kind: 'SelfValueNameExpr', text: 'self'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'PointerMemberAccessExpr', text: '->', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '=', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 19},
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class Foo {
|
||||
// CHECK:STDOUT: {kind: 'ClassDefinitionStart', text: '{', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ClassDefinition', text: '}', subtree_size: 9},
|
||||
|
||||
@@ -24,7 +24,7 @@ fn foo() {
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForIn', text: ':', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'y'},
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ fn foo() {
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForIn', text: 'var', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'y'},
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ fn foo() -> i32 {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ fn foo() {
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'y'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForIn', text: 'in', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'x'},
|
||||
@@ -32,7 +32,7 @@ fn foo() {
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'z'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForIn', text: 'in', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'y'},
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ fn foo() {
|
||||
// CHECK:STDOUT: {kind: 'ForHeaderStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForIn', text: 'in', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'y'},
|
||||
|
||||
@@ -13,7 +13,7 @@ fn foo(addr a: i32*);
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'Address', text: 'addr', subtree_size: 5},
|
||||
|
||||
@@ -13,11 +13,11 @@ fn foo[a: i32, b: i32]();
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
|
||||
@@ -13,11 +13,11 @@ fn foo(a: i32, b: i32);
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 12},
|
||||
|
||||
@@ -13,7 +13,7 @@ fn foo() -> u32;
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'UnsignedIntegerTypeLiteral', text: 'u32'},
|
||||
// CHECK:STDOUT: {kind: 'UnsignedIntTypeLiteral', text: 'u32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -15,11 +15,11 @@ fn foo(bar: i64, baz: i64) {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'bar'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'baz'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i64'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 12},
|
||||
|
||||
@@ -15,11 +15,11 @@ fn foo() -> f64 {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FloatingPointTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'FloatTypeLiteral', text: 'f64'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '42'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '42'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: ';', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -36,7 +36,7 @@ interface Bar[a: i32] {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: ';', has_error: yes, subtree_size: 8},
|
||||
@@ -49,7 +49,7 @@ interface Bar[a: i32] {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 8},
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Bar[a: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
@@ -25,7 +25,7 @@ interface Bar[a: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Bar[a: i32,]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 6},
|
||||
@@ -26,7 +26,7 @@ interface Bar[a: i32,]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 6},
|
||||
|
||||
+12
-12
@@ -15,27 +15,27 @@ interface Bar[a: i32, b: i32, c: i32, d: i32, e: i32, f: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'e'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'f'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 25},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
@@ -45,27 +45,27 @@ interface Bar[a: i32, b: i32, c: i32, d: i32, e: i32, f: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'e'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'f'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 25},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
|
||||
@@ -15,11 +15,11 @@ interface Bar[a: i32, b: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
@@ -29,11 +29,11 @@ interface Bar[a: i32, b: i32]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
|
||||
@@ -15,11 +15,11 @@ interface Bar[a: i32, b: i32,]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 10},
|
||||
@@ -30,11 +30,11 @@ interface Bar[a: i32, b: i32,]() {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 10},
|
||||
|
||||
@@ -13,7 +13,7 @@ fn foo(a:! i32);
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'GenericPatternBinding', text: ':!', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8},
|
||||
|
||||
@@ -13,7 +13,7 @@ fn foo(template a:! i32);
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'GenericPatternBinding', text: ':!', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Template', text: 'template', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 6},
|
||||
|
||||
@@ -13,7 +13,7 @@ fn foo(template addr a:! i32);
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'GenericPatternBinding', text: ':!', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Address', text: 'addr', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'Template', text: 'template', subtree_size: 5},
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ interface Bar(a: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: ';', subtree_size: 8},
|
||||
@@ -23,7 +23,7 @@ interface Bar(a: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDefinitionStart', text: '{', subtree_size: 8},
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Bar(a: i32,) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 6},
|
||||
@@ -24,7 +24,7 @@ interface Bar(a: i32,) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 6},
|
||||
|
||||
+12
-12
@@ -15,27 +15,27 @@ interface Bar(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'e'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'f'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 25},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: ';', subtree_size: 28},
|
||||
@@ -43,27 +43,27 @@ interface Bar(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'e'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'f'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 25},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDefinitionStart', text: '{', subtree_size: 28},
|
||||
|
||||
+4
-4
@@ -15,11 +15,11 @@ interface Bar(a: i32, b: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: ';', subtree_size: 12},
|
||||
@@ -27,11 +27,11 @@ interface Bar(a: i32, b: i32) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDefinitionStart', text: '{', subtree_size: 12},
|
||||
|
||||
@@ -15,11 +15,11 @@ interface Bar(a: i32, b: i32,) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 10},
|
||||
@@ -28,11 +28,11 @@ interface Bar(a: i32, b: i32,) {}
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 10},
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@ fn F(b: bool, x: i32, y: i32) -> bool {
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'y'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
|
||||
|
||||
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
|
||||
@@ -21,12 +21,12 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', has_error: yes, subtree_size: 6},
|
||||
|
||||
@@ -21,12 +21,12 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'if', has_error: yes, subtree_size: 6},
|
||||
|
||||
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
||||
|
||||
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ fn F() -> if true then i32 else i32* {
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
@@ -24,9 +24,9 @@ fn F() -> if true then i32 else i32* {
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprIf', text: 'if', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IfExprThen', text: 'then', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IfExprElse', text: 'else', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 8},
|
||||
|
||||
+2
-2
@@ -11,12 +11,12 @@ var v: i32 = t[0];
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 't'},
|
||||
// CHECK:STDOUT: {kind: 'IndexExprStart', text: '[', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IndexExpr', text: ']', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ var v: i32 = t[];
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 't'},
|
||||
|
||||
@@ -14,12 +14,12 @@ var v: i32 = t[0,];
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 't'},
|
||||
// CHECK:STDOUT: {kind: 'IndexExprStart', text: '[', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IndexExpr', text: ']', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ let ? = 4;
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '?', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: '?', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ let a = 4;
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '=', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: 'a', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
@@ -31,7 +31,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 11},
|
||||
|
||||
+2
-2
@@ -14,10 +14,10 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
|
||||
+4
-4
@@ -32,17 +32,17 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
|
||||
|
||||
@@ -25,18 +25,18 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '=', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 22},
|
||||
|
||||
@@ -16,7 +16,7 @@ var n: i8 = n* n;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -25,7 +25,7 @@ var c: i32 = == ;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
@@ -34,7 +34,7 @@ var c: i32 = == ;
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '==', has_error: yes},
|
||||
@@ -43,7 +43,7 @@ var c: i32 = == ;
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '==', has_error: yes},
|
||||
|
||||
@@ -27,10 +27,10 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', has_error: yes, subtree_size: 2},
|
||||
|
||||
@@ -29,7 +29,7 @@ fn F(n: i32) {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 8},
|
||||
@@ -38,16 +38,16 @@ fn F(n: i32) {
|
||||
// CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'as', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '+', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'as', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '5'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '2'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '5'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '2'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '%', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: 'as', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 26},
|
||||
|
||||
@@ -39,10 +39,10 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'IntegerLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExprOrTupleLiteralStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpr', text: ')', has_error: yes, subtree_size: 3},
|
||||
|
||||
@@ -14,7 +14,7 @@ var n: i8 = n* -n;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -14,7 +14,7 @@ var n: i8 = n* *p;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -18,7 +18,7 @@ var n: i8 = n**p;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -18,7 +18,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'G'},
|
||||
// CHECK:STDOUT: {kind: 'CallExprStart', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'CallExprComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -14,12 +14,12 @@ fn F(p: i32*, n: i32) {
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'p'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ParamListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 13},
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'q'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
@@ -30,7 +30,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'TypeTypeLiteral', text: 'type'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 22},
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ var n: i8 = n * n;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
@@ -11,7 +11,7 @@ var n: i8 = n*n;
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'Name', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'IntegerTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'NameExpr', text: 'n'},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user