diff --git a/common/fuzzing/carbon.proto b/common/fuzzing/carbon.proto index 9709377b6fb8..d691e5703763 100644 --- a/common/fuzzing/carbon.proto +++ b/common/fuzzing/carbon.proto @@ -11,6 +11,11 @@ message LibraryName { optional string path = 2; } +message DeclaredName { + repeated string qualifiers = 1; + optional string name = 2; +} + // Expressions. message CallExpression { @@ -358,7 +363,7 @@ message ReturnTerm { } message FunctionDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated GenericBinding deduced_parameters = 2; optional Pattern self_pattern = 3; optional TuplePattern param_pattern = 4; @@ -372,7 +377,7 @@ message DestructorDeclaration { } message ClassDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated Declaration members = 2; optional TuplePattern type_params = 3; } @@ -383,7 +388,7 @@ message AlternativeSignature { } message ChoiceDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated AlternativeSignature alternatives = 2; } @@ -408,12 +413,12 @@ message InterfaceImplDeclaration { } message InterfaceDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated Declaration members = 2; } message ConstraintDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated Declaration members = 2; } @@ -435,13 +440,13 @@ message MatchFirstDeclaration { } message AliasDeclaration { - optional string name = 1; + optional DeclaredName name = 1; optional Expression target = 2; } // EXPERIMENTAL MIXIN FEATURE message MixinDeclaration { - optional string name = 1; + optional DeclaredName name = 1; repeated Declaration members = 2; // Type params not implemented yet // optional TuplePattern params = 3; @@ -454,7 +459,7 @@ message MixDeclaration { } message NamespaceDeclaration { - optional string name = 1; + optional DeclaredName name = 1; } message Declaration { diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index 3c96453a90f8..74299b55eef9 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/common/fuzzing/proto_to_carbon.cpp @@ -715,6 +715,15 @@ static auto ReturnTermToCarbon(const Fuzzing::ReturnTerm& return_term, } } +static auto DeclaredNameToCarbon(const Fuzzing::DeclaredName& name, + llvm::raw_ostream& out) -> void { + for (const std::string& qual : name.qualifiers()) { + IdentifierToCarbon(qual, out); + out << "."; + } + IdentifierToCarbon(name.name(), out); +} + static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, llvm::raw_ostream& out) -> void { switch (declaration.kind_case()) { @@ -725,7 +734,9 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, } case Fuzzing::Declaration::kNamespace: { - out << "namespace " << declaration.namespace_().name() << ";"; + out << "namespace "; + DeclaredNameToCarbon(declaration.namespace_().name(), out); + out << ";"; break; } @@ -753,7 +764,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kFunction: { const auto& function = declaration.function(); out << "fn "; - IdentifierToCarbon(function.name(), out); + DeclaredNameToCarbon(function.name(), out); if (!function.deduced_parameters().empty() || function.has_self_pattern()) { @@ -786,7 +797,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kClassDeclaration: { const auto& class_declaration = declaration.class_declaration(); out << "class "; - IdentifierToCarbon(class_declaration.name(), out); + DeclaredNameToCarbon(class_declaration.name(), out); // type_params is optional. if (class_declaration.has_type_params()) { @@ -806,7 +817,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kMixin: { const auto& mixin_declaration = declaration.mixin(); out << "__mixin "; - IdentifierToCarbon(mixin_declaration.name(), out); + DeclaredNameToCarbon(mixin_declaration.name(), out); // type params are not implemented yet // if (mixin_declaration.has_params()) { @@ -835,7 +846,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kChoice: { const auto& choice = declaration.choice(); out << "choice "; - IdentifierToCarbon(choice.name(), out); + DeclaredNameToCarbon(choice.name(), out); out << "{"; llvm::ListSeparator sep; @@ -897,7 +908,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kInterface: { const auto& interface = declaration.interface(); out << "interface "; - IdentifierToCarbon(interface.name(), out); + DeclaredNameToCarbon(interface.name(), out); out << " {\n"; for (const auto& member : interface.members()) { DeclarationToCarbon(member, out); @@ -910,7 +921,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kConstraint: { const auto& constraint = declaration.constraint(); out << "constraint "; - IdentifierToCarbon(constraint.name(), out); + DeclaredNameToCarbon(constraint.name(), out); out << " {\n"; for (const auto& member : constraint.members()) { DeclarationToCarbon(member, out); @@ -952,7 +963,7 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, case Fuzzing::Declaration::kAlias: { const auto& alias = declaration.alias(); out << "alias "; - IdentifierToCarbon(alias.name(), out); + DeclaredNameToCarbon(alias.name(), out); out << " = "; ExpressionToCarbon(alias.target(), out); out << ";"; diff --git a/explorer/ast/declaration.cpp b/explorer/ast/declaration.cpp index ea4e9e33f8b8..876b284d34eb 100644 --- a/explorer/ast/declaration.cpp +++ b/explorer/ast/declaration.cpp @@ -236,24 +236,24 @@ auto GetName(const Declaration& declaration) -> std::optional { switch (declaration.kind()) { case DeclarationKind::NamespaceDeclaration: - return cast(declaration).name(); + return cast(declaration).name().inner_name(); case DeclarationKind::FunctionDeclaration: return cast(declaration).name().inner_name(); case DeclarationKind::DestructorDeclaration: return "destructor"; case DeclarationKind::ClassDeclaration: - return cast(declaration).name(); + return cast(declaration).name().inner_name(); case DeclarationKind::MixinDeclaration: { - return cast(declaration).name(); + return cast(declaration).name().inner_name(); } case DeclarationKind::MixDeclaration: { return std::nullopt; } case DeclarationKind::ChoiceDeclaration: - return cast(declaration).name(); + return cast(declaration).name().inner_name(); case DeclarationKind::InterfaceDeclaration: case DeclarationKind::ConstraintDeclaration: - return cast(declaration).name(); + return cast(declaration).name().inner_name(); case DeclarationKind::VariableDeclaration: return cast(declaration).binding().name(); case DeclarationKind::AssociatedConstantDeclaration: @@ -266,7 +266,7 @@ auto GetName(const Declaration& declaration) case DeclarationKind::SelfDeclaration: return SelfDeclaration::name(); case DeclarationKind::AliasDeclaration: { - return cast(declaration).name(); + return cast(declaration).name().inner_name(); } } } diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index 4bf93653867b..3e2f16307a38 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -126,6 +126,12 @@ class Declaration : public AstNode { bool is_type_checked_ = false; }; +// Determine whether two declarations declare the same entity. +inline auto DeclaresSameEntity(const Declaration& first, + const Declaration& second) -> bool { + return &first == &second; +} + // A name being declared in a named declaration. class DeclaredName { public: @@ -173,7 +179,7 @@ class NamespaceDeclaration : public Declaration { public: using ImplementsCarbonValueNode = void; - explicit NamespaceDeclaration(SourceLocation source_loc, std::string name) + explicit NamespaceDeclaration(SourceLocation source_loc, DeclaredName name) : Declaration(AstNodeKind::NamespaceDeclaration, source_loc), name_(std::move(name)) {} @@ -181,11 +187,11 @@ class NamespaceDeclaration : public Declaration { return InheritsFromNamespaceDeclaration(node->kind()); } - auto name() const -> std::string_view { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto value_category() const -> ValueCategory { return ValueCategory::Let; } private: - std::string name_; + DeclaredName name_; }; // A function's virtual override keyword. @@ -326,7 +332,7 @@ class ClassDeclaration : public Declaration { public: using ImplementsCarbonValueNode = void; - ClassDeclaration(SourceLocation source_loc, std::string name, + ClassDeclaration(SourceLocation source_loc, DeclaredName name, Nonnull self_decl, ClassExtensibility extensibility, std::optional> type_params, @@ -344,7 +350,7 @@ class ClassDeclaration : public Declaration { return InheritsFromClassDeclaration(node->kind()); } - auto name() const -> const std::string& { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto extensibility() const -> ClassExtensibility { return extensibility_; } auto type_params() const -> std::optional> { return type_params_; @@ -384,7 +390,7 @@ class ClassDeclaration : public Declaration { } private: - std::string name_; + DeclaredName name_; ClassExtensibility extensibility_; Nonnull self_decl_; std::optional> type_params_; @@ -400,7 +406,7 @@ class MixinDeclaration : public Declaration { public: using ImplementsCarbonValueNode = void; - MixinDeclaration(SourceLocation source_loc, std::string name, + MixinDeclaration(SourceLocation source_loc, DeclaredName name, std::optional> params, Nonnull self, std::vector> members) @@ -414,7 +420,7 @@ class MixinDeclaration : public Declaration { return InheritsFromMixinDeclaration(node->kind()); } - auto name() const -> const std::string& { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto params() const -> std::optional> { return params_; } @@ -428,7 +434,7 @@ class MixinDeclaration : public Declaration { auto value_category() const -> ValueCategory { return ValueCategory::Let; } private: - std::string name_; + DeclaredName name_; std::optional> params_; Nonnull self_; std::vector> members_; @@ -487,7 +493,7 @@ class ChoiceDeclaration : public Declaration { public: using ImplementsCarbonValueNode = void; - ChoiceDeclaration(SourceLocation source_loc, std::string name, + ChoiceDeclaration(SourceLocation source_loc, DeclaredName name, std::optional> type_params, std::vector> alternatives) : Declaration(AstNodeKind::ChoiceDeclaration, source_loc), @@ -499,7 +505,7 @@ class ChoiceDeclaration : public Declaration { return InheritsFromChoiceDeclaration(node->kind()); } - auto name() const -> const std::string& { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto type_params() const -> std::optional> { return type_params_; @@ -524,7 +530,7 @@ class ChoiceDeclaration : public Declaration { auto value_category() const -> ValueCategory { return ValueCategory::Let; } private: - std::string name_; + DeclaredName name_; std::optional> type_params_; std::vector> alternatives_; std::vector members_; @@ -577,7 +583,7 @@ class ConstraintTypeDeclaration : public Declaration { using ImplementsCarbonValueNode = void; ConstraintTypeDeclaration(AstNodeKind kind, Nonnull arena, - SourceLocation source_loc, std::string name, + SourceLocation source_loc, DeclaredName name, std::optional> params, std::vector> members) : Declaration(kind, source_loc), @@ -586,7 +592,8 @@ class ConstraintTypeDeclaration : public Declaration { self_type_(arena->New(source_loc)), members_(std::move(members)) { // `interface X` has `Self:! X`. - auto* self_type_ref = arena->New(source_loc, name); + auto* self_type_ref = arena->New( + source_loc, std::string(name_.inner_name())); self_type_ref->set_value_node(self_type_); self_ = arena->New(source_loc, "Self", self_type_ref); } @@ -595,7 +602,7 @@ class ConstraintTypeDeclaration : public Declaration { return InheritsFromConstraintTypeDeclaration(node->kind()); } - auto name() const -> const std::string& { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto params() const -> std::optional> { return params_; } @@ -630,7 +637,7 @@ class ConstraintTypeDeclaration : public Declaration { } private: - std::string name_; + DeclaredName name_; std::optional> params_; Nonnull self_type_; Nonnull self_; @@ -644,7 +651,7 @@ class InterfaceDeclaration : public ConstraintTypeDeclaration { using ImplementsCarbonValueNode = void; InterfaceDeclaration(Nonnull arena, SourceLocation source_loc, - std::string name, + DeclaredName name, std::optional> params, std::vector> members) : ConstraintTypeDeclaration(AstNodeKind::InterfaceDeclaration, arena, @@ -662,7 +669,7 @@ class ConstraintDeclaration : public ConstraintTypeDeclaration { using ImplementsCarbonValueNode = void; ConstraintDeclaration(Nonnull arena, SourceLocation source_loc, - std::string name, + DeclaredName name, std::optional> params, std::vector> members) : ConstraintTypeDeclaration(AstNodeKind::ConstraintDeclaration, arena, @@ -851,7 +858,7 @@ class AliasDeclaration : public Declaration { public: using ImplementsCarbonValueNode = void; - explicit AliasDeclaration(SourceLocation source_loc, std::string name, + explicit AliasDeclaration(SourceLocation source_loc, DeclaredName name, Nonnull target) : Declaration(AstNodeKind::AliasDeclaration, source_loc), name_(std::move(name)), @@ -861,13 +868,13 @@ class AliasDeclaration : public Declaration { return InheritsFromAliasDeclaration(node->kind()); } - auto name() const -> const std::string& { return name_; } + auto name() const -> const DeclaredName& { return name_; } auto target() const -> const Expression& { return *target_; } auto target() -> Expression& { return *target_; } auto value_category() const -> ValueCategory { return ValueCategory::Let; } private: - std::string name_; + DeclaredName name_; Nonnull target_; }; diff --git a/explorer/fuzzing/ast_to_proto.cpp b/explorer/fuzzing/ast_to_proto.cpp index 478b5c920af5..3a281f49b9aa 100644 --- a/explorer/fuzzing/ast_to_proto.cpp +++ b/explorer/fuzzing/ast_to_proto.cpp @@ -614,6 +614,16 @@ static auto ReturnTermToProto(const ReturnTerm& return_term) return return_term_proto; } +static auto DeclaredNameToProto(const DeclaredName& name) + -> Fuzzing::DeclaredName { + Fuzzing::DeclaredName name_proto; + name_proto.set_name(std::string(name.inner_name())); + for (auto& [loc, qual] : name.qualifiers()) { + name_proto.add_qualifiers(qual); + } + return name_proto; +} + static auto DeclarationToProto(const Declaration& declaration) -> Fuzzing::Declaration { Fuzzing::Declaration declaration_proto; @@ -621,7 +631,8 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::NamespaceDeclaration: { const auto& namespace_decl = cast(declaration); auto* namespace_proto = declaration_proto.mutable_namespace_(); - namespace_proto->set_name(std::string(namespace_decl.name())); + *namespace_proto->mutable_name() = + DeclaredNameToProto(namespace_decl.name()); break; } case DeclarationKind::DestructorDeclaration: { @@ -657,7 +668,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::FunctionDeclaration: { const auto& function = cast(declaration); auto* function_proto = declaration_proto.mutable_function(); - function_proto->set_name(std::string(function.name().inner_name())); + *function_proto->mutable_name() = DeclaredNameToProto(function.name()); for (Nonnull binding : function.deduced_parameters()) { *function_proto->add_deduced_parameters() = @@ -697,7 +708,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::ClassDeclaration: { const auto& class_decl = cast(declaration); auto* class_proto = declaration_proto.mutable_class_declaration(); - class_proto->set_name(class_decl.name()); + *class_proto->mutable_name() = DeclaredNameToProto(class_decl.name()); if (class_decl.type_params().has_value()) { *class_proto->mutable_type_params() = TuplePatternToProto(**class_decl.type_params()); @@ -711,7 +722,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::MixinDeclaration: { const auto& mixin = cast(declaration); auto* mixin_proto = declaration_proto.mutable_mixin(); - mixin_proto->set_name(mixin.name()); + *mixin_proto->mutable_name() = DeclaredNameToProto(mixin.name()); for (const auto& member : mixin.members()) { *mixin_proto->add_members() = DeclarationToProto(*member); } @@ -734,7 +745,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::ChoiceDeclaration: { const auto& choice = cast(declaration); auto* choice_proto = declaration_proto.mutable_choice(); - choice_proto->set_name(choice.name()); + *choice_proto->mutable_name() = DeclaredNameToProto(choice.name()); for (Nonnull alternative : choice.alternatives()) { auto* alternative_proto = choice_proto->add_alternatives(); @@ -781,7 +792,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::InterfaceDeclaration: { const auto& interface = cast(declaration); auto* interface_proto = declaration_proto.mutable_interface(); - interface_proto->set_name(interface.name()); + *interface_proto->mutable_name() = DeclaredNameToProto(interface.name()); for (const auto& member : interface.members()) { *interface_proto->add_members() = DeclarationToProto(*member); } @@ -791,7 +802,8 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::ConstraintDeclaration: { const auto& constraint = cast(declaration); auto* constraint_proto = declaration_proto.mutable_constraint(); - constraint_proto->set_name(constraint.name()); + *constraint_proto->mutable_name() = + DeclaredNameToProto(constraint.name()); for (const auto& member : constraint.members()) { *constraint_proto->add_members() = DeclarationToProto(*member); } @@ -833,7 +845,7 @@ static auto DeclarationToProto(const Declaration& declaration) case DeclarationKind::AliasDeclaration: { const auto& alias = cast(declaration); auto* alias_proto = declaration_proto.mutable_alias(); - alias_proto->set_name(alias.name()); + *alias_proto->mutable_name() = DeclaredNameToProto(alias.name()); *alias_proto->mutable_target() = ExpressionToProto(alias.target()); break; } diff --git a/explorer/fuzzing/fuzzer_corpus/68023ea15a416337ba5d786883fe1ed41b65528c b/explorer/fuzzing/fuzzer_corpus/0058bf96eefe20ae6eaceee383c12d36907710f2 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/68023ea15a416337ba5d786883fe1ed41b65528c rename to explorer/fuzzing/fuzzer_corpus/0058bf96eefe20ae6eaceee383c12d36907710f2 index 127e87a15e3e..f2c2e2367aa7 100644 --- a/explorer/fuzzing/fuzzer_corpus/68023ea15a416337ba5d786883fe1ed41b65528c +++ b/explorer/fuzzing/fuzzer_corpus/0058bf96eefe20ae6eaceee383c12d36907710f2 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7 b/explorer/fuzzing/fuzzer_corpus/015080d35638d6c7a6dce55192171f043955fe3e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7 rename to explorer/fuzzing/fuzzer_corpus/015080d35638d6c7a6dce55192171f043955fe3e index c4b69d71ded6..c5749bf62e16 100644 --- a/explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7 +++ b/explorer/fuzzing/fuzzer_corpus/015080d35638d6c7a6dce55192171f043955fe3e @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -81,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7 b/explorer/fuzzing/fuzzer_corpus/03527ef9005c1d05b8bf667521a324a622e81ba9 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7 rename to explorer/fuzzing/fuzzer_corpus/03527ef9005c1d05b8bf667521a324a622e81ba9 index e82e36dd4625..d4135047dcfc 100644 --- a/explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7 +++ b/explorer/fuzzing/fuzzer_corpus/03527ef9005c1d05b8bf667521a324a622e81ba9 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,21 +24,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -46,13 +47,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -69,7 +63,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -108,7 +104,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -135,7 +133,9 @@ compilation_unit { } declarations { function { - name: "GetAB" + name { + name: "GetAB" + } param_pattern { fields { generic_binding { @@ -285,7 +285,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7df6280ae4f28302e5e218fd59674f4df02fbf0a b/explorer/fuzzing/fuzzer_corpus/03bc316209e9f44df5533e0b4c72641729b3f4f9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/7df6280ae4f28302e5e218fd59674f4df02fbf0a rename to explorer/fuzzing/fuzzer_corpus/03bc316209e9f44df5533e0b4c72641729b3f4f9 index 081550197792..0e3a2a9e5200 100644 --- a/explorer/fuzzing/fuzzer_corpus/7df6280ae4f28302e5e218fd59674f4df02fbf0a +++ b/explorer/fuzzing/fuzzer_corpus/03bc316209e9f44df5533e0b4c72641729b3f4f9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } } } declarations { @@ -35,7 +37,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -76,7 +80,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -104,7 +110,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/03ca8fb6a63c2623870c2f28d0f7a64ffbfd5802 b/explorer/fuzzing/fuzzer_corpus/03ca8fb6a63c2623870c2f28d0f7a64ffbfd5802 new file mode 100644 index 000000000000..0f40b5855ed4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/03ca8fb6a63c2623870c2f28d0f7a64ffbfd5802 @@ -0,0 +1,182 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "lhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 8 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "lhs" + } + } + path { + simple_member_access { + field: "Op" + object { + call { + function { + identifier { + name: "ModWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + operator { + op: Mod + arguments { + identifier { + name: "lhs" + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ac6fa333cfb9a1c037b16c0e10518347826b8ff5 b/explorer/fuzzing/fuzzer_corpus/041848ccba146125cb9038e818f54c3b495a6ad8 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/ac6fa333cfb9a1c037b16c0e10518347826b8ff5 rename to explorer/fuzzing/fuzzer_corpus/041848ccba146125cb9038e818f54c3b495a6ad8 index 8e1af5a150a1..1a111812cd99 100644 --- a/explorer/fuzzing/fuzzer_corpus/ac6fa333cfb9a1c037b16c0e10518347826b8ff5 +++ b/explorer/fuzzing/fuzzer_corpus/041848ccba146125cb9038e818f54c3b495a6ad8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -29,7 +31,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/61082aaaa73d240be4b52a732f1631e158927cc7 b/explorer/fuzzing/fuzzer_corpus/0481d56f09c69f10476dc2498c39d6e7d4c24174 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/61082aaaa73d240be4b52a732f1631e158927cc7 rename to explorer/fuzzing/fuzzer_corpus/0481d56f09c69f10476dc2498c39d6e7d4c24174 index aa2e817a1d44..a4d298641b1d 100644 --- a/explorer/fuzzing/fuzzer_corpus/61082aaaa73d240be4b52a732f1631e158927cc7 +++ b/explorer/fuzzing/fuzzer_corpus/0481d56f09c69f10476dc2498c39d6e7d4c24174 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { fields { binding_pattern { @@ -76,7 +80,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -166,7 +172,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7 b/explorer/fuzzing/fuzzer_corpus/049f14948dace26b462bbe7e8a8675fe701608cb similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7 rename to explorer/fuzzing/fuzzer_corpus/049f14948dace26b462bbe7e8a8675fe701608cb index dce9d9a7f85c..44ad6b3011ed 100644 --- a/explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7 +++ b/explorer/fuzzing/fuzzer_corpus/049f14948dace26b462bbe7e8a8675fe701608cb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { alias { - name: "AB" + name { + name: "AB" + } target { struct_type_literal { fields { @@ -28,7 +30,9 @@ compilation_unit { } declarations { alias { - name: "BA" + name { + name: "BA" + } target { struct_type_literal { fields { @@ -51,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/fe8dde805d96f873cd8516332298f12a6b2abe8d b/explorer/fuzzing/fuzzer_corpus/04c215eb24bf843a80babc4e3dd313b95c4e571f similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/fe8dde805d96f873cd8516332298f12a6b2abe8d rename to explorer/fuzzing/fuzzer_corpus/04c215eb24bf843a80babc4e3dd313b95c4e571f index 1948ada00a66..a9e16396f4b1 100644 --- a/explorer/fuzzing/fuzzer_corpus/fe8dde805d96f873cd8516332298f12a6b2abe8d +++ b/explorer/fuzzing/fuzzer_corpus/04c215eb24bf843a80babc4e3dd313b95c4e571f @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Create" + name { + name: "Create" + } param_pattern { fields { binding_pattern { @@ -135,7 +139,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2 b/explorer/fuzzing/fuzzer_corpus/0501aa4f45620235f062645d5ea731cb1927e39a similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2 rename to explorer/fuzzing/fuzzer_corpus/0501aa4f45620235f062645d5ea731cb1927e39a index 0503b8d9208f..046726d38e2f 100644 --- a/explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2 +++ b/explorer/fuzzing/fuzzer_corpus/0501aa4f45620235f062645d5ea731cb1927e39a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { let { pattern { @@ -21,7 +23,9 @@ compilation_unit { } members { function { - name: "FA" + name { + name: "FA" + } param_pattern { } return_term { @@ -34,18 +38,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { let { pattern { @@ -61,7 +60,9 @@ compilation_unit { } members { function { - name: "FB" + name { + name: "FB" + } param_pattern { } return_term { @@ -74,18 +75,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "C" + name { + name: "C" + } members { impl { kind: InternalImpl @@ -112,26 +108,18 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "TA" - } - } - rhs { + rewrite { + member_name: "TA" + replacement { int_type_literal { } } } } clauses { - equals { - lhs { - designator { - name: "TB" - } - } - rhs { + rewrite { + member_name: "TB" + replacement { int_type_literal { } } @@ -141,7 +129,9 @@ compilation_unit { } members { function { - name: "FA" + name { + name: "FA" + } param_pattern { } return_term { @@ -227,7 +217,9 @@ compilation_unit { } members { function { - name: "FB" + name { + name: "FB" + } param_pattern { } return_term { @@ -395,7 +387,9 @@ compilation_unit { } members { function { - name: "FB" + name { + name: "FB" + } param_pattern { } return_term { @@ -421,7 +415,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/af68a57d6150cbea22c088ce53c3e3701d3e3ade b/explorer/fuzzing/fuzzer_corpus/0542a56192cecd529b82ed2081aa5459863f359e similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/af68a57d6150cbea22c088ce53c3e3701d3e3ade rename to explorer/fuzzing/fuzzer_corpus/0542a56192cecd529b82ed2081aa5459863f359e index 68a50369e6ff..0c1e891d1e5c 100644 --- a/explorer/fuzzing/fuzzer_corpus/af68a57d6150cbea22c088ce53c3e3701d3e3ade +++ b/explorer/fuzzing/fuzzer_corpus/0542a56192cecd529b82ed2081aa5459863f359e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -25,7 +27,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/05cc07bd9d1ef5b891c4f0df70a1463922009b5e b/explorer/fuzzing/fuzzer_corpus/05cc07bd9d1ef5b891c4f0df70a1463922009b5e new file mode 100644 index 000000000000..22ff77562342 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/05cc07bd9d1ef5b891c4f0df70a1463922009b5e @@ -0,0 +1,3473 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "AB" + } + alternatives { + name: "A" + signature { + } + } + alternatives { + name: "B" + signature { + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "AB" + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 6 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 7 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 8 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 9 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 10 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 11 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 12 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 13 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 14 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 15 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 16 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 17 + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc b/explorer/fuzzing/fuzzer_corpus/05ec89686a7f7283373c8ba37135ccd9586c1881 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc rename to explorer/fuzzing/fuzzer_corpus/05ec89686a7f7283373c8ba37135ccd9586c1881 index cf50a66a022a..4fdca968e311 100644 --- a/explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc +++ b/explorer/fuzzing/fuzzer_corpus/05ec89686a7f7283373c8ba37135ccd9586c1881 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/05f7f32cfd698141c460623934959dd1a82f7109 b/explorer/fuzzing/fuzzer_corpus/05f7f32cfd698141c460623934959dd1a82f7109 new file mode 100644 index 000000000000..2b984fa9b04a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/05f7f32cfd698141c460623934959dd1a82f7109 @@ -0,0 +1,191 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + then_block { + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A: This message should not printed" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec b/explorer/fuzzing/fuzzer_corpus/075ffc3e7c80e173985255c88542930d8fed0613 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec rename to explorer/fuzzing/fuzzer_corpus/075ffc3e7c80e173985255c88542930d8fed0613 index 4f25c24a658d..5816ac0a7cde 100644 --- a/explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec +++ b/explorer/fuzzing/fuzzer_corpus/075ffc3e7c80e173985255c88542930d8fed0613 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864 b/explorer/fuzzing/fuzzer_corpus/07fe6d4b29d465ce688b6dd86b0571d1dfea03dd similarity index 83% rename from explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864 rename to explorer/fuzzing/fuzzer_corpus/07fe6d4b29d465ce688b6dd86b0571d1dfea03dd index 7d935ea3584f..d9c2807abdaf 100644 --- a/explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864 +++ b/explorer/fuzzing/fuzzer_corpus/07fe6d4b29d465ce688b6dd86b0571d1dfea03dd @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -81,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -100,20 +106,8 @@ compilation_unit { type { expression_pattern { expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } + identifier { + name: "Point" } } } @@ -144,8 +138,13 @@ compilation_unit { statements { return_expression_statement { expression { - int_literal { - value: 0 + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } } } } diff --git a/explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764 b/explorer/fuzzing/fuzzer_corpus/081adaaf1729926b1089243ca595d1d8d2ab1fd5 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764 rename to explorer/fuzzing/fuzzer_corpus/081adaaf1729926b1089243ca595d1d8d2ab1fd5 index b00ed31189eb..876c0db758ba 100644 --- a/explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764 +++ b/explorer/fuzzing/fuzzer_corpus/081adaaf1729926b1089243ca595d1d8d2ab1fd5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/086eb5f16b73ed72781d5579cdf16dcdc4e94744 b/explorer/fuzzing/fuzzer_corpus/086eb5f16b73ed72781d5579cdf16dcdc4e94744 new file mode 100644 index 000000000000..58cbe4fbd383 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/086eb5f16b73ed72781d5579cdf16dcdc4e94744 @@ -0,0 +1,148 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "TypeLike" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0931a1fe829e600d14421a0fa4084d9c7176d01e b/explorer/fuzzing/fuzzer_corpus/0931a1fe829e600d14421a0fa4084d9c7176d01e new file mode 100644 index 000000000000..7cd9410b5a4d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/0931a1fe829e600d14421a0fa4084d9c7176d01e @@ -0,0 +1,434 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "ident" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + bool_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "ident_i32" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 4 + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + call { + function { + identifier { + name: "ident" + } + } + argument { + tuple_literal { + fields { + bool_literal { + value: true + } + } + } + } + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + bool_literal { + value: true + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "ident_i32" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "ident_i32" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/bfef4e635dfb263c727586a8beb90b3e1e7d45bc b/explorer/fuzzing/fuzzer_corpus/09c98273d182befd2029eeb2d5913445abc23da3 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/bfef4e635dfb263c727586a8beb90b3e1e7d45bc rename to explorer/fuzzing/fuzzer_corpus/09c98273d182befd2029eeb2d5913445abc23da3 index f7eb3d0e23c5..f79177688365 100644 --- a/explorer/fuzzing/fuzzer_corpus/bfef4e635dfb263c727586a8beb90b3e1e7d45bc +++ b/explorer/fuzzing/fuzzer_corpus/09c98273d182befd2029eeb2d5913445abc23da3 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -93,7 +99,9 @@ compilation_unit { } members { function { - name: "GetXY" + name { + name: "GetXY" + } self_pattern { binding_pattern { name: "self" @@ -199,7 +207,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a7d494461ef98c3ec480cfbe332b94c53123a2ca b/explorer/fuzzing/fuzzer_corpus/09ed6f05cf53cd5658b00434fbffeffff056d270 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/a7d494461ef98c3ec480cfbe332b94c53123a2ca rename to explorer/fuzzing/fuzzer_corpus/09ed6f05cf53cd5658b00434fbffeffff056d270 index 5cf298720f5a..f26465564107 100644 --- a/explorer/fuzzing/fuzzer_corpus/a7d494461ef98c3ec480cfbe332b94c53123a2ca +++ b/explorer/fuzzing/fuzzer_corpus/09ed6f05cf53cd5658b00434fbffeffff056d270 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -37,7 +39,7 @@ compilation_unit { call { function { identifier { - name: "SubWith" + name: "AddWith" } } argument { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -115,7 +115,7 @@ compilation_unit { name: "n" expression { operator { - op: Sub + op: Add arguments { simple_member_access { field: "n" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -196,7 +198,7 @@ compilation_unit { } rhs { operator { - op: Sub + op: Add arguments { identifier { name: "a" @@ -209,6 +211,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/697cc661baed8291222e8bba77abec0a4cce7c58 b/explorer/fuzzing/fuzzer_corpus/0a8b7f9961d982a063eb5287fa1fbc7f51e881ff similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/697cc661baed8291222e8bba77abec0a4cce7c58 rename to explorer/fuzzing/fuzzer_corpus/0a8b7f9961d982a063eb5287fa1fbc7f51e881ff index 9bbf94878a7f..ebc85177ad28 100644 --- a/explorer/fuzzing/fuzzer_corpus/697cc661baed8291222e8bba77abec0a4cce7c58 +++ b/explorer/fuzzing/fuzzer_corpus/0a8b7f9961d982a063eb5287fa1fbc7f51e881ff @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -70,6 +72,7 @@ compilation_unit { value: 1 } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/ed25edc40e183f561e6a974ca0872cdda2de08aa b/explorer/fuzzing/fuzzer_corpus/0ad8ac2a88b1144df515cc60cb824fdef6c712ef similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/ed25edc40e183f561e6a974ca0872cdda2de08aa rename to explorer/fuzzing/fuzzer_corpus/0ad8ac2a88b1144df515cc60cb824fdef6c712ef index 3122046de6f6..98eb3f529afc 100644 --- a/explorer/fuzzing/fuzzer_corpus/ed25edc40e183f561e6a974ca0872cdda2de08aa +++ b/explorer/fuzzing/fuzzer_corpus/0ad8ac2a88b1144df515cc60cb824fdef6c712ef @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { } return_term { @@ -58,7 +60,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0b8c017e8d7d8b363cb3d80dbfa45a8f917748e9 b/explorer/fuzzing/fuzzer_corpus/0b8c017e8d7d8b363cb3d80dbfa45a8f917748e9 new file mode 100644 index 000000000000..8bcb961fb77d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/0b8c017e8d7d8b363cb3d80dbfa45a8f917748e9 @@ -0,0 +1,211 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Iface" + } + members { + let { + pattern { + generic_binding { + name: "N" + type { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + fields { + generic_binding { + name: "T" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + equals { + lhs { + designator { + name: "N" + } + } + rhs { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + class_declaration { + name { + name: "Good" + } + } + } + declarations { + class_declaration { + name { + name: "Bad" + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Good" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "N" + replacement { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Bad" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "N" + replacement { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Good" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Bad" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/de581b9f2fa7bb43a1c8a82607954dfe0bc7337b b/explorer/fuzzing/fuzzer_corpus/0c0ca21a65e25a0ed34b97458c4651e3e211fd7d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/de581b9f2fa7bb43a1c8a82607954dfe0bc7337b rename to explorer/fuzzing/fuzzer_corpus/0c0ca21a65e25a0ed34b97458c4651e3e211fd7d index 367e7abc8a3c..761d98af20df 100644 --- a/explorer/fuzzing/fuzzer_corpus/de581b9f2fa7bb43a1c8a82607954dfe0bc7337b +++ b/explorer/fuzzing/fuzzer_corpus/0c0ca21a65e25a0ed34b97458c4651e3e211fd7d @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "ReturnTrue" + name { + name: "ReturnTrue" + } param_pattern { } return_term { @@ -58,6 +60,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -74,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0c1acfbf442273f3d4a3767b76a0ce511fb8e14f b/explorer/fuzzing/fuzzer_corpus/0c1acfbf442273f3d4a3767b76a0ce511fb8e14f new file mode 100644 index 000000000000..356d1ee7976d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/0c1acfbf442273f3d4a3767b76a0ce511fb8e14f @@ -0,0 +1,48 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + qualifiers: "N" + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9ff179586df6d1be54264c78bc0a9017463fb1cc b/explorer/fuzzing/fuzzer_corpus/0c86ef65371750e4a8b9cee11c8e47746abbda44 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/9ff179586df6d1be54264c78bc0a9017463fb1cc rename to explorer/fuzzing/fuzzer_corpus/0c86ef65371750e4a8b9cee11c8e47746abbda44 index 2fa03b423291..86a5fa63723b 100644 --- a/explorer/fuzzing/fuzzer_corpus/9ff179586df6d1be54264c78bc0a9017463fb1cc +++ b/explorer/fuzzing/fuzzer_corpus/0c86ef65371750e4a8b9cee11c8e47746abbda44 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ea8c77a027e0cda36aebfc1a176ae95a1cb00186 b/explorer/fuzzing/fuzzer_corpus/0cb069aeca3e33c5b431baf6a25016982d6f17c9 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ea8c77a027e0cda36aebfc1a176ae95a1cb00186 rename to explorer/fuzzing/fuzzer_corpus/0cb069aeca3e33c5b431baf6a25016982d6f17c9 index 32ac19bb667d..da136166f884 100644 --- a/explorer/fuzzing/fuzzer_corpus/ea8c77a027e0cda36aebfc1a176ae95a1cb00186 +++ b/explorer/fuzzing/fuzzer_corpus/0cb069aeca3e33c5b431baf6a25016982d6f17c9 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Addable" + name { + name: "Addable" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -48,13 +52,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -71,7 +68,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -136,7 +135,9 @@ compilation_unit { } declarations { class_declaration { - name: "Class" + name { + name: "Class" + } members { variable { binding { @@ -156,7 +157,9 @@ compilation_unit { } declarations { class_declaration { - name: "GenericClass" + name { + name: "GenericClass" + } members { variable { binding { @@ -175,7 +178,9 @@ compilation_unit { } members { function { - name: "Get" + name { + name: "Get" + } self_pattern { binding_pattern { name: "self" @@ -265,7 +270,9 @@ compilation_unit { } declarations { alias { - name: "ClassAlias" + name { + name: "ClassAlias" + } target { identifier { name: "Class" @@ -275,7 +282,9 @@ compilation_unit { } declarations { alias { - name: "GenericClassAlias" + name { + name: "GenericClassAlias" + } target { identifier { name: "GenericClass" @@ -285,7 +294,9 @@ compilation_unit { } declarations { alias { - name: "ClassSpecializationAlias" + name { + name: "ClassSpecializationAlias" + } target { call { function { @@ -307,7 +318,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9cba43f25b464b5858b7c390a2579220e467624a b/explorer/fuzzing/fuzzer_corpus/0d35d72cddc3a6d315e59e166bde555410df6c23 similarity index 87% rename from explorer/fuzzing/fuzzer_corpus/9cba43f25b464b5858b7c390a2579220e467624a rename to explorer/fuzzing/fuzzer_corpus/0d35d72cddc3a6d315e59e166bde555410df6c23 index c7d9be597ca6..c2d32b5b4531 100644 --- a/explorer/fuzzing/fuzzer_corpus/9cba43f25b464b5858b7c390a2579220e467624a +++ b/explorer/fuzzing/fuzzer_corpus/0d35d72cddc3a6d315e59e166bde555410df6c23 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "LazyNe" + name { + name: "LazyNe" + } members { variable { binding { @@ -63,7 +65,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -92,28 +96,23 @@ compilation_unit { return_expression_statement { expression { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - simple_member_access { - field: "v1" - object { - identifier { - name: "self" - } - } + simple_member_access { + field: "v1" + object { + identifier { + name: "self" } } - arguments { - simple_member_access { - field: "v2" - object { - identifier { - name: "self" - } - } + } + } + arguments { + simple_member_access { + field: "v2" + object { + identifier { + name: "self" } } } @@ -129,7 +128,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { fields { binding_pattern { @@ -198,7 +199,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -281,6 +284,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/587f9e61674de6917f39a998a4f94e932fa3d028 b/explorer/fuzzing/fuzzer_corpus/0e6b20961131825faf926e7c56b0a285dc200c45 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/587f9e61674de6917f39a998a4f94e932fa3d028 rename to explorer/fuzzing/fuzzer_corpus/0e6b20961131825faf926e7c56b0a285dc200c45 index d50c7e30345b..7d0b045c6621 100644 --- a/explorer/fuzzing/fuzzer_corpus/587f9e61674de6917f39a998a4f94e932fa3d028 +++ b/explorer/fuzzing/fuzzer_corpus/0e6b20961131825faf926e7c56b0a285dc200c45 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,18 +70,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -136,7 +137,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -161,7 +164,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -250,7 +255,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -330,7 +337,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -496,7 +505,9 @@ compilation_unit { } declarations { function { - name: "Sum" + name { + name: "Sum" + } deduced_parameters { name: "E" type { @@ -611,6 +622,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -643,6 +655,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -659,7 +672,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/91e9c32f3c3bc1ea0693f919f098828ad7860e28 b/explorer/fuzzing/fuzzer_corpus/0e92e106654000c9dc5d0887df617586bbdf681f similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/91e9c32f3c3bc1ea0693f919f098828ad7860e28 rename to explorer/fuzzing/fuzzer_corpus/0e92e106654000c9dc5d0887df617586bbdf681f index fa1beb051876..a01678a3a0ba 100644 --- a/explorer/fuzzing/fuzzer_corpus/91e9c32f3c3bc1ea0693f919f098828ad7860e28 +++ b/explorer/fuzzing/fuzzer_corpus/0e92e106654000c9dc5d0887df617586bbdf681f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Frob" + name { + name: "Frob" + } members { let { pattern { @@ -21,7 +23,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -48,18 +52,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Use" + name { + name: "Use" + } deduced_parameters { name: "T" type { @@ -167,13 +166,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { int_type_literal { } } @@ -183,7 +178,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -224,7 +221,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9a788bace10906aa7b48858da3e4da9a0f25e82a b/explorer/fuzzing/fuzzer_corpus/0ec693754f4cad2f847af64da34d95de62086651 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/9a788bace10906aa7b48858da3e4da9a0f25e82a rename to explorer/fuzzing/fuzzer_corpus/0ec693754f4cad2f847af64da34d95de62086651 index 3aa2b2e3dcca..d8940e71f270 100644 --- a/explorer/fuzzing/fuzzer_corpus/9a788bace10906aa7b48858da3e4da9a0f25e82a +++ b/explorer/fuzzing/fuzzer_corpus/0ec693754f4cad2f847af64da34d95de62086651 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -209,6 +211,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/0f4a5a4583189e307590798fd6a8535df7b43481 b/explorer/fuzzing/fuzzer_corpus/0f4a5a4583189e307590798fd6a8535df7b43481 new file mode 100644 index 000000000000..5c624daad8cd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/0f4a5a4583189e307590798fd6a8535df7b43481 @@ -0,0 +1,142 @@ +compilation_unit { + package_statement { + package_name: "EmptyIdentifier" + } + is_api: false + declarations { + function { + name { + name: "apply" + } + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + deduced_parameters { + name: "U" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "f" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "EmptyIdentifier" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + match { + expression { + index { + object { + bool_literal { + value: true + } + } + offset { + bool_literal { + value: true + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "EmptyIdentifier" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "apply" + } + } + argument { + tuple_literal { + fields { + bool_literal { + value: true + } + } + fields { + bool_literal { + value: true + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9a4ba2e3d195dc6c6227fe1601d3e060a6e7f6aa b/explorer/fuzzing/fuzzer_corpus/0f51fb075d9a0ec04bf29588ae89cbead328d51b similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/9a4ba2e3d195dc6c6227fe1601d3e060a6e7f6aa rename to explorer/fuzzing/fuzzer_corpus/0f51fb075d9a0ec04bf29588ae89cbead328d51b index 2a75e3609185..0b894343d559 100644 --- a/explorer/fuzzing/fuzzer_corpus/9a4ba2e3d195dc6c6227fe1601d3e060a6e7f6aa +++ b/explorer/fuzzing/fuzzer_corpus/0f51fb075d9a0ec04bf29588ae89cbead328d51b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -50,7 +52,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -96,7 +100,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6516cff3041ce9f5f0ae1ec62ab391c1eb83dec6 b/explorer/fuzzing/fuzzer_corpus/0fa5dbb1cf634ded61edd83ac9aa1fb5435f2afb similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/6516cff3041ce9f5f0ae1ec62ab391c1eb83dec6 rename to explorer/fuzzing/fuzzer_corpus/0fa5dbb1cf634ded61edd83ac9aa1fb5435f2afb index 0c45ff95c006..0677feb27b9c 100644 --- a/explorer/fuzzing/fuzzer_corpus/6516cff3041ce9f5f0ae1ec62ab391c1eb83dec6 +++ b/explorer/fuzzing/fuzzer_corpus/0fa5dbb1cf634ded61edd83ac9aa1fb5435f2afb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -39,13 +41,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -56,7 +54,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -115,7 +115,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -174,6 +176,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/6dbbed5f5a6d500b2982d7b03805df6a3e64cc17 b/explorer/fuzzing/fuzzer_corpus/0ff1237b5ca488e8bcf62b899c96f2279dd8618a similarity index 82% rename from explorer/fuzzing/fuzzer_corpus/6dbbed5f5a6d500b2982d7b03805df6a3e64cc17 rename to explorer/fuzzing/fuzzer_corpus/0ff1237b5ca488e8bcf62b899c96f2279dd8618a index 5b46315e4594..8b46487b6c01 100644 --- a/explorer/fuzzing/fuzzer_corpus/6dbbed5f5a6d500b2982d7b03805df6a3e64cc17 +++ b/explorer/fuzzing/fuzzer_corpus/0ff1237b5ca488e8bcf62b899c96f2279dd8618a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "identFn" + name { + name: "identFn" + } param_pattern { fields { binding_pattern { @@ -43,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -91,20 +95,15 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 1 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 1 } } } @@ -154,26 +153,22 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 0 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 0 } } } @@ -253,26 +248,22 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 1 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 1 } } } @@ -335,26 +326,22 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 0 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 0 } } } @@ -399,29 +386,25 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq + arguments { + identifier { + name: "x" + } + } arguments { operator { - op: Eq + op: Neg arguments { - identifier { - name: "x" - } - } - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 1 } } } @@ -468,26 +451,22 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 1 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 1 } } } @@ -550,29 +529,25 @@ compilation_unit { } } } + op: Plain } } statements { if_statement { condition { operator { - op: Not + op: NotEq + arguments { + identifier { + name: "x" + } + } arguments { operator { - op: Eq + op: Neg arguments { - identifier { - name: "x" - } - } - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 1 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/4ab6821561a2f7b3d83236dc0248730b875b8f47 b/explorer/fuzzing/fuzzer_corpus/10b3ac55167965078be7c7e32a3b9ac35742ebab similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/4ab6821561a2f7b3d83236dc0248730b875b8f47 rename to explorer/fuzzing/fuzzer_corpus/10b3ac55167965078be7c7e32a3b9ac35742ebab index 32658f1aa677..40692106516a 100644 --- a/explorer/fuzzing/fuzzer_corpus/4ab6821561a2f7b3d83236dc0248730b875b8f47 +++ b/explorer/fuzzing/fuzzer_corpus/10b3ac55167965078be7c7e32a3b9ac35742ebab @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -89,6 +91,7 @@ compilation_unit { value: 3 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/f2b68d3ca95d9c203ee36b980ea1572ae843f68a b/explorer/fuzzing/fuzzer_corpus/10bc53bafd07b8ea7cd8e5321d4720b0c46db012 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/f2b68d3ca95d9c203ee36b980ea1572ae843f68a rename to explorer/fuzzing/fuzzer_corpus/10bc53bafd07b8ea7cd8e5321d4720b0c46db012 index dc9e7ea278ca..e82bc15c0a3e 100644 --- a/explorer/fuzzing/fuzzer_corpus/f2b68d3ca95d9c203ee36b980ea1572ae843f68a +++ b/explorer/fuzzing/fuzzer_corpus/10bc53bafd07b8ea7cd8e5321d4720b0c46db012 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { alias { - name: "TypeAlias" + name { + name: "TypeAlias" + } target { int_type_literal { } @@ -14,7 +16,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/36a2d32d4f486e410ce1d93b17556a459902a8db b/explorer/fuzzing/fuzzer_corpus/10bf4210ca99eb159f3e5e11b69ce67e4ec2e410 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/36a2d32d4f486e410ce1d93b17556a459902a8db rename to explorer/fuzzing/fuzzer_corpus/10bf4210ca99eb159f3e5e11b69ce67e4ec2e410 index 4eb4f28e44f5..d8cf43795b94 100644 --- a/explorer/fuzzing/fuzzer_corpus/36a2d32d4f486e410ce1d93b17556a459902a8db +++ b/explorer/fuzzing/fuzzer_corpus/10bf4210ca99eb159f3e5e11b69ce67e4ec2e410 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -150,7 +151,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -259,7 +262,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -508,7 +515,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1111b8be1131541ec8c3a7b9c8a2e5e2cc634ab0 b/explorer/fuzzing/fuzzer_corpus/1111b8be1131541ec8c3a7b9c8a2e5e2cc634ab0 new file mode 100644 index 000000000000..2468410cb5f5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1111b8be1131541ec8c3a7b9c8a2e5e2cc634ab0 @@ -0,0 +1,127 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Create" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "C" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332 b/explorer/fuzzing/fuzzer_corpus/11129722dc448b2011c92f79dc750129eff3858b similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332 rename to explorer/fuzzing/fuzzer_corpus/11129722dc448b2011c92f79dc750129eff3858b index 10e599c41b97..09933500cde4 100644 --- a/explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332 +++ b/explorer/fuzzing/fuzzer_corpus/11129722dc448b2011c92f79dc750129eff3858b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/117ed6ced083ede3e318697fc56548fabe03039e b/explorer/fuzzing/fuzzer_corpus/117ed6ced083ede3e318697fc56548fabe03039e new file mode 100644 index 000000000000..cc94271f33df --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/117ed6ced083ede3e318697fc56548fabe03039e @@ -0,0 +1,512 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "ManyTypes" + } + members { + let { + pattern { + generic_binding { + name: "T0" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T1" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T2" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T3" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T4" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T5" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T6" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T7" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T8" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T9" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "M" + type { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + designator { + name: "T1" + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + designator { + name: "T2" + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + designator { + name: "T3" + } + } + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + designator { + name: "T4" + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + designator { + name: "T5" + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + designator { + name: "T6" + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + designator { + name: "T7" + } + } + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + designator { + name: "T8" + } + } + } + } + clauses { + rewrite { + member_name: "T8" + replacement { + designator { + name: "T9" + } + } + } + } + clauses { + rewrite { + member_name: "T9" + replacement { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "m" + type { + expression_pattern { + expression { + identifier { + name: "M" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + simple_member_access { + field: "T0" + object { + identifier { + name: "M" + } + } + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "v" + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + designator { + name: "T0" + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + designator { + name: "T1" + } + } + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + designator { + name: "T2" + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + designator { + name: "T3" + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + designator { + name: "T4" + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + designator { + name: "T5" + } + } + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + designator { + name: "T6" + } + } + } + } + clauses { + rewrite { + member_name: "T8" + replacement { + designator { + name: "T7" + } + } + } + } + clauses { + rewrite { + member_name: "T9" + replacement { + designator { + name: "T8" + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1191f8daa134f3932d68bd24f270b2286a87560b b/explorer/fuzzing/fuzzer_corpus/1191f8daa134f3932d68bd24f270b2286a87560b new file mode 100644 index 000000000000..288304c41b2a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1191f8daa134f3932d68bd24f270b2286a87560b @@ -0,0 +1,76 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/8da277bd9d7da4ecca178ce131aa574384ca9dfa b/explorer/fuzzing/fuzzer_corpus/119a0b3341f7032a48ccdded931a1c2fccdd6f52 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/8da277bd9d7da4ecca178ce131aa574384ca9dfa rename to explorer/fuzzing/fuzzer_corpus/119a0b3341f7032a48ccdded931a1c2fccdd6f52 index a4bc3c860453..6f7e0502b41e 100644 --- a/explorer/fuzzing/fuzzer_corpus/8da277bd9d7da4ecca178ce131aa574384ca9dfa +++ b/explorer/fuzzing/fuzzer_corpus/119a0b3341f7032a48ccdded931a1c2fccdd6f52 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/70e3703c8486a55f2383b53c6f95a18de68228a2 b/explorer/fuzzing/fuzzer_corpus/11e091578ab1fee7bb92cf00355ff51be89cf801 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/70e3703c8486a55f2383b53c6f95a18de68228a2 rename to explorer/fuzzing/fuzzer_corpus/11e091578ab1fee7bb92cf00355ff51be89cf801 index 5a2955a12fc1..ddb06055eedd 100644 --- a/explorer/fuzzing/fuzzer_corpus/70e3703c8486a55f2383b53c6f95a18de68228a2 +++ b/explorer/fuzzing/fuzzer_corpus/11e091578ab1fee7bb92cf00355ff51be89cf801 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -138,7 +140,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53 b/explorer/fuzzing/fuzzer_corpus/123fb6fa380b035e905b35aab5af9e28b936470f similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53 rename to explorer/fuzzing/fuzzer_corpus/123fb6fa380b035e905b35aab5af9e28b936470f index d9165edc1b43..dbdf14248ded 100644 --- a/explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53 +++ b/explorer/fuzzing/fuzzer_corpus/123fb6fa380b035e905b35aab5af9e28b936470f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "id" + name { + name: "id" + } deduced_parameters { name: "T" type { @@ -62,7 +64,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5e059c72b3fbba74b9c3cb7a21be19d36467f6f9 b/explorer/fuzzing/fuzzer_corpus/13165465925de647ee3bd1d663a7e406b084a182 similarity index 58% rename from explorer/fuzzing/fuzzer_corpus/5e059c72b3fbba74b9c3cb7a21be19d36467f6f9 rename to explorer/fuzzing/fuzzer_corpus/13165465925de647ee3bd1d663a7e406b084a182 index 80b18744c47b..910b10448274 100644 --- a/explorer/fuzzing/fuzzer_corpus/5e059c72b3fbba74b9c3cb7a21be19d36467f6f9 +++ b/explorer/fuzzing/fuzzer_corpus/13165465925de647ee3bd1d663a7e406b084a182 @@ -5,70 +5,35 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "C" + } members { function { - name: "Origin" + name { + name: "Method1" + } param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } } return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "T" - } - } - } - } - } - } + kind: Omitted } body { statements { - return_expression_statement { + expression_statement { expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } + call { + function { + identifier { + name: "Print" } } - fields { - name: "y" - expression { - identifier { - name: "zero" + argument { + tuple_literal { + fields { + string_literal { + value: "Class C" + } } } } @@ -81,33 +46,17 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetValue" + } self_pattern { binding_pattern { name: "self" type { expression_pattern { expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "T" - } - } - } - } + identifier { + name: "Self" } } } @@ -119,8 +68,7 @@ compilation_unit { return_term { kind: Expression type { - identifier { - name: "T" + int_type_literal { } } } @@ -129,7 +77,7 @@ compilation_unit { return_expression_statement { expression { simple_member_access { - field: "x" + field: "value" object { identifier { name: "self" @@ -145,12 +93,54 @@ compilation_unit { members { variable { binding { - name: "x" + name: "value" type { expression_pattern { expression { - identifier { - name: "T" + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "Method1" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Class D" + } + } + } + } } } } @@ -161,12 +151,11 @@ compilation_unit { members { variable { binding { - name: "y" + name: "value" type { expression_pattern { expression { - identifier { - name: "T" + int_type_literal { } } } @@ -174,22 +163,13 @@ compilation_unit { } } } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -204,24 +184,12 @@ compilation_unit { variable_definition { pattern { binding_pattern { - name: "p" + name: "d" type { expression_pattern { expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } + identifier { + name: "D" } } } @@ -229,34 +197,26 @@ compilation_unit { } } init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } + struct_literal { + fields { + name: "value" + expression { + int_literal { + value: 2 } } } - argument { - tuple_literal { - fields { - int_literal { - value: 0 + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value" + expression { + int_literal { + value: 1 + } + } } } } @@ -267,15 +227,15 @@ compilation_unit { } } statements { - return_expression_statement { + expression_statement { expression { call { function { simple_member_access { - field: "GetX" + field: "Method1" object { identifier { - name: "p" + name: "d" } } } @@ -288,6 +248,87 @@ compilation_unit { } } } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.value = {0}" + } + } + fields { + simple_member_access { + field: "value" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.GetValue() = {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "GetValue" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } } } } diff --git a/explorer/fuzzing/fuzzer_corpus/ab0baca8dd917922d8731f935516469d456b25fc b/explorer/fuzzing/fuzzer_corpus/13699d187869d480a856deeb58a9b72a42414510 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ab0baca8dd917922d8731f935516469d456b25fc rename to explorer/fuzzing/fuzzer_corpus/13699d187869d480a856deeb58a9b72a42414510 index 4868d796b2df..68a0dd9e6999 100644 --- a/explorer/fuzzing/fuzzer_corpus/ab0baca8dd917922d8731f935516469d456b25fc +++ b/explorer/fuzzing/fuzzer_corpus/13699d187869d480a856deeb58a9b72a42414510 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Foo" + name { + name: "Foo" + } param_pattern { fields { binding_pattern { @@ -111,6 +113,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -142,6 +145,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -153,7 +157,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/137763417c6bb89b2f19ce90364ed912e997a51e b/explorer/fuzzing/fuzzer_corpus/137763417c6bb89b2f19ce90364ed912e997a51e new file mode 100644 index 000000000000..0ad112c00468 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/137763417c6bb89b2f19ce90364ed912e997a51e @@ -0,0 +1,92 @@ +compilation_unit { + package_statement { + package_name: "EmptyIdentifier" + } + is_api: false + declarations { + function { + name { + name: "test" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "test" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ee4e747627dba6ffbd9fcb1a18a940fe04a784fb b/explorer/fuzzing/fuzzer_corpus/138b2d121b29802db4a2e37a2d563bc6ab8c5aef similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/ee4e747627dba6ffbd9fcb1a18a940fe04a784fb rename to explorer/fuzzing/fuzzer_corpus/138b2d121b29802db4a2e37a2d563bc6ab8c5aef index a1f98330696b..4acfa4ea6172 100644 --- a/explorer/fuzzing/fuzzer_corpus/ee4e747627dba6ffbd9fcb1a18a940fe04a784fb +++ b/explorer/fuzzing/fuzzer_corpus/138b2d121b29802db4a2e37a2d563bc6ab8c5aef @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "MyAddWith" + name { + name: "MyAddWith" + } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -49,18 +53,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -121,7 +120,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -232,7 +233,9 @@ compilation_unit { } declarations { function { - name: "DoAddGeneric" + name { + name: "DoAddGeneric" + } deduced_parameters { name: "T" type { @@ -332,7 +335,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/65738fb410d8b27350b8ca930e01f41dad598b13 b/explorer/fuzzing/fuzzer_corpus/1390a7598274c8a07a7db037d164e7ba04fa084e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/65738fb410d8b27350b8ca930e01f41dad598b13 rename to explorer/fuzzing/fuzzer_corpus/1390a7598274c8a07a7db037d164e7ba04fa084e index 1959bcd2d5c5..7f37b27d3a7b 100644 --- a/explorer/fuzzing/fuzzer_corpus/65738fb410d8b27350b8ca930e01f41dad598b13 +++ b/explorer/fuzzing/fuzzer_corpus/1390a7598274c8a07a7db037d164e7ba04fa084e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Bad" + name { + name: "Bad" + } deduced_parameters { name: "T" type { @@ -52,7 +54,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/13dcb5a00f09e0ec0a7fd03fb720bdad03c495f1 b/explorer/fuzzing/fuzzer_corpus/13dcb5a00f09e0ec0a7fd03fb720bdad03c495f1 new file mode 100644 index 000000000000..ea16560c3e43 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/13dcb5a00f09e0ec0a7fd03fb720bdad03c495f1 @@ -0,0 +1,128 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + body { + statements { + assign { + lhs { + identifier { + name: "y" + } + } + rhs { + identifier { + name: "x" + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/15005ba56570844e2a9ab20299631f8ffedc38c6 b/explorer/fuzzing/fuzzer_corpus/15005ba56570844e2a9ab20299631f8ffedc38c6 new file mode 100644 index 000000000000..b7aa03346dc3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/15005ba56570844e2a9ab20299631f8ffedc38c6 @@ -0,0 +1,69 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + operator { + op: BitwiseAnd + arguments { + type_type_literal { + } + } + arguments { + identifier { + name: "C" + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/151b851709a6cb57bbee182c3220b59c87027ec4 b/explorer/fuzzing/fuzzer_corpus/151b851709a6cb57bbee182c3220b59c87027ec4 new file mode 100644 index 000000000000..cf1d80bb3984 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/151b851709a6cb57bbee182c3220b59c87027ec4 @@ -0,0 +1,151 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "t1" + type { + expression_pattern { + expression { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 5 + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "t2" + type { + expression_pattern { + expression { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + fields { + int_literal { + value: 3 + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + index { + object { + identifier { + name: "t1" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + arguments { + index { + object { + identifier { + name: "t2" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + arguments { + index { + object { + identifier { + name: "t2" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0e4dd54cbc641eb28c41d49f2e94d185a83bb36f b/explorer/fuzzing/fuzzer_corpus/15bd86b0412443771aa00da617795aa0e5c64185 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/0e4dd54cbc641eb28c41d49f2e94d185a83bb36f rename to explorer/fuzzing/fuzzer_corpus/15bd86b0412443771aa00da617795aa0e5c64185 index eed061e03b08..714bb3cab14a 100644 --- a/explorer/fuzzing/fuzzer_corpus/0e4dd54cbc641eb28c41d49f2e94d185a83bb36f +++ b/explorer/fuzzing/fuzzer_corpus/15bd86b0412443771aa00da617795aa0e5c64185 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "One" + name { + name: "One" + } members { impl { kind: InternalImpl @@ -33,7 +35,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -76,7 +80,9 @@ compilation_unit { } declarations { class_declaration { - name: "Two" + name { + name: "Two" + } members { impl { kind: InternalImpl @@ -104,7 +110,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -147,7 +155,9 @@ compilation_unit { } declarations { class_declaration { - name: "N" + name { + name: "N" + } members { impl { kind: InternalImpl @@ -175,7 +185,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -238,7 +250,9 @@ compilation_unit { } declarations { function { - name: "Get" + name { + name: "Get" + } param_pattern { fields { binding_pattern { @@ -342,7 +356,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -370,7 +386,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false @@ -393,7 +409,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/a3f77e6a8191077674a9544388f531cacefa13c2 b/explorer/fuzzing/fuzzer_corpus/15ce7e6d7d3131c20c8e85783a76e9405dc43ac5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a3f77e6a8191077674a9544388f531cacefa13c2 rename to explorer/fuzzing/fuzzer_corpus/15ce7e6d7d3131c20c8e85783a76e9405dc43ac5 index 5a2003dfda5b..098d45cd0bd5 100644 --- a/explorer/fuzzing/fuzzer_corpus/a3f77e6a8191077674a9544388f531cacefa13c2 +++ b/explorer/fuzzing/fuzzer_corpus/15ce7e6d7d3131c20c8e85783a76e9405dc43ac5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/87cbb8f281ba103d85429b87dc7cfa4c131222a6 b/explorer/fuzzing/fuzzer_corpus/169f839edd28aed284d4b38125e1833f73edac02 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/87cbb8f281ba103d85429b87dc7cfa4c131222a6 rename to explorer/fuzzing/fuzzer_corpus/169f839edd28aed284d4b38125e1833f73edac02 index dba631866276..994c274d3ebe 100644 --- a/explorer/fuzzing/fuzzer_corpus/87cbb8f281ba103d85429b87dc7cfa4c131222a6 +++ b/explorer/fuzzing/fuzzer_corpus/169f839edd28aed284d4b38125e1833f73edac02 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,21 +24,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -46,13 +47,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -69,7 +63,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -108,7 +104,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -135,7 +133,9 @@ compilation_unit { } declarations { function { - name: "GetA" + name { + name: "GetA" + } deduced_parameters { name: "T" type { @@ -195,7 +195,9 @@ compilation_unit { } declarations { function { - name: "GetAB" + name { + name: "GetAB" + } deduced_parameters { name: "T" type { @@ -306,7 +308,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/17310ae919b40b6ca070de923c138a8d75df0204 b/explorer/fuzzing/fuzzer_corpus/17310ae919b40b6ca070de923c138a8d75df0204 new file mode 100644 index 000000000000..c8dbb130edb8 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/17310ae919b40b6ca070de923c138a8d75df0204 @@ -0,0 +1,414 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + function { + name { + name: "FunctionA" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "aa" + type { + expression_pattern { + expression { + string_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + function { + name { + name: "FunctionB" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "FunctionC" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + variable { + binding { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "aa" + expression { + string_literal { + value: "A" + } + } + } + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + name: "c" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionA" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionB" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionC" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "aa" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.a: {0}" + } + } + fields { + simple_member_access { + field: "a" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.b: {0}" + } + } + fields { + simple_member_access { + field: "b" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.c: {0}" + } + } + fields { + simple_member_access { + field: "c" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7 b/explorer/fuzzing/fuzzer_corpus/17a00f823161d813cdcaa73fe8a860bfbfa1266c similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7 rename to explorer/fuzzing/fuzzer_corpus/17a00f823161d813cdcaa73fe8a860bfbfa1266c index b647d9979b28..8cb5753cf608 100644 --- a/explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7 +++ b/explorer/fuzzing/fuzzer_corpus/17a00f823161d813cdcaa73fe8a860bfbfa1266c @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "IntDiff" + name { + name: "IntDiff" + } param_pattern { fields { binding_pattern { @@ -144,7 +146,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/181b96bd90fda933ccc0f44032fc3e7ac753c091 b/explorer/fuzzing/fuzzer_corpus/181b96bd90fda933ccc0f44032fc3e7ac753c091 new file mode 100644 index 000000000000..4ef750e24b23 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/181b96bd90fda933ccc0f44032fc3e7ac753c091 @@ -0,0 +1,265 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasAssoc" + } + members { + let { + pattern { + generic_binding { + name: "Assoc" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "X" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithoutRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + equals { + lhs { + designator { + name: "Assoc" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "WithRewrite" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + compound_member_access { + object { + identifier { + name: "T" + } + } + path { + simple_member_access { + field: "Assoc" + object { + identifier { + name: "WithoutRewrite" + } + } + } + } + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1820cf28f49d1ee771fc53c74743e545529b509c b/explorer/fuzzing/fuzzer_corpus/1820cf28f49d1ee771fc53c74743e545529b509c new file mode 100644 index 000000000000..1abe2126a052 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1820cf28f49d1ee771fc53c74743e545529b509c @@ -0,0 +1,184 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + class_declaration { + name { + name: "X" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + compound_member_access { + object { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "X" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/aaa6ab93c6b3c8e212cd59f1d9fea90258723519 b/explorer/fuzzing/fuzzer_corpus/189f5602a95e12265aaf65183c1d552f0663b36c similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/aaa6ab93c6b3c8e212cd59f1d9fea90258723519 rename to explorer/fuzzing/fuzzer_corpus/189f5602a95e12265aaf65183c1d552f0663b36c index 8153cd25f972..a409d885e1e4 100644 --- a/explorer/fuzzing/fuzzer_corpus/aaa6ab93c6b3c8e212cd59f1d9fea90258723519 +++ b/explorer/fuzzing/fuzzer_corpus/189f5602a95e12265aaf65183c1d552f0663b36c @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { fields { binding_pattern { @@ -63,7 +67,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -153,7 +159,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9972e604e5e46a6ac6a5efee2be4b150116cc29c b/explorer/fuzzing/fuzzer_corpus/18e4b0c01d7c2527f3a3d682b114ec5afe7d539b similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/9972e604e5e46a6ac6a5efee2be4b150116cc29c rename to explorer/fuzzing/fuzzer_corpus/18e4b0c01d7c2527f3a3d682b114ec5afe7d539b index 7d7737250ce7..4ee4a09a502d 100644 --- a/explorer/fuzzing/fuzzer_corpus/9972e604e5e46a6ac6a5efee2be4b150116cc29c +++ b/explorer/fuzzing/fuzzer_corpus/18e4b0c01d7c2527f3a3d682b114ec5afe7d539b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "FirstOfTwoPoints" + name { + name: "FirstOfTwoPoints" + } deduced_parameters { name: "T" type { @@ -153,7 +157,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1983eb50faba24986c9fefe94e372fb2eaa35445 b/explorer/fuzzing/fuzzer_corpus/1983eb50faba24986c9fefe94e372fb2eaa35445 new file mode 100644 index 000000000000..9b79155e429b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1983eb50faba24986c9fefe94e372fb2eaa35445 @@ -0,0 +1,172 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + string_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + string_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Hallo Welt" + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + then_block { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/199d526c94d7b59769c7bea1306f67bdd4767fac b/explorer/fuzzing/fuzzer_corpus/199d526c94d7b59769c7bea1306f67bdd4767fac new file mode 100644 index 000000000000..d35ed12ee06e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/199d526c94d7b59769c7bea1306f67bdd4767fac @@ -0,0 +1,361 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + class_declaration { + name { + name: "B" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR B {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "B" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "x" + } + } + } + fields { + name: "b" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "B" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1aa8b45819d453372d67a450012c501fd74893ec b/explorer/fuzzing/fuzzer_corpus/1aa8b45819d453372d67a450012c501fd74893ec new file mode 100644 index 000000000000..8d9e5591691b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1aa8b45819d453372d67a450012c501fd74893ec @@ -0,0 +1,3955 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Node" + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "value" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + fields { + name: "next" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "prev" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "set_next" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + identifier { + name: "n" + } + } + op: Plain + } + } + } + } + } + members { + function { + name { + name: "set_prev" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "prev" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + identifier { + name: "n" + } + } + op: Plain + } + } + } + } + } + members { + variable { + binding { + name: "value" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "next" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "prev" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "LinkedList" + } + members { + function { + name { + name: "Create" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "LinkedList" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "head" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "tail" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "len" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "PushBack" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Add + arguments { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + call { + function { + simple_member_access { + field: "HasValue" + object { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + then_block { + statements { + assign { + lhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + op: Plain + } + } + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "last" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "last_value" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "last" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "v_wrapped" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "set_next" + object { + operator { + op: Deref + arguments { + identifier { + name: "last_value" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "v_wrapped" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "set_prev" + object { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "v_wrapped" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "last" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + identifier { + name: "v_wrapped" + } + } + op: Plain + } + } + } + } + } + members { + function { + name { + name: "PushFront" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Add + arguments { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + call { + function { + simple_member_access { + field: "HasValue" + object { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + then_block { + statements { + assign { + lhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + op: Plain + } + } + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "v_wrapped" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "current_head" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "current_head_value" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "current_head" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "set_next" + object { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "v_wrapped" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "current_head" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "set_prev" + object { + operator { + op: Deref + arguments { + identifier { + name: "current_head_value" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "v_wrapped" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + identifier { + name: "v_wrapped" + } + } + op: Plain + } + } + } + } + } + members { + function { + name { + name: "Clear" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "iter" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "current" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "iter" + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "iter" + } + } + rhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Delete" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "current" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "len" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + members { + function { + name { + name: "Length" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "len" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "head" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "tail" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "len" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "GetListEntryByIndex" + } + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "list" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "LinkedList" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "target_index" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "list_length" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Length" + object { + operator { + op: Deref + arguments { + identifier { + name: "list" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Or + arguments { + operator { + op: Greater + arguments { + identifier { + name: "target_index" + } + } + arguments { + operator { + op: Sub + arguments { + identifier { + name: "list_length" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + arguments { + operator { + op: Less + arguments { + identifier { + name: "target_index" + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + } + } + then_block { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "search_backwards" + type { + expression_pattern { + expression { + bool_type_literal { + } + } + } + } + } + } + init { + operator { + op: Greater + arguments { + identifier { + name: "target_index" + } + } + arguments { + operator { + op: Div + arguments { + identifier { + name: "list_length" + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "iter" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + if_expression { + condition { + identifier { + name: "search_backwards" + } + } + then_expression { + simple_member_access { + field: "tail" + object { + operator { + op: Deref + arguments { + identifier { + name: "list" + } + } + } + } + } + } + else_expression { + simple_member_access { + field: "head" + object { + operator { + op: Deref + arguments { + identifier { + name: "list" + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + if_expression { + condition { + identifier { + name: "search_backwards" + } + } + then_expression { + operator { + op: Sub + arguments { + identifier { + name: "list_length" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + operator { + op: NotEq + arguments { + identifier { + name: "c" + } + } + arguments { + identifier { + name: "target_index" + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "node" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Node" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + init { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + identifier { + name: "search_backwards" + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "c" + } + } + rhs { + operator { + op: Sub + arguments { + identifier { + name: "c" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + identifier { + name: "iter" + } + } + rhs { + simple_member_access { + field: "prev" + object { + identifier { + name: "node" + } + } + } + } + op: Plain + } + } + } + else_block { + statements { + assign { + lhs { + identifier { + name: "iter" + } + } + rhs { + simple_member_access { + field: "next" + object { + identifier { + name: "node" + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + identifier { + name: "c" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "c" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value" + object { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "test_list" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "LinkedList" + } + } + argument { + tuple_literal { + fields { + string_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 0" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 1" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 2" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 3" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 4" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a String Entry 5" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushFront" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "This is a prepended String -1" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "String list length is: {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Length" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "search_index" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 5 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "retrieved_entry" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + identifier { + name: "GetListEntryByIndex" + } + } + argument { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "test_list" + } + } + } + } + fields { + identifier { + name: "search_index" + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "retrieved_entry" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "retrieved_value" + type { + expression_pattern { + expression { + string_type_literal { + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "retrieved_entry" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "retrieved_value" + } + } + } + } + } + } + } + } + } + else_block { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "No entry found in String list for index {0}!" + } + } + fields { + identifier { + name: "search_index" + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Clear" + object { + identifier { + name: "test_list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "second_list" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "LinkedList" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "number" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1337 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "number_ptr" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "number" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "PushBack" + object { + identifier { + name: "second_list" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "number_ptr" + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "retrieved_ptr" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + call { + function { + identifier { + name: "GetListEntryByIndex" + } + } + argument { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "second_list" + } + } + } + } + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + operator { + op: Deref + arguments { + identifier { + name: "retrieved_ptr" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Value {0}" + } + } + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1ac93b3166a73257d35daabe1224a4fa02b91438 b/explorer/fuzzing/fuzzer_corpus/1ac93b3166a73257d35daabe1224a4fa02b91438 new file mode 100644 index 000000000000..eb1e4453d6f5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1ac93b3166a73257d35daabe1224a4fa02b91438 @@ -0,0 +1,323 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Runnable" + } + members { + function { + name { + name: "Run" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Walkable" + } + members { + function { + name { + name: "Walk" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + constraint { + name { + name: "Traversible" + } + members { + interface_extends { + base { + identifier { + name: "Runnable" + } + } + } + } + members { + interface_extends { + base { + identifier { + name: "Walkable" + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Traversible" + } + } + members { + function { + name { + name: "Run" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + int_literal { + value: 10 + } + } + arguments { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Walk" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "self" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "n" + } + } + path { + simple_member_access { + field: "Run" + object { + identifier { + name: "Runnable" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "n" + } + } + path { + simple_member_access { + field: "Walk" + object { + identifier { + name: "Walkable" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/54f528637c5e83cd7af7cf4158eed6866dabcd8f b/explorer/fuzzing/fuzzer_corpus/1bb31799f794a026275be18fd889f8917257b7a6 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/54f528637c5e83cd7af7cf4158eed6866dabcd8f rename to explorer/fuzzing/fuzzer_corpus/1bb31799f794a026275be18fd889f8917257b7a6 index 1700708b7ede..555827bb6c42 100644 --- a/explorer/fuzzing/fuzzer_corpus/54f528637c5e83cd7af7cf4158eed6866dabcd8f +++ b/explorer/fuzzing/fuzzer_corpus/1bb31799f794a026275be18fd889f8917257b7a6 @@ -45,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1c15b9ff3704bb9603866c7a06a3070eb8aacc69 b/explorer/fuzzing/fuzzer_corpus/1c15b9ff3704bb9603866c7a06a3070eb8aacc69 new file mode 100644 index 000000000000..69f712dfd31c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1c15b9ff3704bb9603866c7a06a3070eb8aacc69 @@ -0,0 +1,89 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + match { + expression { + identifier { + name: "n" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1c2582d7495e080fa022962c6ed26fd62760e88e b/explorer/fuzzing/fuzzer_corpus/1c2582d7495e080fa022962c6ed26fd62760e88e new file mode 100644 index 000000000000..5d07ff0a675d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1c2582d7495e080fa022962c6ed26fd62760e88e @@ -0,0 +1,404 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "MyHashable" + } + members { + let { + pattern { + generic_binding { + name: "Result" + type { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Result" + } + } + } + } + } + } + } + declarations { + constraint { + name { + name: "HashToIntConvertible" + } + members { + interface_impl { + impl_type { + identifier { + name: "Self" + } + } + constraint { + identifier { + name: "MyHashable" + } + } + } + } + members { + interface_impl { + impl_type { + compound_member_access { + object { + identifier { + name: "Self" + } + } + path { + simple_member_access { + field: "Result" + object { + identifier { + name: "MyHashable" + } + } + } + } + } + } + constraint { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "MyHashValue" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Widget" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "MyHashable" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "MyHashValue" + } + } + } + } + } + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "MyHashValue" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "MakeSmallHash" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "HashToIntConvertible" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "x" + } + } + path { + simple_member_access { + field: "Hash" + object { + identifier { + name: "MyHashable" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "Widget" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "MakeSmallHash" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1c37ed06bf8776ee0d165e3ed3d8833a4cc9c760 b/explorer/fuzzing/fuzzer_corpus/1c37ed06bf8776ee0d165e3ed3d8833a4cc9c760 new file mode 100644 index 000000000000..25cfe33ad191 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1c37ed06bf8776ee0d165e3ed3d8833a4cc9c760 @@ -0,0 +1,190 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A1 {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A2 {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/60cb95fa0986cc17e934a7014593f76fba70c461 b/explorer/fuzzing/fuzzer_corpus/1c452ac633219d656ab5904d7638e5379e44a582 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/60cb95fa0986cc17e934a7014593f76fba70c461 rename to explorer/fuzzing/fuzzer_corpus/1c452ac633219d656ab5904d7638e5379e44a582 index 72063b33fbad..6df9054fa08a 100644 --- a/explorer/fuzzing/fuzzer_corpus/60cb95fa0986cc17e934a7014593f76fba70c461 +++ b/explorer/fuzzing/fuzzer_corpus/1c452ac633219d656ab5904d7638e5379e44a582 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { impl { kind: InternalImpl @@ -33,7 +35,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -76,7 +80,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -104,7 +110,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/a758174457d5b22eb2a94c9cc72e4341dfa97ff0 b/explorer/fuzzing/fuzzer_corpus/1ceaf07b219a9004798ecc0856af9b0d10cce19c similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a758174457d5b22eb2a94c9cc72e4341dfa97ff0 rename to explorer/fuzzing/fuzzer_corpus/1ceaf07b219a9004798ecc0856af9b0d10cce19c index 07f55416aafa..27c426f675fb 100644 --- a/explorer/fuzzing/fuzzer_corpus/a758174457d5b22eb2a94c9cc72e4341dfa97ff0 +++ b/explorer/fuzzing/fuzzer_corpus/1ceaf07b219a9004798ecc0856af9b0d10cce19c @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -106,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -190,7 +193,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -243,7 +248,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -388,7 +395,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -512,7 +521,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -622,7 +633,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/26db64985a757f7b85a8dec0687537da313e3ab9 b/explorer/fuzzing/fuzzer_corpus/1cffd9bfbbba52a53c5f886563683d230d02ad80 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/26db64985a757f7b85a8dec0687537da313e3ab9 rename to explorer/fuzzing/fuzzer_corpus/1cffd9bfbbba52a53c5f886563683d230d02ad80 index 93a85e820493..1dfd12d50266 100644 --- a/explorer/fuzzing/fuzzer_corpus/26db64985a757f7b85a8dec0687537da313e3ab9 +++ b/explorer/fuzzing/fuzzer_corpus/1cffd9bfbbba52a53c5f886563683d230d02ad80 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "SwizzleWith" + name { + name: "SwizzleWith" + } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -48,18 +52,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { alias { - name: "Swizzle" + name { + name: "Swizzle" + } target { where { base { @@ -123,7 +122,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -199,7 +200,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -300,7 +303,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4fa346a44b96db2ad5cfe3c2ad505d893114843c b/explorer/fuzzing/fuzzer_corpus/1d0d6abe9b8f6cf6eab4083ea51891c7b09b5653 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/4fa346a44b96db2ad5cfe3c2ad505d893114843c rename to explorer/fuzzing/fuzzer_corpus/1d0d6abe9b8f6cf6eab4083ea51891c7b09b5653 index b2a63feda4bb..aeb4fbe3ed41 100644 --- a/explorer/fuzzing/fuzzer_corpus/4fa346a44b96db2ad5cfe3c2ad505d893114843c +++ b/explorer/fuzzing/fuzzer_corpus/1d0d6abe9b8f6cf6eab4083ea51891c7b09b5653 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -34,18 +38,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -61,7 +60,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -104,7 +105,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -132,7 +135,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/1d36375d17078164cf9329dbe7f4b539b5323f34 b/explorer/fuzzing/fuzzer_corpus/1d36375d17078164cf9329dbe7f4b539b5323f34 new file mode 100644 index 000000000000..b95f09c7bec6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1d36375d17078164cf9329dbe7f4b539b5323f34 @@ -0,0 +1,62 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + qualifiers: "F" + name: "G" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1d5c57e26f96532fca3fab7cf9474049a8cd71b7 b/explorer/fuzzing/fuzzer_corpus/1d5c57e26f96532fca3fab7cf9474049a8cd71b7 new file mode 100644 index 000000000000..2a289aece683 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1d5c57e26f96532fca3fab7cf9474049a8cd71b7 @@ -0,0 +1,413 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "B" + } + } + } + declarations { + match_first { + impls { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + interface { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + impls { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + interface { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + interface { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "T" + type { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + bool_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + bool_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1e15985570e0b52f0d40a19e90b53ab6c679729d b/explorer/fuzzing/fuzzer_corpus/1e15985570e0b52f0d40a19e90b53ab6c679729d new file mode 100644 index 000000000000..a3b2cc126bee --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1e15985570e0b52f0d40a19e90b53ab6c679729d @@ -0,0 +1,650 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "Opt" + } + alternatives { + name: "None" + signature { + } + } + alternatives { + name: "Some" + signature { + fields { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "B" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "m" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "n" + } + } + arguments { + identifier { + name: "m" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "Some" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + arguments { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Some" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650 b/explorer/fuzzing/fuzzer_corpus/1e43eb0a0f7b622f2ee5153aadeba3c2716c3b0a similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650 rename to explorer/fuzzing/fuzzer_corpus/1e43eb0a0f7b622f2ee5153aadeba3c2716c3b0a index b1fe2dbfcc48..f7b9aacd0142 100644 --- a/explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650 +++ b/explorer/fuzzing/fuzzer_corpus/1e43eb0a0f7b622f2ee5153aadeba3c2716c3b0a @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -20,13 +24,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -44,7 +41,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -71,7 +70,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/93a5d1b18c20f1cc6bf1a4148f2a81f5d445b945 b/explorer/fuzzing/fuzzer_corpus/1e4fb57739ad776cee50880a79f29cdc6b532a58 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/93a5d1b18c20f1cc6bf1a4148f2a81f5d445b945 rename to explorer/fuzzing/fuzzer_corpus/1e4fb57739ad776cee50880a79f29cdc6b532a58 index 78bb21ffea64..8f882abc0f4d 100644 --- a/explorer/fuzzing/fuzzer_corpus/93a5d1b18c20f1cc6bf1a4148f2a81f5d445b945 +++ b/explorer/fuzzing/fuzzer_corpus/1e4fb57739ad776cee50880a79f29cdc6b532a58 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } type_params { fields { generic_binding { @@ -21,13 +23,8 @@ compilation_unit { } declarations { interface { - name: "B" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "B" } } } @@ -113,7 +110,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -159,7 +158,9 @@ compilation_unit { } declarations { function { - name: "G" + name { + name: "G" + } deduced_parameters { name: "T" type { @@ -205,7 +206,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -245,7 +248,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false @@ -280,7 +283,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/95a9c60ab5e4c36a851c95daf9f4ab05d231616e b/explorer/fuzzing/fuzzer_corpus/1ea21248974dcd55d90a60ca12e8149169a9b34c similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/95a9c60ab5e4c36a851c95daf9f4ab05d231616e rename to explorer/fuzzing/fuzzer_corpus/1ea21248974dcd55d90a60ca12e8149169a9b34c index 3d54aa353114..781bd30fb703 100644 --- a/explorer/fuzzing/fuzzer_corpus/95a9c60ab5e4c36a851c95daf9f4ab05d231616e +++ b/explorer/fuzzing/fuzzer_corpus/1ea21248974dcd55d90a60ca12e8149169a9b34c @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Cell" + name { + name: "Cell" + } members { function { - name: "Create" + name { + name: "Create" + } param_pattern { fields { binding_pattern { @@ -68,7 +72,9 @@ compilation_unit { } members { function { - name: "Get" + name { + name: "Get" + } self_pattern { binding_pattern { name: "self" @@ -113,7 +119,9 @@ compilation_unit { } members { function { - name: "Put" + name { + name: "Put" + } self_pattern { addr_pattern { binding_pattern { @@ -177,6 +185,7 @@ compilation_unit { name: "x" } } + op: Plain } } } @@ -184,7 +193,9 @@ compilation_unit { } members { function { - name: "Update" + name { + name: "Update" + } deduced_parameters { name: "U" type { @@ -269,6 +280,7 @@ compilation_unit { name: "x" } } + op: Plain } } } @@ -276,7 +288,9 @@ compilation_unit { } members { function { - name: "CreateOther" + name { + name: "CreateOther" + } deduced_parameters { name: "U" type { @@ -386,7 +400,9 @@ compilation_unit { } declarations { class_declaration { - name: "Integer" + name { + name: "Integer" + } members { variable { binding { @@ -406,7 +422,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -535,6 +553,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/1eb37a662ac6fc2c01dc9b5b1317e9bdc7ce64ec b/explorer/fuzzing/fuzzer_corpus/1eb37a662ac6fc2c01dc9b5b1317e9bdc7ce64ec new file mode 100644 index 000000000000..9db314c797e9 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1eb37a662ac6fc2c01dc9b5b1317e9bdc7ce64ec @@ -0,0 +1,132 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "AddInt" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "ret" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + operator { + op: Add + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + is_returned: true + } + } + statements { + return_var_statement { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "AddInt" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/63fbc98ddb2d220c7ee563f03ee6c7b32acfe59f b/explorer/fuzzing/fuzzer_corpus/1f137378f423a375a57448370eceee7aaac663ec similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/63fbc98ddb2d220c7ee563f03ee6c7b32acfe59f rename to explorer/fuzzing/fuzzer_corpus/1f137378f423a375a57448370eceee7aaac663ec index c54aed9878cf..99e035145573 100644 --- a/explorer/fuzzing/fuzzer_corpus/63fbc98ddb2d220c7ee563f03ee6c7b32acfe59f +++ b/explorer/fuzzing/fuzzer_corpus/1f137378f423a375a57448370eceee7aaac663ec @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Add" + name { + name: "ComputeSum" + } param_pattern { fields { binding_pattern { @@ -41,7 +43,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -61,7 +65,7 @@ compilation_unit { call { function { identifier { - name: "Add" + name: "ComputeSum" } } argument { diff --git a/explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676 b/explorer/fuzzing/fuzzer_corpus/1fb3cabbe7b1d1db38a57e533dd8047bf828a338 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676 rename to explorer/fuzzing/fuzzer_corpus/1fb3cabbe7b1d1db38a57e533dd8047bf828a338 index 3ff48b4bc73b..0f3000c9c747 100644 --- a/explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676 +++ b/explorer/fuzzing/fuzzer_corpus/1fb3cabbe7b1d1db38a57e533dd8047bf828a338 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { binding_pattern { @@ -56,7 +58,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c4f7cc23c6d83486f2901f99e48c65d815b3b919 b/explorer/fuzzing/fuzzer_corpus/1fcb05bd7ceeb20c92c134283274f611d58184be similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/c4f7cc23c6d83486f2901f99e48c65d815b3b919 rename to explorer/fuzzing/fuzzer_corpus/1fcb05bd7ceeb20c92c134283274f611d58184be index 7bcc95b14f9d..6852b35c190c 100644 --- a/explorer/fuzzing/fuzzer_corpus/c4f7cc23c6d83486f2901f99e48c65d815b3b919 +++ b/explorer/fuzzing/fuzzer_corpus/1fcb05bd7ceeb20c92c134283274f611d58184be @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { fields { binding_pattern { @@ -31,7 +35,7 @@ compilation_unit { call { function { identifier { - name: "Point" + name: "Self" } } argument { @@ -76,7 +80,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -86,7 +92,7 @@ compilation_unit { call { function { identifier { - name: "Point" + name: "Self" } } argument { @@ -179,7 +185,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f8e6cae2fb9e8181e18d0810a56d5b3ce20d90c3 b/explorer/fuzzing/fuzzer_corpus/1ff7462970b50e872fa525ce63c82deb12e251ad similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/f8e6cae2fb9e8181e18d0810a56d5b3ce20d90c3 rename to explorer/fuzzing/fuzzer_corpus/1ff7462970b50e872fa525ce63c82deb12e251ad index 30bfee22e8ad..262a0ca35ed7 100644 --- a/explorer/fuzzing/fuzzer_corpus/f8e6cae2fb9e8181e18d0810a56d5b3ce20d90c3 +++ b/explorer/fuzzing/fuzzer_corpus/1ff7462970b50e872fa525ce63c82deb12e251ad @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2123f77e8516358c52163a4fa1627361f3513f30 b/explorer/fuzzing/fuzzer_corpus/2123f77e8516358c52163a4fa1627361f3513f30 new file mode 100644 index 000000000000..301276e02d0d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2123f77e8516358c52163a4fa1627361f3513f30 @@ -0,0 +1,56 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "m" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/21df195c24c357e5a8f18f482090d95d2524e548 b/explorer/fuzzing/fuzzer_corpus/21df195c24c357e5a8f18f482090d95d2524e548 new file mode 100644 index 000000000000..db1ed0f1d675 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/21df195c24c357e5a8f18f482090d95d2524e548 @@ -0,0 +1,199 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "bp" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "B" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "b" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "ap" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "A" + } + } + } + } + } + } + } + } + init { + identifier { + name: "bp" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "ap" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a b/explorer/fuzzing/fuzzer_corpus/226b4ae2606b0af76ab25c51d0d61f3fa3b04228 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a rename to explorer/fuzzing/fuzzer_corpus/226b4ae2606b0af76ab25c51d0d61f3fa3b04228 index 71a56335e893..4b71854c0263 100644 --- a/explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a +++ b/explorer/fuzzing/fuzzer_corpus/226b4ae2606b0af76ab25c51d0d61f3fa3b04228 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/57d2c890c2c3bf9d7e028a46d7ddce6deee5c2aa b/explorer/fuzzing/fuzzer_corpus/230ea69eab009635a68f253a70e7f55d8af387bd similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/57d2c890c2c3bf9d7e028a46d7ddce6deee5c2aa rename to explorer/fuzzing/fuzzer_corpus/230ea69eab009635a68f253a70e7f55d8af387bd index d8bcb271459d..6982d99bd748 100644 --- a/explorer/fuzzing/fuzzer_corpus/57d2c890c2c3bf9d7e028a46d7ddce6deee5c2aa +++ b/explorer/fuzzing/fuzzer_corpus/230ea69eab009635a68f253a70e7f55d8af387bd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } } } declarations { @@ -35,7 +37,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -76,7 +80,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -104,7 +110,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/f7610aa3d6683ac10b1072077b6b620841686e50 b/explorer/fuzzing/fuzzer_corpus/2345f2c6add76c7aa04327e5aaa0840275740385 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/f7610aa3d6683ac10b1072077b6b620841686e50 rename to explorer/fuzzing/fuzzer_corpus/2345f2c6add76c7aa04327e5aaa0840275740385 index 203e118d2e5f..0ed52d7d880e 100644 --- a/explorer/fuzzing/fuzzer_corpus/f7610aa3d6683ac10b1072077b6b620841686e50 +++ b/explorer/fuzzing/fuzzer_corpus/2345f2c6add76c7aa04327e5aaa0840275740385 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -66,7 +68,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811 b/explorer/fuzzing/fuzzer_corpus/2420c58342df0a0df9e67e3b0edaa7b45372195d similarity index 80% rename from explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811 rename to explorer/fuzzing/fuzzer_corpus/2420c58342df0a0df9e67e3b0edaa7b45372195d index 7ad403c10ddc..07eee8effecd 100644 --- a/explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811 +++ b/explorer/fuzzing/fuzzer_corpus/2420c58342df0a0df9e67e3b0edaa7b45372195d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "HasThreeTypes" + name { + name: "HasThreeTypes" + } members { let { pattern { @@ -45,13 +47,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -69,29 +64,22 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "A" - } - } - rhs { + rewrite { + member_name: "A" + replacement { int_type_literal { } } } } clauses { - equals { - lhs { + rewrite { + member_name: "B" + replacement { designator { name: "C" } } - rhs { - int_type_literal { - } - } } } } @@ -100,7 +88,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/24676dd9ecc105448196ca0eee7f8d2987ff44ab b/explorer/fuzzing/fuzzer_corpus/24676dd9ecc105448196ca0eee7f8d2987ff44ab new file mode 100644 index 000000000000..1a2b832a419a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/24676dd9ecc105448196ca0eee7f8d2987ff44ab @@ -0,0 +1,70 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/c32ff216c8c6cf3ae9ec6b42c0aac88e0f76e234 b/explorer/fuzzing/fuzzer_corpus/249efd63613bc0828f4e14afd7e607c5766554f7 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/c32ff216c8c6cf3ae9ec6b42c0aac88e0f76e234 rename to explorer/fuzzing/fuzzer_corpus/249efd63613bc0828f4e14afd7e607c5766554f7 index dfeef1c4229d..3155766a0eb3 100644 --- a/explorer/fuzzing/fuzzer_corpus/c32ff216c8c6cf3ae9ec6b42c0aac88e0f76e234 +++ b/explorer/fuzzing/fuzzer_corpus/249efd63613bc0828f4e14afd7e607c5766554f7 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AllocateInteger" + name { + name: "AllocateInteger" + } param_pattern { } return_term { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/24d0079e1aa80afab58150f9dbb67c4c0e4c931b b/explorer/fuzzing/fuzzer_corpus/24d0079e1aa80afab58150f9dbb67c4c0e4c931b new file mode 100644 index 000000000000..4f22c227c914 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/24d0079e1aa80afab58150f9dbb67c4c0e4c931b @@ -0,0 +1,75 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + function { + name { + name: "ScalarZero" + } + param_pattern { + } + return_term { + kind: Expression + type { + simple_member_access { + field: "ScalarType" + object { + identifier { + name: "Vector" + } + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "ScalarType" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/767da0c9be93c7b780a1eceaa4c41ee117f32034 b/explorer/fuzzing/fuzzer_corpus/24e5915a89c0544f8b6a98614ce1627362c9c004 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/767da0c9be93c7b780a1eceaa4c41ee117f32034 rename to explorer/fuzzing/fuzzer_corpus/24e5915a89c0544f8b6a98614ce1627362c9c004 index 1561fbd2e0a4..10a396a47d20 100644 --- a/explorer/fuzzing/fuzzer_corpus/767da0c9be93c7b780a1eceaa4c41ee117f32034 +++ b/explorer/fuzzing/fuzzer_corpus/24e5915a89c0544f8b6a98614ce1627362c9c004 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -47,7 +49,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/52a6fc606b740c0eb6f34623caa082eec18701d7 b/explorer/fuzzing/fuzzer_corpus/2553611e44783982b46c96dc4751ed5be979a776 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/52a6fc606b740c0eb6f34623caa082eec18701d7 rename to explorer/fuzzing/fuzzer_corpus/2553611e44783982b46c96dc4751ed5be979a776 index f8dfe608ca72..a11d84b055a5 100644 --- a/explorer/fuzzing/fuzzer_corpus/52a6fc606b740c0eb6f34623caa082eec18701d7 +++ b/explorer/fuzzing/fuzzer_corpus/2553611e44783982b46c96dc4751ed5be979a776 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -63,6 +65,7 @@ compilation_unit { value: 1 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/2592ac23dae5631b900a05323bafadff16193ed6 b/explorer/fuzzing/fuzzer_corpus/2592ac23dae5631b900a05323bafadff16193ed6 new file mode 100644 index 000000000000..c7438d3747c1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2592ac23dae5631b900a05323bafadff16193ed6 @@ -0,0 +1,53 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + interface_impl { + impl_type { + identifier { + name: "Self" + } + } + constraint { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/256fd58b383bf6fe89a33cdd27c4f9dd5350539e b/explorer/fuzzing/fuzzer_corpus/259a863ed9082cb8de31b5221b95287d39aed44f similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/256fd58b383bf6fe89a33cdd27c4f9dd5350539e rename to explorer/fuzzing/fuzzer_corpus/259a863ed9082cb8de31b5221b95287d39aed44f index 8993cd544797..697767164ff0 100644 --- a/explorer/fuzzing/fuzzer_corpus/256fd58b383bf6fe89a33cdd27c4f9dd5350539e +++ b/explorer/fuzzing/fuzzer_corpus/259a863ed9082cb8de31b5221b95287d39aed44f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "DoMul" + name { + name: "DoMul" + } deduced_parameters { name: "T" type { @@ -108,7 +110,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/34d42a476155fee7c60325c55cf14bbe1749c1a0 b/explorer/fuzzing/fuzzer_corpus/26c83f24cf6e29aada6ea5112db6d71c7f332b49 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/34d42a476155fee7c60325c55cf14bbe1749c1a0 rename to explorer/fuzzing/fuzzer_corpus/26c83f24cf6e29aada6ea5112db6d71c7f332b49 index bd0ba26ed0d6..624fb49248b7 100644 --- a/explorer/fuzzing/fuzzer_corpus/34d42a476155fee7c60325c55cf14bbe1749c1a0 +++ b/explorer/fuzzing/fuzzer_corpus/26c83f24cf6e29aada6ea5112db6d71c7f332b49 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -82,6 +84,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/2289a078ddc2d55ba7953a9fa293adc57df38d5f b/explorer/fuzzing/fuzzer_corpus/2718684e5395145cf201b11e4738666efd38255b similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/2289a078ddc2d55ba7953a9fa293adc57df38d5f rename to explorer/fuzzing/fuzzer_corpus/2718684e5395145cf201b11e4738666efd38255b index f354a4770197..74fcfb8a0c5b 100644 --- a/explorer/fuzzing/fuzzer_corpus/2289a078ddc2d55ba7953a9fa293adc57df38d5f +++ b/explorer/fuzzing/fuzzer_corpus/2718684e5395145cf201b11e4738666efd38255b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "GetX" + name { + name: "GetX" + } deduced_parameters { name: "T" type { @@ -118,7 +122,9 @@ compilation_unit { } declarations { function { - name: "GetY" + name { + name: "GetY" + } param_pattern { fields { generic_binding { @@ -185,7 +191,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/271fc28e0362d9f752541cf06e1131b70e729b59 b/explorer/fuzzing/fuzzer_corpus/271fc28e0362d9f752541cf06e1131b70e729b59 new file mode 100644 index 000000000000..97afcf32b98c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/271fc28e0362d9f752541cf06e1131b70e729b59 @@ -0,0 +1,478 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "E" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Foo" + } + param_pattern { + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "val" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "e" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 3 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "D" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c1" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c2" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + identifier { + name: "d" + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Foo(c1): {0}" + } + } + fields { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "c1" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Foo(c2): {0}" + } + } + fields { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "c2" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Foo(d): {0}" + } + } + fields { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Foo(&e): {0}" + } + } + fields { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0512f4dcd737922dfec6eb81d4c93d1f11ad2f7c b/explorer/fuzzing/fuzzer_corpus/274a41d566450247ad862675b54ac99f10b1a275 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/0512f4dcd737922dfec6eb81d4c93d1f11ad2f7c rename to explorer/fuzzing/fuzzer_corpus/274a41d566450247ad862675b54ac99f10b1a275 index be410008dedd..52357a4071b6 100644 --- a/explorer/fuzzing/fuzzer_corpus/0512f4dcd737922dfec6eb81d4c93d1f11ad2f7c +++ b/explorer/fuzzing/fuzzer_corpus/274a41d566450247ad862675b54ac99f10b1a275 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Foo" + name { + name: "Foo" + } param_pattern { } return_term { @@ -43,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/00725179de0aa71c7343d00281a8b4e881755cd1 b/explorer/fuzzing/fuzzer_corpus/277dd8d5c877be6c18233440ee001ace701283c9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/00725179de0aa71c7343d00281a8b4e881755cd1 rename to explorer/fuzzing/fuzzer_corpus/277dd8d5c877be6c18233440ee001ace701283c9 index 038eae8e5f07..43b9a8ec984e 100644 --- a/explorer/fuzzing/fuzzer_corpus/00725179de0aa71c7343d00281a8b4e881755cd1 +++ b/explorer/fuzzing/fuzzer_corpus/277dd8d5c877be6c18233440ee001ace701283c9 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -92,18 +98,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -188,7 +189,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -297,7 +300,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -436,7 +441,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -490,7 +497,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -546,7 +555,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -669,7 +680,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f39a1c43898787fcf124c264b40e74d1c8d712ac b/explorer/fuzzing/fuzzer_corpus/27ef47d1362933a6bff7e03fc14e5c5fcd23e2fa similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/f39a1c43898787fcf124c264b40e74d1c8d712ac rename to explorer/fuzzing/fuzzer_corpus/27ef47d1362933a6bff7e03fc14e5c5fcd23e2fa index 946422728285..b034fe4b0e6e 100644 --- a/explorer/fuzzing/fuzzer_corpus/f39a1c43898787fcf124c264b40e74d1c8d712ac +++ b/explorer/fuzzing/fuzzer_corpus/27ef47d1362933a6bff7e03fc14e5c5fcd23e2fa @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -66,7 +68,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/795592079e82d349ba64cf6618596bc9abf88272 b/explorer/fuzzing/fuzzer_corpus/27f47232d1bafdca3762a5c22012c5089f090a22 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/795592079e82d349ba64cf6618596bc9abf88272 rename to explorer/fuzzing/fuzzer_corpus/27f47232d1bafdca3762a5c22012c5089f090a22 index 168c448043a7..aea2f1280b60 100644 --- a/explorer/fuzzing/fuzzer_corpus/795592079e82d349ba64cf6618596bc9abf88272 +++ b/explorer/fuzzing/fuzzer_corpus/27f47232d1bafdca3762a5c22012c5089f090a22 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "X" + name { + name: "X" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -106,7 +110,9 @@ compilation_unit { } declarations { class_declaration { - name: "Y" + name { + name: "Y" + } members { variable { binding { @@ -150,7 +156,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -206,7 +214,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2824af73c9b3ce5d33a222f3b775182893af1027 b/explorer/fuzzing/fuzzer_corpus/2824af73c9b3ce5d33a222f3b775182893af1027 new file mode 100644 index 000000000000..c13669ca759f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2824af73c9b3ce5d33a222f3b775182893af1027 @@ -0,0 +1,182 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "lhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 8 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "lhs" + } + } + path { + simple_member_access { + field: "Op" + object { + call { + function { + identifier { + name: "SubWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + operator { + op: Sub + arguments { + identifier { + name: "lhs" + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/28c7ced2db84460637ac24a019ff2fab72d5b1b2 b/explorer/fuzzing/fuzzer_corpus/28c7ced2db84460637ac24a019ff2fab72d5b1b2 new file mode 100644 index 000000000000..e8c89455a853 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/28c7ced2db84460637ac24a019ff2fab72d5b1b2 @@ -0,0 +1,94 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasType" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "H" + type { + where { + base { + identifier { + name: "HasType" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + operator { + op: Ptr + arguments { + designator { + name: "T" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5c737d5839a3ca0db8b0f112dd693420a707b8e5 b/explorer/fuzzing/fuzzer_corpus/28ef6e1e280a1f3621c9a5225e69844d0db40081 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5c737d5839a3ca0db8b0f112dd693420a707b8e5 rename to explorer/fuzzing/fuzzer_corpus/28ef6e1e280a1f3621c9a5225e69844d0db40081 index 921bac2d0d59..30448a721855 100644 --- a/explorer/fuzzing/fuzzer_corpus/5c737d5839a3ca0db8b0f112dd693420a707b8e5 +++ b/explorer/fuzzing/fuzzer_corpus/28ef6e1e280a1f3621c9a5225e69844d0db40081 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -150,7 +151,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -259,7 +262,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -372,7 +377,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -481,7 +488,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -581,7 +590,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -692,7 +703,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0d6963786d58523dfc5e68326f6efd08fd1b2ea4 b/explorer/fuzzing/fuzzer_corpus/2917ec9747dbfa35f67d9d61bb71d5d4d0fb4385 similarity index 62% rename from explorer/fuzzing/fuzzer_corpus/0d6963786d58523dfc5e68326f6efd08fd1b2ea4 rename to explorer/fuzzing/fuzzer_corpus/2917ec9747dbfa35f67d9d61bb71d5d4d0fb4385 index 57b6f9e56c63..6008d7383349 100644 --- a/explorer/fuzzing/fuzzer_corpus/0d6963786d58523dfc5e68326f6efd08fd1b2ea4 +++ b/explorer/fuzzing/fuzzer_corpus/2917ec9747dbfa35f67d9d61bb71d5d4d0fb4385 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "MyType" + name { + name: "MyType" + } members { variable { binding { @@ -49,7 +51,9 @@ compilation_unit { } members { function { - name: "Equal" + name { + name: "Equal" + } self_pattern { binding_pattern { name: "self" @@ -120,13 +124,90 @@ compilation_unit { } } } + members { + function { + name { + name: "NotEqual" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: NotEq + arguments { + simple_member_access { + field: "value" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "value" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } } } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -250,6 +331,57 @@ compilation_unit { } } } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "structs not equal: {0}" + } + } + fields { + if_expression { + condition { + operator { + op: NotEq + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "y" + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } statements { return_expression_statement { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/c68bd445dfd7fea94c8e2745cfaf705f7388f138 b/explorer/fuzzing/fuzzer_corpus/2921e84bdcbabd8d64c21360345ca280f9e250a4 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/c68bd445dfd7fea94c8e2745cfaf705f7388f138 rename to explorer/fuzzing/fuzzer_corpus/2921e84bdcbabd8d64c21360345ca280f9e250a4 index 7bb7ef2da9b5..260bd25be250 100644 --- a/explorer/fuzzing/fuzzer_corpus/c68bd445dfd7fea94c8e2745cfaf705f7388f138 +++ b/explorer/fuzzing/fuzzer_corpus/2921e84bdcbabd8d64c21360345ca280f9e250a4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Foo" + name { + name: "Foo" + } param_pattern { } return_term { @@ -47,7 +49,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c82bfd82ed4ded367dc7230e684f379bc04c76f6 b/explorer/fuzzing/fuzzer_corpus/297403f9670145ba84245d3db2be10ea2ae9d0bf similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/c82bfd82ed4ded367dc7230e684f379bc04c76f6 rename to explorer/fuzzing/fuzzer_corpus/297403f9670145ba84245d3db2be10ea2ae9d0bf index 66bc2dccabf1..05862403db53 100644 --- a/explorer/fuzzing/fuzzer_corpus/c82bfd82ed4ded367dc7230e684f379bc04c76f6 +++ b/explorer/fuzzing/fuzzer_corpus/297403f9670145ba84245d3db2be10ea2ae9d0bf @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -122,7 +124,7 @@ compilation_unit { tuple_literal { fields { string_literal { - value: "HALLO WELT " + value: "HALLO WELT {0}" } } fields { @@ -158,6 +160,7 @@ compilation_unit { } } } + op: Plain } } } @@ -195,7 +198,7 @@ compilation_unit { tuple_literal { fields { string_literal { - value: "HALLO WELT " + value: "HALLO WELT {0}" } } fields { @@ -231,6 +234,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/29baa699f49a55a3b6d733f3a0030367e1ab5835 b/explorer/fuzzing/fuzzer_corpus/29baa699f49a55a3b6d733f3a0030367e1ab5835 new file mode 100644 index 000000000000..44d4066df8f5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/29baa699f49a55a3b6d733f3a0030367e1ab5835 @@ -0,0 +1,301 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "FunctionC" + } + param_pattern { + fields { + var_pattern { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Class C, call {0}" + } + } + fields { + identifier { + name: "i" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "FunctionD" + } + param_pattern { + fields { + var_pattern { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionC" + object { + identifier { + name: "C" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "i" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Class D, call {0}" + } + } + fields { + identifier { + name: "i" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionD" + object { + identifier { + name: "D" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionC" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "FunctionD" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2a0ee4282b6c339348fee3a6921b56432b2f35a6 b/explorer/fuzzing/fuzzer_corpus/2a0ee4282b6c339348fee3a6921b56432b2f35a6 new file mode 100644 index 000000000000..5a5861e77cfc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2a0ee4282b6c339348fee3a6921b56432b2f35a6 @@ -0,0 +1,89 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + alias { + name { + name: "M" + } + target { + identifier { + name: "N" + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "M" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/41d5bb99f38cca49d8f53d914d54f09b6857eaba b/explorer/fuzzing/fuzzer_corpus/2aa0ee106f4e4f04b322e83830ba574e8be2506f similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/41d5bb99f38cca49d8f53d914d54f09b6857eaba rename to explorer/fuzzing/fuzzer_corpus/2aa0ee106f4e4f04b322e83830ba574e8be2506f index 20b27daf8c22..273d7dfe283f 100644 --- a/explorer/fuzzing/fuzzer_corpus/41d5bb99f38cca49d8f53d914d54f09b6857eaba +++ b/explorer/fuzzing/fuzzer_corpus/2aa0ee106f4e4f04b322e83830ba574e8be2506f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "NoReturn" + name { + name: "NoReturn" + } param_pattern { } return_term { @@ -17,7 +19,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/93c5cd365e856795aad413ff3e703ffa2b530dce b/explorer/fuzzing/fuzzer_corpus/2aaecd831ea460c5a721f9421d4965fc408d4c35 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/93c5cd365e856795aad413ff3e703ffa2b530dce rename to explorer/fuzzing/fuzzer_corpus/2aaecd831ea460c5a721f9421d4965fc408d4c35 index dbe2ba1a7992..040d4af02dec 100644 --- a/explorer/fuzzing/fuzzer_corpus/93c5cd365e856795aad413ff3e703ffa2b530dce +++ b/explorer/fuzzing/fuzzer_corpus/2aaecd831ea460c5a721f9421d4965fc408d4c35 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2b1263de304325a3a6847294fa1a2aeb3564d22c b/explorer/fuzzing/fuzzer_corpus/2b1263de304325a3a6847294fa1a2aeb3564d22c new file mode 100644 index 000000000000..828635680c0d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2b1263de304325a3a6847294fa1a2aeb3564d22c @@ -0,0 +1,74 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2b24973806eac518653f494a29671fad6aea010b b/explorer/fuzzing/fuzzer_corpus/2b24973806eac518653f494a29671fad6aea010b new file mode 100644 index 000000000000..3d600de2bada --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2b24973806eac518653f494a29671fad6aea010b @@ -0,0 +1,666 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + identifier { + name: "Inc" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + inc_dec { + operand { + simple_member_access { + field: "n" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_increment: true + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + identifier { + name: "Dec" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + inc_dec { + operand { + simple_member_access { + field: "n" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_increment: false + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + inc_dec { + operand { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + is_increment: true + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + inc_dec { + operand { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + is_increment: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + inc_dec { + operand { + identifier { + name: "a" + } + } + is_increment: true + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + inc_dec { + operand { + identifier { + name: "a" + } + } + is_increment: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "Inc" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "Dec" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "Inc" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "Dec" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/acdce5c12dc8f2c2a7232620330dcf6b3517bcb6 b/explorer/fuzzing/fuzzer_corpus/2cd6e756af6d6c7bbc680961e794400e4ac3d6ae similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/acdce5c12dc8f2c2a7232620330dcf6b3517bcb6 rename to explorer/fuzzing/fuzzer_corpus/2cd6e756af6d6c7bbc680961e794400e4ac3d6ae index 603d058dca5b..7d1eed1f1c05 100644 --- a/explorer/fuzzing/fuzzer_corpus/acdce5c12dc8f2c2a7232620330dcf6b3517bcb6 +++ b/explorer/fuzzing/fuzzer_corpus/2cd6e756af6d6c7bbc680961e794400e4ac3d6ae @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -70,6 +72,7 @@ compilation_unit { value: 1 } } + op: Plain } } } @@ -90,6 +93,7 @@ compilation_unit { value: 2 } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/7505c92d87e3b9ebb7d9305aceb6de56d2fb581b b/explorer/fuzzing/fuzzer_corpus/2ded3a52f879950b9f7c70626708f433c4e1af2a similarity index 87% rename from explorer/fuzzing/fuzzer_corpus/7505c92d87e3b9ebb7d9305aceb6de56d2fb581b rename to explorer/fuzzing/fuzzer_corpus/2ded3a52f879950b9f7c70626708f433c4e1af2a index a06936982875..d85c3ed85be8 100644 --- a/explorer/fuzzing/fuzzer_corpus/7505c92d87e3b9ebb7d9305aceb6de56d2fb581b +++ b/explorer/fuzzing/fuzzer_corpus/2ded3a52f879950b9f7c70626708f433c4e1af2a @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { alias { - name: "B" + name { + name: "B" + } target { where { base { @@ -45,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/83b0b7edd81d74202ec5b6029ec10514cc76b05a b/explorer/fuzzing/fuzzer_corpus/2df8a45807e01a85bd980ac9aafa9f12eebb6fc5 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/83b0b7edd81d74202ec5b6029ec10514cc76b05a rename to explorer/fuzzing/fuzzer_corpus/2df8a45807e01a85bd980ac9aafa9f12eebb6fc5 index 819bae070bda..d680e60c79f4 100644 --- a/explorer/fuzzing/fuzzer_corpus/83b0b7edd81d74202ec5b6029ec10514cc76b05a +++ b/explorer/fuzzing/fuzzer_corpus/2df8a45807e01a85bd980ac9aafa9f12eebb6fc5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -39,13 +41,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -56,7 +54,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -115,7 +115,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -174,6 +176,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/2e6b6f16fd486918688ae87eb3b4a197296989c3 b/explorer/fuzzing/fuzzer_corpus/2e6b6f16fd486918688ae87eb3b4a197296989c3 new file mode 100644 index 000000000000..f4140706591f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2e6b6f16fd486918688ae87eb3b4a197296989c3 @@ -0,0 +1,133 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + let { + pattern { + generic_binding { + name: "Dim" + type { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "Vector" + } + } + clauses { + rewrite { + member_name: "Dim" + replacement { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + compound_member_access { + object { + identifier { + name: "Point" + } + } + path { + simple_member_access { + field: "Dim" + object { + identifier { + name: "Vector" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4573dec6fd9e740a5eefe7e59c36c3ea9d7ed8fd b/explorer/fuzzing/fuzzer_corpus/2ee264dd2bbf6040e1dbd35cec604eef029a39ba similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/4573dec6fd9e740a5eefe7e59c36c3ea9d7ed8fd rename to explorer/fuzzing/fuzzer_corpus/2ee264dd2bbf6040e1dbd35cec604eef029a39ba index c36577ee10af..1ed7fc897571 100644 --- a/explorer/fuzzing/fuzzer_corpus/4573dec6fd9e740a5eefe7e59c36c3ea9d7ed8fd +++ b/explorer/fuzzing/fuzzer_corpus/2ee264dd2bbf6040e1dbd35cec604eef029a39ba @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/303a2187a4ff61fde4b156859d305f3656b76986 b/explorer/fuzzing/fuzzer_corpus/303a2187a4ff61fde4b156859d305f3656b76986 new file mode 100644 index 000000000000..55a48a883950 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/303a2187a4ff61fde4b156859d305f3656b76986 @@ -0,0 +1,291 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "var_c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "var_d" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "var_c" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "var_d" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Read var_c={0}" + } + } + fields { + simple_member_access { + field: "var_c" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Read var_d={0}" + } + } + fields { + simple_member_access { + field: "var_d" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "var_c" + object { + identifier { + name: "d" + } + } + } + } + rhs { + int_literal { + value: 3 + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "var_d" + object { + identifier { + name: "d" + } + } + } + } + rhs { + int_literal { + value: 4 + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Assign var_c={0}" + } + } + fields { + simple_member_access { + field: "var_c" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Assign var_d={0}" + } + } + fields { + simple_member_access { + field: "var_d" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/95165ccae95d4b77bfab94856c762b79972d581e b/explorer/fuzzing/fuzzer_corpus/3092700876ae00aa40e0943fc8899ea3f91363fc similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/95165ccae95d4b77bfab94856c762b79972d581e rename to explorer/fuzzing/fuzzer_corpus/3092700876ae00aa40e0943fc8899ea3f91363fc index 2cb51f062add..324d9ea71fd0 100644 --- a/explorer/fuzzing/fuzzer_corpus/95165ccae95d4b77bfab94856c762b79972d581e +++ b/explorer/fuzzing/fuzzer_corpus/3092700876ae00aa40e0943fc8899ea3f91363fc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "map" + name { + name: "map" + } deduced_parameters { name: "T" type { @@ -148,7 +150,9 @@ compilation_unit { } declarations { function { - name: "inc" + name { + name: "inc" + } param_pattern { fields { binding_pattern { @@ -196,7 +200,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/174240eeaa59005d7b46ff86542da6ad9b009ca4 b/explorer/fuzzing/fuzzer_corpus/31d273b01e3ffaa1d70c216f7b47f61ef47f961c similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/174240eeaa59005d7b46ff86542da6ad9b009ca4 rename to explorer/fuzzing/fuzzer_corpus/31d273b01e3ffaa1d70c216f7b47f61ef47f961c index b0a510d1ed40..487be533c0bc 100644 --- a/explorer/fuzzing/fuzzer_corpus/174240eeaa59005d7b46ff86542da6ad9b009ca4 +++ b/explorer/fuzzing/fuzzer_corpus/31d273b01e3ffaa1d70c216f7b47f61ef47f961c @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -80,7 +82,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a241138ba16f277e89d9e6e345073179328b043c b/explorer/fuzzing/fuzzer_corpus/31dac04fcde41a12dd5ea5286982cd742cea634a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a241138ba16f277e89d9e6e345073179328b043c rename to explorer/fuzzing/fuzzer_corpus/31dac04fcde41a12dd5ea5286982cd742cea634a index 74dea97c0851..0c4da4173339 100644 --- a/explorer/fuzzing/fuzzer_corpus/a241138ba16f277e89d9e6e345073179328b043c +++ b/explorer/fuzzing/fuzzer_corpus/31dac04fcde41a12dd5ea5286982cd742cea634a @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -107,18 +115,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -176,7 +179,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -217,7 +222,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -326,7 +333,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -428,7 +437,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -559,7 +570,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/31f34f507f6d8c70cc7934fc807d90e32031ecfb b/explorer/fuzzing/fuzzer_corpus/31f34f507f6d8c70cc7934fc807d90e32031ecfb new file mode 100644 index 000000000000..c24d20c42d87 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/31f34f507f6d8c70cc7934fc807d90e32031ecfb @@ -0,0 +1,892 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasTypes" + } + members { + let { + pattern { + generic_binding { + name: "A" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "B" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "C" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "D" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "E" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "F" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "HasParams" + } + members { + let { + pattern { + generic_binding { + name: "V" + type { + identifier { + name: "HasTypes" + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "X" + type { + where { + base { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "HasTypes" + } + } + arguments { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + fields { + designator { + name: "Self" + } + } + fields { + designator { + name: "Self" + } + } + fields { + designator { + name: "Self" + } + } + } + } + } + } + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + } + } + } + } + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + } + } + } + } + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + } + } + } + } + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + } + } + } + } + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "F" + replacement { + simple_member_access { + field: "A" + object { + compound_member_access { + object { + designator { + name: "Self" + } + } + path { + simple_member_access { + field: "V" + object { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + fields { + designator { + name: "E" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "E" + replacement { + simple_member_access { + field: "A" + object { + compound_member_access { + object { + designator { + name: "Self" + } + } + path { + simple_member_access { + field: "V" + object { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + fields { + designator { + name: "D" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "D" + replacement { + simple_member_access { + field: "A" + object { + compound_member_access { + object { + designator { + name: "Self" + } + } + path { + simple_member_access { + field: "V" + object { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + fields { + designator { + name: "C" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "C" + replacement { + simple_member_access { + field: "A" + object { + compound_member_access { + object { + designator { + name: "Self" + } + } + path { + simple_member_access { + field: "V" + object { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + fields { + designator { + name: "B" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "B" + replacement { + simple_member_access { + field: "A" + object { + compound_member_access { + object { + designator { + name: "Self" + } + } + path { + simple_member_access { + field: "V" + object { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + fields { + designator { + name: "A" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "A" + replacement { + designator { + name: "Self" + } + } + } + } + clauses { + rewrite { + member_name: "V" + replacement { + designator { + name: "Self" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "F" + object { + identifier { + name: "X" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + identifier { + name: "HasTypes" + } + } + clauses { + rewrite { + member_name: "A" + replacement { + designator { + name: "B" + } + } + } + } + clauses { + rewrite { + member_name: "B" + replacement { + designator { + name: "C" + } + } + } + } + clauses { + rewrite { + member_name: "C" + replacement { + designator { + name: "D" + } + } + } + } + clauses { + rewrite { + member_name: "D" + replacement { + designator { + name: "E" + } + } + } + } + clauses { + rewrite { + member_name: "E" + replacement { + designator { + name: "F" + } + } + } + } + clauses { + rewrite { + member_name: "F" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + call { + function { + identifier { + name: "HasParams" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "V" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1efd8969cb72eb3af6d06dc50d0fbddb8c1140c3 b/explorer/fuzzing/fuzzer_corpus/339a393ea3396484ed446474dd1297941d73bd02 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1efd8969cb72eb3af6d06dc50d0fbddb8c1140c3 rename to explorer/fuzzing/fuzzer_corpus/339a393ea3396484ed446474dd1297941d73bd02 index 9e2517a4a482..169c2d4e7733 100644 --- a/explorer/fuzzing/fuzzer_corpus/1efd8969cb72eb3af6d06dc50d0fbddb8c1140c3 +++ b/explorer/fuzzing/fuzzer_corpus/339a393ea3396484ed446474dd1297941d73bd02 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { let { pattern { @@ -19,18 +21,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "F1" + name { + name: "F1" + } deduced_parameters { name: "T" type { @@ -99,7 +96,9 @@ compilation_unit { } declarations { function { - name: "F2" + name { + name: "F2" + } deduced_parameters { name: "U" type { @@ -168,7 +167,9 @@ compilation_unit { } declarations { function { - name: "F3" + name { + name: "F3" + } deduced_parameters { name: "T" type { @@ -299,7 +300,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/da6f40d8f1d3f617a6a3fee5708e40b3a734aa90 b/explorer/fuzzing/fuzzer_corpus/3403e4ac6af4a73b926f2fff3deabeed59700d8b similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/da6f40d8f1d3f617a6a3fee5708e40b3a734aa90 rename to explorer/fuzzing/fuzzer_corpus/3403e4ac6af4a73b926f2fff3deabeed59700d8b index 8aa2f40fb967..30094af89686 100644 --- a/explorer/fuzzing/fuzzer_corpus/da6f40d8f1d3f617a6a3fee5708e40b3a734aa90 +++ b/explorer/fuzzing/fuzzer_corpus/3403e4ac6af4a73b926f2fff3deabeed59700d8b @@ -16,7 +16,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/34382e52368a627e3462ebe367a544dc97205e26 b/explorer/fuzzing/fuzzer_corpus/34382e52368a627e3462ebe367a544dc97205e26 new file mode 100644 index 000000000000..6383d99ab62a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/34382e52368a627e3462ebe367a544dc97205e26 @@ -0,0 +1,266 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Before: {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "c" + } + } + path { + simple_member_access { + field: "Op" + object { + call { + function { + identifier { + name: "AssignWith" + } + } + argument { + tuple_literal { + fields { + struct_type_literal { + fields { + name: "n" + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "c" + } + } + rhs { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2e46c9fba5e11ccb139ac809c7c919439a5b00cf b/explorer/fuzzing/fuzzer_corpus/34480b195ed723214661d0a25c0d7f7c3ff667a5 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/2e46c9fba5e11ccb139ac809c7c919439a5b00cf rename to explorer/fuzzing/fuzzer_corpus/34480b195ed723214661d0a25c0d7f7c3ff667a5 index ce4650f9df37..aa5a2ef87bc5 100644 --- a/explorer/fuzzing/fuzzer_corpus/2e46c9fba5e11ccb139ac809c7c919439a5b00cf +++ b/explorer/fuzzing/fuzzer_corpus/34480b195ed723214661d0a25c0d7f7c3ff667a5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/373731d03672f31b356f0068a9680c6b03d87cd0 b/explorer/fuzzing/fuzzer_corpus/348cf478cb194626674c53630f655ac2df93d4a4 similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/373731d03672f31b356f0068a9680c6b03d87cd0 rename to explorer/fuzzing/fuzzer_corpus/348cf478cb194626674c53630f655ac2df93d4a4 index efe99635a7da..2f1f97d96921 100644 --- a/explorer/fuzzing/fuzzer_corpus/373731d03672f31b356f0068a9680c6b03d87cd0 +++ b/explorer/fuzzing/fuzzer_corpus/348cf478cb194626674c53630f655ac2df93d4a4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { alias { - name: "a" + name { + name: "a" + } target { identifier { name: "a" @@ -15,7 +17,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/18cc6fefea80deb3e21fa2b3d225b7e503660418 b/explorer/fuzzing/fuzzer_corpus/34e2656182b71815bf31aaeee8bc7c7bb84cd252 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/18cc6fefea80deb3e21fa2b3d225b7e503660418 rename to explorer/fuzzing/fuzzer_corpus/34e2656182b71815bf31aaeee8bc7c7bb84cd252 index c2347a5e5e8f..06726086fa14 100644 --- a/explorer/fuzzing/fuzzer_corpus/18cc6fefea80deb3e21fa2b3d225b7e503660418 +++ b/explorer/fuzzing/fuzzer_corpus/34e2656182b71815bf31aaeee8bc7c7bb84cd252 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -47,6 +49,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/dca863308d3c3b922bbed6e4118c20261dd38dcb b/explorer/fuzzing/fuzzer_corpus/365c379ec8eddc0153de4df6d8b0147898f78312 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/dca863308d3c3b922bbed6e4118c20261dd38dcb rename to explorer/fuzzing/fuzzer_corpus/365c379ec8eddc0153de4df6d8b0147898f78312 index 2f5f5030cd8d..7fbe7a90cd46 100644 --- a/explorer/fuzzing/fuzzer_corpus/dca863308d3c3b922bbed6e4118c20261dd38dcb +++ b/explorer/fuzzing/fuzzer_corpus/365c379ec8eddc0153de4df6d8b0147898f78312 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "fst" + name { + name: "fst" + } deduced_parameters { name: "T" type { @@ -66,7 +68,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/368e52fbe545161fff4fffaaf503cb137aad964c b/explorer/fuzzing/fuzzer_corpus/368e52fbe545161fff4fffaaf503cb137aad964c new file mode 100644 index 000000000000..efb71eb41a37 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/368e52fbe545161fff4fffaaf503cb137aad964c @@ -0,0 +1,262 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + function { + name { + name: "Create" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Allocate A" + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "pa" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "A" + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Delete A" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Delete" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "pa" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Return" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/374a512a3276eb89afbb9e17cbefa9c5e7a5c661 b/explorer/fuzzing/fuzzer_corpus/374a512a3276eb89afbb9e17cbefa9c5e7a5c661 new file mode 100644 index 000000000000..b4b8267110fc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/374a512a3276eb89afbb9e17cbefa9c5e7a5c661 @@ -0,0 +1,2810 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "AB" + } + alternatives { + name: "A" + signature { + } + } + alternatives { + name: "B" + signature { + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "AB" + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 6 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 7 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 8 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 9 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 10 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 11 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 12 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 13 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 14 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/375e126dcbeab71b2f4440a50fdb08b48fd8a2ba b/explorer/fuzzing/fuzzer_corpus/375e126dcbeab71b2f4440a50fdb08b48fd8a2ba new file mode 100644 index 000000000000..ba202acfc445 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/375e126dcbeab71b2f4440a50fdb08b48fd8a2ba @@ -0,0 +1,1432 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "ManyTypes" + } + members { + let { + pattern { + generic_binding { + name: "T0" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T1" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T2" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T3" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T4" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T5" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T6" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T7" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Splat" + } + members { + function { + name { + name: "Op" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Splat" + } + } + members { + function { + name { + name: "Op" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + } + } + interface { + identifier { + name: "Splat" + } + } + members { + function { + name { + name: "Op" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Op" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "n" + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + tuple_literal { + fields { + identifier { + name: "v" + } + } + fields { + identifier { + name: "v" + } + } + fields { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "CallSplat" + } + param_pattern { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Splat" + } + } + } + } + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Op" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "DoSplat" + } + param_pattern { + fields { + generic_binding { + name: "M" + type { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + tuple_literal { + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + tuple_literal { + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + tuple_literal { + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + tuple_literal { + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + tuple_literal { + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + tuple_literal { + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + tuple_literal { + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + simple_member_access { + field: "T7" + object { + identifier { + name: "M" + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "T0" + object { + identifier { + name: "M" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "CallSplat" + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "T0" + object { + identifier { + name: "M" + } + } + } + } + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "First" + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "First" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + } + } + interface { + identifier { + name: "First" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + } + init { + identifier { + name: "self" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Op" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "DoFirst" + } + param_pattern { + fields { + generic_binding { + name: "M" + type { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + tuple_literal { + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + tuple_literal { + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + tuple_literal { + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + tuple_literal { + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + tuple_literal { + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + tuple_literal { + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + tuple_literal { + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + simple_member_access { + field: "T0" + object { + identifier { + name: "M" + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "T7" + object { + identifier { + name: "M" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "First" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + tuple_literal { + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + fields { + designator { + name: "T4" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + tuple_literal { + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + fields { + designator { + name: "T2" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + tuple_literal { + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + fields { + designator { + name: "T5" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + tuple_literal { + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + fields { + designator { + name: "T7" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + tuple_literal { + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + fields { + designator { + name: "T3" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + tuple_literal { + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + fields { + designator { + name: "T6" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + tuple_literal { + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + fields { + designator { + name: "T1" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "DoFirst" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "C" + } + } + fields { + call { + function { + identifier { + name: "DoSplat" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "C" + } + } + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/379173df9718b1accd00aacde04ed3abebd0d534 b/explorer/fuzzing/fuzzer_corpus/379173df9718b1accd00aacde04ed3abebd0d534 new file mode 100644 index 000000000000..2775f2280922 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/379173df9718b1accd00aacde04ed3abebd0d534 @@ -0,0 +1,219 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Holder" + } + members { + function { + name { + name: "Get" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "N" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "N" + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "IntLike" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "IntLike" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Get" + object { + call { + function { + identifier { + name: "Holder" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "IntLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/795076cd1e97bdfe7620898d755a7a9771b910b6 b/explorer/fuzzing/fuzzer_corpus/37fcecce96eb5c913f090b2f1f588e3b82c9d1be similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/795076cd1e97bdfe7620898d755a7a9771b910b6 rename to explorer/fuzzing/fuzzer_corpus/37fcecce96eb5c913f090b2f1f588e3b82c9d1be index 65e9506a3899..f26d18043794 100644 --- a/explorer/fuzzing/fuzzer_corpus/795076cd1e97bdfe7620898d755a7a9771b910b6 +++ b/explorer/fuzzing/fuzzer_corpus/37fcecce96eb5c913f090b2f1f588e3b82c9d1be @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "CountUpTo" + name { + name: "CountUpTo" + } param_pattern { fields { binding_pattern { @@ -79,6 +81,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -141,6 +144,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -164,7 +168,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -254,20 +260,15 @@ compilation_unit { while_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "count" - } - } - arguments { - int_literal { - value: 0 - } - } + identifier { + name: "count" + } + } + arguments { + int_literal { + value: 0 } } } @@ -304,6 +305,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -328,6 +330,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0ebcf9c08c4fdce3bfc657c7a6361307b3644f26 b/explorer/fuzzing/fuzzer_corpus/381987301dac8b9aa96f181aa48c844fae12d16b similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/0ebcf9c08c4fdce3bfc657c7a6361307b3644f26 rename to explorer/fuzzing/fuzzer_corpus/381987301dac8b9aa96f181aa48c844fae12d16b index 7bf6725a1d18..76c44a53352c 100644 --- a/explorer/fuzzing/fuzzer_corpus/0ebcf9c08c4fdce3bfc657c7a6361307b3644f26 +++ b/explorer/fuzzing/fuzzer_corpus/381987301dac8b9aa96f181aa48c844fae12d16b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -22,7 +24,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/035e54ed2f88107e49ddd41e5972037ceb5afc72 b/explorer/fuzzing/fuzzer_corpus/381bda5b34a257bd1e4c102676375db80d41b010 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/035e54ed2f88107e49ddd41e5972037ceb5afc72 rename to explorer/fuzzing/fuzzer_corpus/381bda5b34a257bd1e4c102676375db80d41b010 index a2905d590146..95f4e378888c 100644 --- a/explorer/fuzzing/fuzzer_corpus/035e54ed2f88107e49ddd41e5972037ceb5afc72 +++ b/explorer/fuzzing/fuzzer_corpus/381bda5b34a257bd1e4c102676375db80d41b010 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "add1" + name { + name: "add1" + } param_pattern { fields { binding_pattern { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ace1f249968073ff5b77901a6e608532bc73a90f b/explorer/fuzzing/fuzzer_corpus/38a97722170eec0621cab773ae396a26aaa16f4e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/ace1f249968073ff5b77901a6e608532bc73a90f rename to explorer/fuzzing/fuzzer_corpus/38a97722170eec0621cab773ae396a26aaa16f4e index 377e9668ebf5..51b6ddadd76d 100644 --- a/explorer/fuzzing/fuzzer_corpus/ace1f249968073ff5b77901a6e608532bc73a90f +++ b/explorer/fuzzing/fuzzer_corpus/38a97722170eec0621cab773ae396a26aaa16f4e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/397ce3c37880fbb3afbd71b22c813e5c683894aa b/explorer/fuzzing/fuzzer_corpus/397ce3c37880fbb3afbd71b22c813e5c683894aa new file mode 100644 index 000000000000..3de2fa40c7c4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/397ce3c37880fbb3afbd71b22c813e5c683894aa @@ -0,0 +1,87 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + int_literal { + value: 0 + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/39a40fceaecdc65b70e7ce7b7d8a24d51dbf56a4 b/explorer/fuzzing/fuzzer_corpus/39a40fceaecdc65b70e7ce7b7d8a24d51dbf56a4 new file mode 100644 index 000000000000..b5a14e239eb7 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/39a40fceaecdc65b70e7ce7b7d8a24d51dbf56a4 @@ -0,0 +1,151 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Point" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point3D" + } + members { + variable { + binding { + name: "z" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point3D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + name: "z" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + simple_member_access { + field: "a" + object { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3a9d268c66c4487a73972c46d4f0c267eb91817c b/explorer/fuzzing/fuzzer_corpus/3a9d268c66c4487a73972c46d4f0c267eb91817c new file mode 100644 index 000000000000..1c231a9c7413 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3a9d268c66c4487a73972c46d4f0c267eb91817c @@ -0,0 +1,714 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Data" + } + members { + function { + name { + name: "Make" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Data" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "data" + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Destroying {0}" + } + } + fields { + simple_member_access { + field: "data" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "data" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "A" + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "a1" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 8 + } + } + } + } + } + } + } + fields { + name: "a2" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 7 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Destroying 6 (A)" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a1" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a2" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "B" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "base" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "b1" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + fields { + name: "b2" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Destroying 3 (B)" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "b1" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "b2" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "C" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "base" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "B" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "c1" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + fields { + name: "c2" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "Data" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Destroying 0 (C)" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "c1" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "c2" + type { + expression_pattern { + expression { + identifier { + name: "Data" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "C" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3ac0d6c29b482f0e76b42de1534d5bb8f6291d30 b/explorer/fuzzing/fuzzer_corpus/3ac0d6c29b482f0e76b42de1534d5bb8f6291d30 new file mode 100644 index 000000000000..1f8102a8f128 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3ac0d6c29b482f0e76b42de1534d5bb8f6291d30 @@ -0,0 +1,293 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M1" + } + members { + function { + name { + name: "Scale10" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M2" + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + members { + function { + name { + name: "Square" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + mix { + mixin { + identifier { + name: "M2" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 11 + } + } + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "Scale10" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + arguments { + int_literal { + value: 21 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/89056ce6bd8d3ddb225ed9880071ad822e3dd0f2 b/explorer/fuzzing/fuzzer_corpus/3bf47992175e99810f5143f78815d8f7ffc22adb similarity index 69% rename from explorer/fuzzing/fuzzer_corpus/89056ce6bd8d3ddb225ed9880071ad822e3dd0f2 rename to explorer/fuzzing/fuzzer_corpus/3bf47992175e99810f5143f78815d8f7ffc22adb index f46e9ab0e051..f945729e2727 100644 --- a/explorer/fuzzing/fuzzer_corpus/89056ce6bd8d3ddb225ed9880071ad822e3dd0f2 +++ b/explorer/fuzzing/fuzzer_corpus/3bf47992175e99810f5143f78815d8f7ffc22adb @@ -3,14 +3,11 @@ compilation_unit { package_name: "ExplorerTest" } is_api: true - declarations { - class_declaration { - name: "A" - } - } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -25,38 +22,44 @@ compilation_unit { variable_definition { pattern { binding_pattern { - name: "a" + name: "x" type { expression_pattern { expression { - identifier { - name: "A" + int_type_literal { } } } } } } - init { - struct_type_literal { - } - } is_returned: false } } statements { - expression_statement { - expression { + if_statement { + condition { operator { - op: Sub + op: Eq arguments { identifier { - name: "a" + name: "x" } } arguments { int_literal { - value: 1 + value: 0 + } + } + } + } + then_block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } } } } @@ -67,7 +70,7 @@ compilation_unit { return_expression_statement { expression { int_literal { - value: 0 + value: 1 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3ca6afe2242667a99658abe00051a19865e74007 b/explorer/fuzzing/fuzzer_corpus/3ca6afe2242667a99658abe00051a19865e74007 new file mode 100644 index 000000000000..295a8580122e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3ca6afe2242667a99658abe00051a19865e74007 @@ -0,0 +1,362 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "Opt" + } + alternatives { + name: "None" + signature { + } + } + alternatives { + name: "Some" + signature { + fields { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + statement { + block { + statements { + return_expression_statement { + expression { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + is_default: true + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "Some" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/08b7c85df99757a3e2a21da986cc59412e5d4454 b/explorer/fuzzing/fuzzer_corpus/3cae75fc41ad5e693acc6c2235d28c86630d48a8 similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/08b7c85df99757a3e2a21da986cc59412e5d4454 rename to explorer/fuzzing/fuzzer_corpus/3cae75fc41ad5e693acc6c2235d28c86630d48a8 index 2a4b4c56bcbe..52039adb5292 100644 --- a/explorer/fuzzing/fuzzer_corpus/08b7c85df99757a3e2a21da986cc59412e5d4454 +++ b/explorer/fuzzing/fuzzer_corpus/3cae75fc41ad5e693acc6c2235d28c86630d48a8 @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "FrobWith" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "FrobWith" } } } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -58,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6b0e214022e8279a0f00ac842fea663a7d7bc56e b/explorer/fuzzing/fuzzer_corpus/3cf181a4acde0cb7b2cbcf1f4bda95ca1cabd94b similarity index 56% rename from explorer/fuzzing/fuzzer_corpus/6b0e214022e8279a0f00ac842fea663a7d7bc56e rename to explorer/fuzzing/fuzzer_corpus/3cf181a4acde0cb7b2cbcf1f4bda95ca1cabd94b index 2fbbd4c2a7e1..a3cc59843313 100644 --- a/explorer/fuzzing/fuzzer_corpus/6b0e214022e8279a0f00ac842fea663a7d7bc56e +++ b/explorer/fuzzing/fuzzer_corpus/3cf181a4acde0cb7b2cbcf1f4bda95ca1cabd94b @@ -1,66 +1,13 @@ compilation_unit { package_statement { - package_name: "Foo" + package_name: "ExplorerTest" } is_api: true - declarations { - interface { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } declarations { class_declaration { - name: "X" + name { + name: "TypeLike" + } members { impl { kind: InternalImpl @@ -70,13 +17,27 @@ compilation_unit { } } interface { - identifier { - name: "A" + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + type_type_literal { + } + } + } + } } } members { function { - name: "F" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -92,26 +53,11 @@ compilation_unit { } } param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } } return_term { kind: Expression type { - identifier { - name: "Self" + type_type_literal { } } } @@ -119,35 +65,7 @@ compilation_unit { statements { return_expression_statement { expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } + int_type_literal { } } } @@ -158,13 +76,25 @@ compilation_unit { } } members { - variable { - binding { - name: "n" + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression type { - expression_pattern { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { expression { - int_type_literal { + struct_literal { } } } @@ -176,13 +106,29 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { kind: Expression type { - int_type_literal { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } } } } @@ -191,12 +137,53 @@ compilation_unit { variable_definition { pattern { binding_pattern { - name: "v" + name: "x" type { expression_pattern { expression { - identifier { - name: "X" + struct_type_literal { + fields { + name: "a" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "b" + expression { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } } } } @@ -206,38 +193,15 @@ compilation_unit { init { struct_literal { fields { - name: "n" + name: "a" expression { int_literal { value: 1 } } } - } - } - is_returned: false - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { fields { - name: "n" + name: "b" expression { int_literal { value: 2 @@ -252,36 +216,24 @@ compilation_unit { statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "A" - } - } - } - } + operator { + op: Add + arguments { + simple_member_access { + field: "a" + object { + identifier { + name: "x" } } - argument { - tuple_literal { - fields { - identifier { - name: "w" - } - } + } + } + arguments { + simple_member_access { + field: "b" + object { + identifier { + name: "x" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3dce35e13b36c3f9ea7657ac00237fd3ad8d42c7 b/explorer/fuzzing/fuzzer_corpus/3dce35e13b36c3f9ea7657ac00237fd3ad8d42c7 new file mode 100644 index 000000000000..2557d9a0a733 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3dce35e13b36c3f9ea7657ac00237fd3ad8d42c7 @@ -0,0 +1,126 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3dd42e4c74a7d422abf4795e78822f74acd02bbc b/explorer/fuzzing/fuzzer_corpus/3dd42e4c74a7d422abf4795e78822f74acd02bbc new file mode 100644 index 000000000000..f0bc7c075dbd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3dd42e4c74a7d422abf4795e78822f74acd02bbc @@ -0,0 +1,166 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Point" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point3D" + } + members { + variable { + binding { + name: "z" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point3D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + name: "z" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + simple_member_access { + field: "a" + object { + identifier { + name: "p" + } + } + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5937de3cc1592f75245162467eb1a3aa512285f8 b/explorer/fuzzing/fuzzer_corpus/3e0db6c59759b3afcfef5e8ed5766dc316ff6d5f similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/5937de3cc1592f75245162467eb1a3aa512285f8 rename to explorer/fuzzing/fuzzer_corpus/3e0db6c59759b3afcfef5e8ed5766dc316ff6d5f index 1cde5378bc52..b69e0465baa6 100644 --- a/explorer/fuzzing/fuzzer_corpus/5937de3cc1592f75245162467eb1a3aa512285f8 +++ b/explorer/fuzzing/fuzzer_corpus/3e0db6c59759b3afcfef5e8ed5766dc316ff6d5f @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "FrobWith" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "FrobWith" } } } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -64,7 +61,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3e637ff7352c6663376f6e223ec1b9cfd164e7b8 b/explorer/fuzzing/fuzzer_corpus/3e637ff7352c6663376f6e223ec1b9cfd164e7b8 new file mode 100644 index 000000000000..52770de78506 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3e637ff7352c6663376f6e223ec1b9cfd164e7b8 @@ -0,0 +1,1781 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "ListElement" + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "ListElement" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "element" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + fields { + name: "next" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "set" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + identifier { + name: "value" + } + } + op: Plain + } + } + } + } + } + members { + variable { + binding { + name: "element" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "next" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "List" + } + members { + function { + name { + name: "Create" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "List" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "next" + expression { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "insert" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "value" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + if_statement { + condition { + operator { + op: Not + arguments { + call { + function { + simple_member_access { + field: "HasValue" + object { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + then_block { + statements { + assign { + lhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "ListElement" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + op: Plain + } + } + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "iter" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "node" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "node" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + body { + statements { + assign { + lhs { + identifier { + name: "iter" + } + } + rhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "node" + } + } + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + identifier { + name: "node" + } + } + rhs { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + op: Plain + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "New" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "ListElement" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "set" + object { + operator { + op: Deref + arguments { + identifier { + name: "v" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "print" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "iter" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "next" + object { + identifier { + name: "self" + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "node" + type { + auto_pattern { + } + } + } + } + init { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Get" + object { + simple_member_access { + field: "element" + object { + identifier { + name: "node" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "node_ptr" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "iter" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "iter" + } + } + rhs { + simple_member_access { + field: "next" + object { + identifier { + name: "node" + } + } + } + } + op: Plain + } + } + } + } + } + } + } + } + members { + function { + name { + name: "clean" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "head" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "head" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "tmp" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "head" + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "head" + } + } + rhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "head" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Delete" + object { + identifier { + name: "heap" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "tmp" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "next" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + op: Plain + } + } + } + } + } + members { + variable { + binding { + name: "next" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "ListElement" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "list" + type { + expression_pattern { + expression { + identifier { + name: "List" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "List" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "print" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "clean" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "print" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "insert" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "print" + object { + identifier { + name: "list" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6b4cae351ac5c302b8b1fbd1d51d3a78ecd66ff5 b/explorer/fuzzing/fuzzer_corpus/3ecfcb05c11917a4b4b669bf139000009610d631 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/6b4cae351ac5c302b8b1fbd1d51d3a78ecd66ff5 rename to explorer/fuzzing/fuzzer_corpus/3ecfcb05c11917a4b4b669bf139000009610d631 index ef5194301eab..c95f1114f28e 100644 --- a/explorer/fuzzing/fuzzer_corpus/6b4cae351ac5c302b8b1fbd1d51d3a78ecd66ff5 +++ b/explorer/fuzzing/fuzzer_corpus/3ecfcb05c11917a4b4b669bf139000009610d631 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -76,7 +78,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0645e2adb589c5d5c2ea84e31b87db1ee74034ee b/explorer/fuzzing/fuzzer_corpus/3f41751cfdcd69f6896ea1ffd616d2f49c7d4471 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/0645e2adb589c5d5c2ea84e31b87db1ee74034ee rename to explorer/fuzzing/fuzzer_corpus/3f41751cfdcd69f6896ea1ffd616d2f49c7d4471 index 29e8dfad152c..74b571c83d09 100644 --- a/explorer/fuzzing/fuzzer_corpus/0645e2adb589c5d5c2ea84e31b87db1ee74034ee +++ b/explorer/fuzzing/fuzzer_corpus/3f41751cfdcd69f6896ea1ffd616d2f49c7d4471 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point1" + name { + name: "Point1" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -257,7 +260,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { class_declaration { - name: "Point2" + name { + name: "Point2" + } members { variable { binding { @@ -405,7 +412,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -534,7 +543,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -656,7 +667,9 @@ compilation_unit { } declarations { function { - name: "ScaleGeneric" + name { + name: "ScaleGeneric" + } deduced_parameters { name: "U" type { @@ -735,7 +748,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -908,7 +923,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/72dc9d2c26aed0b96a46e93c8e3003cfda8ade56 b/explorer/fuzzing/fuzzer_corpus/3f88413ff6071524f5b527a5cabcbda51d8266b7 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/72dc9d2c26aed0b96a46e93c8e3003cfda8ade56 rename to explorer/fuzzing/fuzzer_corpus/3f88413ff6071524f5b527a5cabcbda51d8266b7 index a94b8b711fe6..e718c2d39410 100644 --- a/explorer/fuzzing/fuzzer_corpus/72dc9d2c26aed0b96a46e93c8e3003cfda8ade56 +++ b/explorer/fuzzing/fuzzer_corpus/3f88413ff6071524f5b527a5cabcbda51d8266b7 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -150,7 +151,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -259,7 +262,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -508,7 +515,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/400f23d9237b6a8fd7977731dd46469197cd6814 b/explorer/fuzzing/fuzzer_corpus/400f23d9237b6a8fd7977731dd46469197cd6814 new file mode 100644 index 000000000000..af12144b010a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/400f23d9237b6a8fd7977731dd46469197cd6814 @@ -0,0 +1,175 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/407e3821284278185dec9cc60a0f8222519a091c b/explorer/fuzzing/fuzzer_corpus/407e3821284278185dec9cc60a0f8222519a091c new file mode 100644 index 000000000000..94e87c5e9e4c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/407e3821284278185dec9cc60a0f8222519a091c @@ -0,0 +1,515 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + bool_literal { + value: true + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 4 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + bool_literal { + value: true + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + break_statement { + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "i" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + statements { + while_statement { + condition { + operator { + op: Less + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 8 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 7 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 6 + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "i" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + statements { + continue_statement { + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "i" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/408035d700db7dfd077e3d2dc58c3a20c2a52a5a b/explorer/fuzzing/fuzzer_corpus/408035d700db7dfd077e3d2dc58c3a20c2a52a5a new file mode 100644 index 000000000000..34c66508cfa6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/408035d700db7dfd077e3d2dc58c3a20c2a52a5a @@ -0,0 +1,420 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + members { + function { + name { + name: "Bar" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + members { + function { + name { + name: "Bar" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c).a: {0}" + } + } + fields { + simple_member_access { + field: "a" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c).Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c).Bar(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Bar" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/88221aed2521c44be995578b98e3e1c6dfacd30f b/explorer/fuzzing/fuzzer_corpus/40838f5f1f5c09fadb8c3d2cf2fd228ba1e4cc52 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/88221aed2521c44be995578b98e3e1c6dfacd30f rename to explorer/fuzzing/fuzzer_corpus/40838f5f1f5c09fadb8c3d2cf2fd228ba1e4cc52 index ff40c5152d76..05933a2ada16 100644 --- a/explorer/fuzzing/fuzzer_corpus/88221aed2521c44be995578b98e3e1c6dfacd30f +++ b/explorer/fuzzing/fuzzer_corpus/40838f5f1f5c09fadb8c3d2cf2fd228ba1e4cc52 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -101,6 +103,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/723a5362373c030d6b12d7d5dcb5441cb50b328a b/explorer/fuzzing/fuzzer_corpus/40e638bcb8108b0d99231cefa3dee0010b5e1e85 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/723a5362373c030d6b12d7d5dcb5441cb50b328a rename to explorer/fuzzing/fuzzer_corpus/40e638bcb8108b0d99231cefa3dee0010b5e1e85 index fe606d44b320..b3d9d17b77d6 100644 --- a/explorer/fuzzing/fuzzer_corpus/723a5362373c030d6b12d7d5dcb5441cb50b328a +++ b/explorer/fuzzing/fuzzer_corpus/40e638bcb8108b0d99231cefa3dee0010b5e1e85 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "GetX" + name { + name: "GetX" + } param_pattern { fields { binding_pattern { @@ -84,7 +88,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9d0844195df15fbf54aadbf5404356d513711233 b/explorer/fuzzing/fuzzer_corpus/44355e6940769c65372ab6cf2ef9b69bbc4b96db similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/9d0844195df15fbf54aadbf5404356d513711233 rename to explorer/fuzzing/fuzzer_corpus/44355e6940769c65372ab6cf2ef9b69bbc4b96db index c70bbd5c4348..e6b698cc60f6 100644 --- a/explorer/fuzzing/fuzzer_corpus/9d0844195df15fbf54aadbf5404356d513711233 +++ b/explorer/fuzzing/fuzzer_corpus/44355e6940769c65372ab6cf2ef9b69bbc4b96db @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b664d182374c6fa528a34f78cbcbfe1ff2f075b9 b/explorer/fuzzing/fuzzer_corpus/4494e1b83d1d6915c3cd6152fd2a520e407d7bba similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/b664d182374c6fa528a34f78cbcbfe1ff2f075b9 rename to explorer/fuzzing/fuzzer_corpus/4494e1b83d1d6915c3cd6152fd2a520e407d7bba index a81a091fdb49..a7d5f5243da5 100644 --- a/explorer/fuzzing/fuzzer_corpus/b664d182374c6fa528a34f78cbcbfe1ff2f075b9 +++ b/explorer/fuzzing/fuzzer_corpus/4494e1b83d1d6915c3cd6152fd2a520e407d7bba @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "snd" + name { + name: "snd" + } deduced_parameters { name: "T" type { @@ -65,7 +67,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/44f5a8dbdee9c97ccc37e2d0749d221109b0fe7a b/explorer/fuzzing/fuzzer_corpus/44f5a8dbdee9c97ccc37e2d0749d221109b0fe7a new file mode 100644 index 000000000000..425c151915e5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/44f5a8dbdee9c97ccc37e2d0749d221109b0fe7a @@ -0,0 +1,134 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + bool_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + identifier { + name: "b" + } + } + clauses { + pattern { + expression_pattern { + expression { + bool_literal { + value: false + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + bool_literal { + value: true + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + bool_literal { + value: true + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/18e1ca7823d8ea4621b623c8c0cf64d94a4e61ef b/explorer/fuzzing/fuzzer_corpus/45416ee9fe788dffe4b9af83d322ae472dd1da1e similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/18e1ca7823d8ea4621b623c8c0cf64d94a4e61ef rename to explorer/fuzzing/fuzzer_corpus/45416ee9fe788dffe4b9af83d322ae472dd1da1e index d591c5ea8dd3..3517a1112fa5 100644 --- a/explorer/fuzzing/fuzzer_corpus/18e1ca7823d8ea4621b623c8c0cf64d94a4e61ef +++ b/explorer/fuzzing/fuzzer_corpus/45416ee9fe788dffe4b9af83d322ae472dd1da1e @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -48,6 +50,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/45df1e092490ea3bc95852e805e140585fe406bc b/explorer/fuzzing/fuzzer_corpus/45df1e092490ea3bc95852e805e140585fe406bc deleted file mode 100644 index 32d3789fb824..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/45df1e092490ea3bc95852e805e140585fe406bc +++ /dev/null @@ -1,152 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - function { - name: "DoMod" - deduced_parameters { - name: "T" - type { - where { - base { - call { - function { - identifier { - name: "ModWith" - } - } - argument { - tuple_literal { - fields { - designator { - name: "Self" - } - } - } - } - } - } - clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { - designator { - name: "Self" - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_expression_statement { - expression { - operator { - op: Mod - arguments { - identifier { - name: "x" - } - } - arguments { - identifier { - name: "y" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_expression_statement { - expression { - call { - function { - identifier { - name: "DoMod" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 4 - } - } - fields { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/45e3a43e80f1bc62c0ff5794fa4d9c6e8f769f24 b/explorer/fuzzing/fuzzer_corpus/45e3a43e80f1bc62c0ff5794fa4d9c6e8f769f24 new file mode 100644 index 000000000000..9ff30d275f2e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/45e3a43e80f1bc62c0ff5794fa4d9c6e8f769f24 @@ -0,0 +1,361 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "Opt" + } + alternatives { + name: "None" + signature { + } + } + alternatives { + name: "Some" + signature { + fields { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "m" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "m" + } + } + arguments { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "Some" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4636dd7b4d3177596bde1c7cc2478a45ba1315a3 b/explorer/fuzzing/fuzzer_corpus/4636dd7b4d3177596bde1c7cc2478a45ba1315a3 new file mode 100644 index 000000000000..e90b6ed3c603 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4636dd7b4d3177596bde1c7cc2478a45ba1315a3 @@ -0,0 +1,348 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR B {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR C {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/84f58bae012424a5461e9bd7c33efd8cac43a70f b/explorer/fuzzing/fuzzer_corpus/46e0b7c8cbc5d0e7570bcbe89128f418839b9cd6 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/84f58bae012424a5461e9bd7c33efd8cac43a70f rename to explorer/fuzzing/fuzzer_corpus/46e0b7c8cbc5d0e7570bcbe89128f418839b9cd6 index a71ed4d0aec0..ea6f7616311e 100644 --- a/explorer/fuzzing/fuzzer_corpus/84f58bae012424a5461e9bd7c33efd8cac43a70f +++ b/explorer/fuzzing/fuzzer_corpus/46e0b7c8cbc5d0e7570bcbe89128f418839b9cd6 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -261,7 +264,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -410,7 +415,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d86d0b8b87063b02e6d3c9c886d7c71e74bcccf6 b/explorer/fuzzing/fuzzer_corpus/478394f347dda8510b53f7e921203c5886a7e8e6 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/d86d0b8b87063b02e6d3c9c886d7c71e74bcccf6 rename to explorer/fuzzing/fuzzer_corpus/478394f347dda8510b53f7e921203c5886a7e8e6 index 665d169b6f9b..7fb30f7adde9 100644 --- a/explorer/fuzzing/fuzzer_corpus/d86d0b8b87063b02e6d3c9c886d7c71e74bcccf6 +++ b/explorer/fuzzing/fuzzer_corpus/478394f347dda8510b53f7e921203c5886a7e8e6 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e5099f26fef768896d0b4552d61f777acd24b5a1 b/explorer/fuzzing/fuzzer_corpus/4860d253a5d68ec0c9f8ee444b8d380d31a6216e similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/e5099f26fef768896d0b4552d61f777acd24b5a1 rename to explorer/fuzzing/fuzzer_corpus/4860d253a5d68ec0c9f8ee444b8d380d31a6216e index 6aab56546862..36f2a9c7e620 100644 --- a/explorer/fuzzing/fuzzer_corpus/e5099f26fef768896d0b4552d61f777acd24b5a1 +++ b/explorer/fuzzing/fuzzer_corpus/4860d253a5d68ec0c9f8ee444b8d380d31a6216e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/cdb8d73edbd3b87a9102787bd474da119619744e b/explorer/fuzzing/fuzzer_corpus/48caa4aa710abcf73fe7b82ab8fd9fbd10f52a7d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/cdb8d73edbd3b87a9102787bd474da119619744e rename to explorer/fuzzing/fuzzer_corpus/48caa4aa710abcf73fe7b82ab8fd9fbd10f52a7d index 962f2233fdaf..46aefeee972b 100644 --- a/explorer/fuzzing/fuzzer_corpus/cdb8d73edbd3b87a9102787bd474da119619744e +++ b/explorer/fuzzing/fuzzer_corpus/48caa4aa710abcf73fe7b82ab8fd9fbd10f52a7d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Choice" + name { + name: "Choice" + } alternatives { name: "Alternative" signature { @@ -15,10 +17,14 @@ compilation_unit { } declarations { class_declaration { - name: "Class" + name { + name: "Class" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { fields { binding_pattern { @@ -68,10 +74,14 @@ compilation_unit { } declarations { interface { - name: "Interface" + name { + name: "Interface" + } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -98,24 +108,12 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "AnotherInterface" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "AnotherInterface" } } } @@ -133,7 +131,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -197,7 +197,9 @@ compilation_unit { } declarations { function { - name: "GetStruct" + name { + name: "GetStruct" + } param_pattern { } return_term { @@ -228,7 +230,9 @@ compilation_unit { } declarations { function { - name: "GetChoice" + name { + name: "GetChoice" + } param_pattern { } return_term { @@ -253,7 +257,9 @@ compilation_unit { } declarations { function { - name: "GetClass" + name { + name: "GetClass" + } param_pattern { } return_term { @@ -278,7 +284,9 @@ compilation_unit { } declarations { function { - name: "GetInterface" + name { + name: "GetInterface" + } param_pattern { } return_term { @@ -303,7 +311,9 @@ compilation_unit { } declarations { function { - name: "GetConstraint" + name { + name: "GetConstraint" + } param_pattern { } return_term { @@ -338,7 +348,9 @@ compilation_unit { } declarations { function { - name: "TestStruct" + name { + name: "TestStruct" + } param_pattern { } return_term { @@ -454,7 +466,9 @@ compilation_unit { } declarations { function { - name: "TestChoice" + name { + name: "TestChoice" + } param_pattern { } return_term { @@ -586,7 +600,9 @@ compilation_unit { } declarations { function { - name: "TestClass" + name { + name: "TestClass" + } param_pattern { } return_term { @@ -667,7 +683,9 @@ compilation_unit { } declarations { function { - name: "TestInterface" + name { + name: "TestInterface" + } param_pattern { } return_term { @@ -775,7 +793,9 @@ compilation_unit { } declarations { function { - name: "TestConstraint" + name { + name: "TestConstraint" + } param_pattern { } return_term { @@ -883,7 +903,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4972578fc0a523302c5bc9f42c2fdcae619712fc b/explorer/fuzzing/fuzzer_corpus/4972578fc0a523302c5bc9f42c2fdcae619712fc new file mode 100644 index 000000000000..0b0566cc71af --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4972578fc0a523302c5bc9f42c2fdcae619712fc @@ -0,0 +1,61 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + inc_dec { + operand { + identifier { + name: "x" + } + } + is_increment: true + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4a22b3794abf57497ad89d05995434a0aa7d0f47 b/explorer/fuzzing/fuzzer_corpus/4a22b3794abf57497ad89d05995434a0aa7d0f47 new file mode 100644 index 000000000000..81082e03a603 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4a22b3794abf57497ad89d05995434a0aa7d0f47 @@ -0,0 +1,264 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "a" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR C {0}" + } + } + fields { + simple_member_access { + field: "c" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + name: "c" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/fc019aea57598724818b83ef35c1fdc60a520542 b/explorer/fuzzing/fuzzer_corpus/4a2ff94c1916c48655f498955011a06fbcdf133e similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/fc019aea57598724818b83ef35c1fdc60a520542 rename to explorer/fuzzing/fuzzer_corpus/4a2ff94c1916c48655f498955011a06fbcdf133e index ad269982a488..82882c7880f1 100644 --- a/explorer/fuzzing/fuzzer_corpus/fc019aea57598724818b83ef35c1fdc60a520542 +++ b/explorer/fuzzing/fuzzer_corpus/4a2ff94c1916c48655f498955011a06fbcdf133e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -156,6 +158,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/f8e82fe960f00a94db12d993ddf332f5cdf1717b b/explorer/fuzzing/fuzzer_corpus/4aa3752736e554261748faa2a497272dac8fd2b8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/f8e82fe960f00a94db12d993ddf332f5cdf1717b rename to explorer/fuzzing/fuzzer_corpus/4aa3752736e554261748faa2a497272dac8fd2b8 index 53cee216ee1a..1a5a2f3788c8 100644 --- a/explorer/fuzzing/fuzzer_corpus/f8e82fe960f00a94db12d993ddf332f5cdf1717b +++ b/explorer/fuzzing/fuzzer_corpus/4aa3752736e554261748faa2a497272dac8fd2b8 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "X" + name { + name: "X" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -106,7 +110,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4ad65277ecd7e0adcd7692e02df993d459ce4eb1 b/explorer/fuzzing/fuzzer_corpus/4ad65277ecd7e0adcd7692e02df993d459ce4eb1 new file mode 100644 index 000000000000..0ba34c28c72c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4ad65277ecd7e0adcd7692e02df993d459ce4eb1 @@ -0,0 +1,162 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + identifier { + name: "n" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d40edaf63b231abdad442910a80fe73b4b138e45 b/explorer/fuzzing/fuzzer_corpus/4c583e243d825ce8abb6144c1642ea8160043283 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/d40edaf63b231abdad442910a80fe73b4b138e45 rename to explorer/fuzzing/fuzzer_corpus/4c583e243d825ce8abb6144c1642ea8160043283 index 2027d4393563..86a7c52ad0ca 100644 --- a/explorer/fuzzing/fuzzer_corpus/d40edaf63b231abdad442910a80fe73b4b138e45 +++ b/explorer/fuzzing/fuzzer_corpus/4c583e243d825ce8abb6144c1642ea8160043283 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "IntLike" + name { + name: "IntLike" + } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -34,13 +38,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -57,7 +54,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -97,7 +96,9 @@ compilation_unit { } declarations { function { - name: "add" + name { + name: "add" + } deduced_parameters { name: "T" type { @@ -324,7 +325,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4ca78730c3a34f5efe521f89320a7b050ce7f349 b/explorer/fuzzing/fuzzer_corpus/4ca78730c3a34f5efe521f89320a7b050ce7f349 new file mode 100644 index 000000000000..76e5d30631ce --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4ca78730c3a34f5efe521f89320a7b050ce7f349 @@ -0,0 +1,22 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9e0cb757c14e4d9591971f16b19a90d4381e6c88 b/explorer/fuzzing/fuzzer_corpus/4db783997772cefd555355a807a90e04e414b988 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/9e0cb757c14e4d9591971f16b19a90d4381e6c88 rename to explorer/fuzzing/fuzzer_corpus/4db783997772cefd555355a807a90e04e414b988 index 9fd20d193cd5..4c173ad00f44 100644 --- a/explorer/fuzzing/fuzzer_corpus/9e0cb757c14e4d9591971f16b19a90d4381e6c88 +++ b/explorer/fuzzing/fuzzer_corpus/4db783997772cefd555355a807a90e04e414b988 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4de145ab28e280ab01528564fe130659272c2e52 b/explorer/fuzzing/fuzzer_corpus/4de145ab28e280ab01528564fe130659272c2e52 new file mode 100644 index 000000000000..88351056b003 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4de145ab28e280ab01528564fe130659272c2e52 @@ -0,0 +1,388 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Container" + } + members { + let { + pattern { + generic_binding { + name: "Element" + type { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Front" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Element" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Container" + } + } + clauses { + rewrite { + member_name: "Element" + replacement { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "Element" + object { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Front" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "B" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Container" + } + } + clauses { + equals { + lhs { + designator { + name: "Element" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "Element" + object { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + interface { + where { + base { + identifier { + name: "Container" + } + } + clauses { + rewrite { + member_name: "Element" + replacement { + int_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Front" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + init { + identifier { + name: "self" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e843c2ddb386ac89d708928221322340216fbf16 b/explorer/fuzzing/fuzzer_corpus/4e3d3da4c4bcb8b1912b9d0e247c3d291299b94d similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/e843c2ddb386ac89d708928221322340216fbf16 rename to explorer/fuzzing/fuzzer_corpus/4e3d3da4c4bcb8b1912b9d0e247c3d291299b94d index 7937990660ea..d466878fe637 100644 --- a/explorer/fuzzing/fuzzer_corpus/e843c2ddb386ac89d708928221322340216fbf16 +++ b/explorer/fuzzing/fuzzer_corpus/4e3d3da4c4bcb8b1912b9d0e247c3d291299b94d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ad6c22cb6a98a9d29bf772b52a71e693ccdf5fc7 b/explorer/fuzzing/fuzzer_corpus/4ea4b1a51c61f79c9f6b5b0ebd03454662abd1cd similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/ad6c22cb6a98a9d29bf772b52a71e693ccdf5fc7 rename to explorer/fuzzing/fuzzer_corpus/4ea4b1a51c61f79c9f6b5b0ebd03454662abd1cd index a4da9755d42e..ecf23150de16 100644 --- a/explorer/fuzzing/fuzzer_corpus/ad6c22cb6a98a9d29bf772b52a71e693ccdf5fc7 +++ b/explorer/fuzzing/fuzzer_corpus/4ea4b1a51c61f79c9f6b5b0ebd03454662abd1cd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f5d01f3ac84658786ef4f6f6df1174054956c4f0 b/explorer/fuzzing/fuzzer_corpus/5007f895491a8fd45ef5bd8da0a079938bf4f7f7 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/f5d01f3ac84658786ef4f6f6df1174054956c4f0 rename to explorer/fuzzing/fuzzer_corpus/5007f895491a8fd45ef5bd8da0a079938bf4f7f7 index b14f666194d3..d06355ce71f5 100644 --- a/explorer/fuzzing/fuzzer_corpus/f5d01f3ac84658786ef4f6f6df1174054956c4f0 +++ b/explorer/fuzzing/fuzzer_corpus/5007f895491a8fd45ef5bd8da0a079938bf4f7f7 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Class" + name { + name: "Class" + } members { variable { binding { @@ -25,7 +27,9 @@ compilation_unit { } declarations { class_declaration { - name: "GenericClass" + name { + name: "GenericClass" + } members { variable { binding { @@ -57,10 +61,14 @@ compilation_unit { } declarations { interface { - name: "Interface" + name { + name: "Interface" + } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { } return_term { @@ -73,21 +81,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "GenericInterface" + name { + name: "GenericInterface" + } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { } return_term { @@ -109,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { alias { - name: "ClassAlias" + name { + name: "ClassAlias" + } target { identifier { name: "Class" @@ -130,7 +130,9 @@ compilation_unit { } declarations { alias { - name: "GenericClassAlias" + name { + name: "GenericClassAlias" + } target { identifier { name: "GenericClass" @@ -140,7 +142,9 @@ compilation_unit { } declarations { alias { - name: "ClassSpecializationAlias" + name { + name: "ClassSpecializationAlias" + } target { call { function { @@ -162,7 +166,9 @@ compilation_unit { } declarations { alias { - name: "InterfaceAlias" + name { + name: "InterfaceAlias" + } target { identifier { name: "Interface" @@ -172,7 +178,9 @@ compilation_unit { } declarations { alias { - name: "GenericInterfaceAlias" + name { + name: "GenericInterfaceAlias" + } target { identifier { name: "GenericInterface" @@ -182,7 +190,9 @@ compilation_unit { } declarations { alias { - name: "InterfaceSpecializationAlias" + name { + name: "InterfaceSpecializationAlias" + } target { call { function { @@ -217,7 +227,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { } return_term { @@ -265,7 +277,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { } return_term { @@ -317,7 +331,9 @@ compilation_unit { } declarations { alias { - name: "S" + name { + name: "S" + } target { struct_type_literal { fields { @@ -372,7 +388,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { } return_term { @@ -445,7 +463,9 @@ compilation_unit { } declarations { function { - name: "CheckImplementsInterface" + name { + name: "CheckImplementsInterface" + } deduced_parameters { name: "T" type { @@ -506,7 +526,9 @@ compilation_unit { } declarations { function { - name: "CheckImplementsGenericInterface_i32" + name { + name: "CheckImplementsGenericInterface_i32" + } deduced_parameters { name: "T" type { @@ -587,7 +609,9 @@ compilation_unit { } declarations { function { - name: "CheckImplementsGenericInterface_struct" + name { + name: "CheckImplementsGenericInterface_struct" + } deduced_parameters { name: "T" type { @@ -670,7 +694,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -737,6 +763,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/3f3fe532301f116635e82cab7ac1f91e1fbcd462 b/explorer/fuzzing/fuzzer_corpus/504ed50b0973afc1fdb432d2dd0798ae8705a997 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3f3fe532301f116635e82cab7ac1f91e1fbcd462 rename to explorer/fuzzing/fuzzer_corpus/504ed50b0973afc1fdb432d2dd0798ae8705a997 index 63343fab24cd..7ae123af09a7 100644 --- a/explorer/fuzzing/fuzzer_corpus/3f3fe532301f116635e82cab7ac1f91e1fbcd462 +++ b/explorer/fuzzing/fuzzer_corpus/504ed50b0973afc1fdb432d2dd0798ae8705a997 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -98,7 +100,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/65eeb4a1b5f0635f073ebda94b44f1cf51e04892 b/explorer/fuzzing/fuzzer_corpus/50afabdf6bcaac0128c38e8b07aaaf0139caa5b6 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/65eeb4a1b5f0635f073ebda94b44f1cf51e04892 rename to explorer/fuzzing/fuzzer_corpus/50afabdf6bcaac0128c38e8b07aaaf0139caa5b6 index 396c63748859..fd43fca03da0 100644 --- a/explorer/fuzzing/fuzzer_corpus/65eeb4a1b5f0635f073ebda94b44f1cf51e04892 +++ b/explorer/fuzzing/fuzzer_corpus/50afabdf6bcaac0128c38e8b07aaaf0139caa5b6 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "X" + name { + name: "X" + } type_params { fields { generic_binding { @@ -21,7 +23,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -68,7 +72,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/50f6f5d13beb185404eccd575bc75cae3abb612a b/explorer/fuzzing/fuzzer_corpus/50f6f5d13beb185404eccd575bc75cae3abb612a new file mode 100644 index 000000000000..31d3b6b13154 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/50f6f5d13beb185404eccd575bc75cae3abb612a @@ -0,0 +1,187 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.a={0}" + } + } + fields { + simple_member_access { + field: "a" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.b={0}" + } + } + fields { + simple_member_access { + field: "b" + object { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/10ebe2c0d5ba72c214e7af06a5d987c364c53165 b/explorer/fuzzing/fuzzer_corpus/5258b94636d20581bd507b9cf0e0da61228647b4 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/10ebe2c0d5ba72c214e7af06a5d987c364c53165 rename to explorer/fuzzing/fuzzer_corpus/5258b94636d20581bd507b9cf0e0da61228647b4 index 8f77ec2806ca..c1ebe999c574 100644 --- a/explorer/fuzzing/fuzzer_corpus/10ebe2c0d5ba72c214e7af06a5d987c364c53165 +++ b/explorer/fuzzing/fuzzer_corpus/5258b94636d20581bd507b9cf0e0da61228647b4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d9002618afddff9f25792176b4862fa996bea031 b/explorer/fuzzing/fuzzer_corpus/528816469d00b09f7410035a7f4d79d5e32934be similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/d9002618afddff9f25792176b4862fa996bea031 rename to explorer/fuzzing/fuzzer_corpus/528816469d00b09f7410035a7f4d79d5e32934be index 449a4a724dc8..527f2c97adfe 100644 --- a/explorer/fuzzing/fuzzer_corpus/d9002618afddff9f25792176b4862fa996bea031 +++ b/explorer/fuzzing/fuzzer_corpus/528816469d00b09f7410035a7f4d79d5e32934be @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/52f893245ce034fe614a546e3e29b07596f96d41 b/explorer/fuzzing/fuzzer_corpus/52f893245ce034fe614a546e3e29b07596f96d41 new file mode 100644 index 000000000000..49956fd996e7 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/52f893245ce034fe614a546e3e29b07596f96d41 @@ -0,0 +1,40 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3b895b362978e75294f542b95e4814a6a8839cb4 b/explorer/fuzzing/fuzzer_corpus/5318fd00c25f2fd65c5e8d90291bb477ea229fdb similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/3b895b362978e75294f542b95e4814a6a8839cb4 rename to explorer/fuzzing/fuzzer_corpus/5318fd00c25f2fd65c5e8d90291bb477ea229fdb index e6fa39d60d33..0f3c0bf09fc4 100644 --- a/explorer/fuzzing/fuzzer_corpus/3b895b362978e75294f542b95e4814a6a8839cb4 +++ b/explorer/fuzzing/fuzzer_corpus/5318fd00c25f2fd65c5e8d90291bb477ea229fdb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -30,7 +32,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/532a630b4756515f297a4c2aaaa9c0f3b87e65e9 b/explorer/fuzzing/fuzzer_corpus/532a630b4756515f297a4c2aaaa9c0f3b87e65e9 new file mode 100644 index 000000000000..68b6cf8d540c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/532a630b4756515f297a4c2aaaa9c0f3b87e65e9 @@ -0,0 +1,102 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "N" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7cdd8b69b3f99228e90f6e9f1547f37450426126 b/explorer/fuzzing/fuzzer_corpus/539a7012375a93a28857f6241de424b0e03247c4 similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/7cdd8b69b3f99228e90f6e9f1547f37450426126 rename to explorer/fuzzing/fuzzer_corpus/539a7012375a93a28857f6241de424b0e03247c4 index ffb054a00352..ed1879c3e999 100644 --- a/explorer/fuzzing/fuzzer_corpus/7cdd8b69b3f99228e90f6e9f1547f37450426126 +++ b/explorer/fuzzing/fuzzer_corpus/539a7012375a93a28857f6241de424b0e03247c4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { alias { - name: "A" + name { + name: "A" + } target { int_literal { value: 5 @@ -15,7 +17,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ba772248abb6f28baf7db6a8a19e6d84bad88039 b/explorer/fuzzing/fuzzer_corpus/53aa7568a4f7b1c0c6721ef5a3a39737131a6a67 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ba772248abb6f28baf7db6a8a19e6d84bad88039 rename to explorer/fuzzing/fuzzer_corpus/53aa7568a4f7b1c0c6721ef5a3a39737131a6a67 index 1c06f5024025..30af1dff2957 100644 --- a/explorer/fuzzing/fuzzer_corpus/ba772248abb6f28baf7db6a8a19e6d84bad88039 +++ b/explorer/fuzzing/fuzzer_corpus/53aa7568a4f7b1c0c6721ef5a3a39737131a6a67 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Bad" + name { + name: "Bad" + } deduced_parameters { name: "T" type { @@ -52,7 +54,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/54c240f4335e37fea9731487a93befcf4f0ccf8c b/explorer/fuzzing/fuzzer_corpus/54c240f4335e37fea9731487a93befcf4f0ccf8c new file mode 100644 index 000000000000..9064b8d809ab --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/54c240f4335e37fea9731487a93befcf4f0ccf8c @@ -0,0 +1,112 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + members { + function { + name { + qualifiers: "Operations" + name: "Square" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b7b1d04d32b989416a41f32afd28dd71dd67dc69 b/explorer/fuzzing/fuzzer_corpus/54eba1cba056d1c06f5b3c12a126c9adfd9d528a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b7b1d04d32b989416a41f32afd28dd71dd67dc69 rename to explorer/fuzzing/fuzzer_corpus/54eba1cba056d1c06f5b3c12a126c9adfd9d528a index cb935a68dc56..04f18dd111eb 100644 --- a/explorer/fuzzing/fuzzer_corpus/b7b1d04d32b989416a41f32afd28dd71dd67dc69 +++ b/explorer/fuzzing/fuzzer_corpus/54eba1cba056d1c06f5b3c12a126c9adfd9d528a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { binding_pattern { @@ -183,6 +185,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -207,6 +210,7 @@ compilation_unit { name: "p" } } + op: Plain } } statements { @@ -233,7 +237,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5090b9a0b3c3ffbc56868aec59170a189673a98a b/explorer/fuzzing/fuzzer_corpus/57eaf2918703b28c122367a87dfcdc90bce157dc similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5090b9a0b3c3ffbc56868aec59170a189673a98a rename to explorer/fuzzing/fuzzer_corpus/57eaf2918703b28c122367a87dfcdc90bce157dc index cce912e4d93c..32f32e0c2994 100644 --- a/explorer/fuzzing/fuzzer_corpus/5090b9a0b3c3ffbc56868aec59170a189673a98a +++ b/explorer/fuzzing/fuzzer_corpus/57eaf2918703b28c122367a87dfcdc90bce157dc @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -257,7 +260,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -521,7 +528,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/afac33c91f561c5c08406ee15299f7f3b143b58d b/explorer/fuzzing/fuzzer_corpus/57eba240b39df476aa0a6a3a23f8f01eb21b6143 similarity index 83% rename from explorer/fuzzing/fuzzer_corpus/afac33c91f561c5c08406ee15299f7f3b143b58d rename to explorer/fuzzing/fuzzer_corpus/57eba240b39df476aa0a6a3a23f8f01eb21b6143 index 25f4f2b4142a..fd4493ad15f8 100644 --- a/explorer/fuzzing/fuzzer_corpus/afac33c91f561c5c08406ee15299f7f3b143b58d +++ b/explorer/fuzzing/fuzzer_corpus/57eba240b39df476aa0a6a3a23f8f01eb21b6143 @@ -5,25 +5,15 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { interface { - name: "B" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "B" } } } @@ -66,7 +56,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/fa58d2141da28904f028f6a988a50fcc54b6dc93 b/explorer/fuzzing/fuzzer_corpus/583ec40d68e7531222b5e4044101e9575c4509ff similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/fa58d2141da28904f028f6a988a50fcc54b6dc93 rename to explorer/fuzzing/fuzzer_corpus/583ec40d68e7531222b5e4044101e9575c4509ff index 758187f3cde7..21a16a1110ce 100644 --- a/explorer/fuzzing/fuzzer_corpus/fa58d2141da28904f028f6a988a50fcc54b6dc93 +++ b/explorer/fuzzing/fuzzer_corpus/583ec40d68e7531222b5e4044101e9575c4509ff @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Recurse" + name { + name: "Recurse" + } param_pattern { fields { binding_pattern { @@ -90,7 +92,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5c663ca03b162b8d3095a5b12acd23fba34296c1 b/explorer/fuzzing/fuzzer_corpus/58c61db205983d75beda870ceebfa61a70fd300e similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/5c663ca03b162b8d3095a5b12acd23fba34296c1 rename to explorer/fuzzing/fuzzer_corpus/58c61db205983d75beda870ceebfa61a70fd300e index a591d5252865..dacf3c122a55 100644 --- a/explorer/fuzzing/fuzzer_corpus/5c663ca03b162b8d3095a5b12acd23fba34296c1 +++ b/explorer/fuzzing/fuzzer_corpus/58c61db205983d75beda870ceebfa61a70fd300e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { alias { - name: "TypeAlias" + name { + name: "TypeAlias" + } target { int_type_literal { } @@ -14,7 +16,9 @@ compilation_unit { } declarations { function { - name: "Function" + name { + name: "Function" + } param_pattern { fields { binding_pattern { @@ -76,7 +80,9 @@ compilation_unit { } declarations { function { - name: "GenericFunction" + name { + name: "GenericFunction" + } deduced_parameters { name: "T" type { @@ -123,7 +129,9 @@ compilation_unit { } declarations { alias { - name: "FunctionAlias" + name { + name: "FunctionAlias" + } target { identifier { name: "Function" @@ -133,7 +141,9 @@ compilation_unit { } declarations { alias { - name: "GenericFunctionAlias" + name { + name: "GenericFunctionAlias" + } target { identifier { name: "GenericFunction" @@ -143,7 +153,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5bbfea7599c4d80c75ef4780a6ed6df8bce2da8f b/explorer/fuzzing/fuzzer_corpus/58e115140e5be839f41599aeb2b6a03368e72656 similarity index 61% rename from explorer/fuzzing/fuzzer_corpus/5bbfea7599c4d80c75ef4780a6ed6df8bce2da8f rename to explorer/fuzzing/fuzzer_corpus/58e115140e5be839f41599aeb2b6a03368e72656 index 7a180f8adac8..f3a8e4a1334f 100644 --- a/explorer/fuzzing/fuzzer_corpus/5bbfea7599c4d80c75ef4780a6ed6df8bce2da8f +++ b/explorer/fuzzing/fuzzer_corpus/58e115140e5be839f41599aeb2b6a03368e72656 @@ -5,11 +5,35 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { - name: "n" + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "b" type { expression_pattern { expression { @@ -32,34 +56,17 @@ compilation_unit { } } interface { - where { - base { - call { - function { - identifier { - name: "BitXorWith" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } + call { + function { + identifier { + name: "As" } } - clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + argument { + tuple_literal { + fields { identifier { - name: "A" + name: "B" } } } @@ -68,7 +75,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -84,25 +93,12 @@ compilation_unit { } } param_pattern { - fields { - binding_pattern { - name: "rhs" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } } return_term { kind: Expression type { identifier { - name: "A" + name: "B" } } } @@ -112,23 +108,13 @@ compilation_unit { expression { struct_literal { fields { - name: "n" + name: "b" expression { - operator { - op: BitwiseXor - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { + simple_member_access { + field: "a" + object { identifier { - name: "rhs" + name: "self" } } } @@ -145,7 +131,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -164,8 +152,16 @@ compilation_unit { type { expression_pattern { expression { - identifier { - name: "A" + tuple_literal { + fields { + int_type_literal { + } + } + fields { + identifier { + name: "A" + } + } } } } @@ -173,12 +169,21 @@ compilation_unit { } } init { - struct_literal { + tuple_literal { fields { - name: "n" - expression { - int_literal { - value: 5 + int_literal { + value: 1 + } + } + fields { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 2 + } + } } } } @@ -188,39 +193,42 @@ compilation_unit { } } statements { - assign { - lhs { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + identifier { + name: "B" + } + } + } + } + } + } + } + } + init { identifier { name: "a" } } - rhs { - operator { - op: BitwiseXor - arguments { - identifier { - name: "a" - } - } - arguments { - int_literal { - value: 1 - } - } - } - } + is_returned: false } } statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/c567bdd764d646381461d90d720e1f5db669dfdb b/explorer/fuzzing/fuzzer_corpus/5947862acd3e020041dcd43ca86f05438a6ab930 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/c567bdd764d646381461d90d720e1f5db669dfdb rename to explorer/fuzzing/fuzzer_corpus/5947862acd3e020041dcd43ca86f05438a6ab930 index a8d23053b64d..22f34026dbab 100644 --- a/explorer/fuzzing/fuzzer_corpus/c567bdd764d646381461d90d720e1f5db669dfdb +++ b/explorer/fuzzing/fuzzer_corpus/5947862acd3e020041dcd43ca86f05438a6ab930 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -65,6 +67,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/5a006fff8e99d72fc86aa8545e73e10c13603f6c b/explorer/fuzzing/fuzzer_corpus/5a006fff8e99d72fc86aa8545e73e10c13603f6c new file mode 100644 index 000000000000..de05447b617b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5a006fff8e99d72fc86aa8545e73e10c13603f6c @@ -0,0 +1,119 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Plain + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + int_literal { + value: 0 + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "y" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "y" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5a642703129a307f9a14474706f5e2f56b2d7010 b/explorer/fuzzing/fuzzer_corpus/5a642703129a307f9a14474706f5e2f56b2d7010 new file mode 100644 index 000000000000..17030acff358 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5a642703129a307f9a14474706f5e2f56b2d7010 @@ -0,0 +1,116 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5af9093a8103ad8ffc72eb63999ae64d30c09354 b/explorer/fuzzing/fuzzer_corpus/5af9093a8103ad8ffc72eb63999ae64d30c09354 new file mode 100644 index 000000000000..6046a7b9fa3f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5af9093a8103ad8ffc72eb63999ae64d30c09354 @@ -0,0 +1,53 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + constraint { + name { + name: "X" + } + members { + let { + pattern { + generic_binding { + name: "N" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3ef9bf36f406c43c69612faaef980abdec99a3b8 b/explorer/fuzzing/fuzzer_corpus/5b0199278f094e43e9138a16476f13d3ba564d1f similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/3ef9bf36f406c43c69612faaef980abdec99a3b8 rename to explorer/fuzzing/fuzzer_corpus/5b0199278f094e43e9138a16476f13d3ba564d1f index 3eaacb202a8d..f57991cddeb7 100644 --- a/explorer/fuzzing/fuzzer_corpus/3ef9bf36f406c43c69612faaef980abdec99a3b8 +++ b/explorer/fuzzing/fuzzer_corpus/5b0199278f094e43e9138a16476f13d3ba564d1f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "id" + name { + name: "id" + } deduced_parameters { name: "T" type { @@ -50,7 +52,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5b9b375c91986279a8a110f96835a50cbcc0260c b/explorer/fuzzing/fuzzer_corpus/5b9b375c91986279a8a110f96835a50cbcc0260c new file mode 100644 index 000000000000..b561a4d51382 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5b9b375c91986279a8a110f96835a50cbcc0260c @@ -0,0 +1,273 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "Opt" + } + alternatives { + name: "None" + signature { + } + } + alternatives { + name: "Some" + signature { + fields { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Opt" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + auto_pattern { + } + } + } + } + fields { + alternative_pattern { + choice_type { + identifier { + name: "Opt" + } + } + alternative_name: "Some" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "None" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "Some" + object { + identifier { + name: "Opt" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5d290605979c6ae723f8c79db98fcdee8027691b b/explorer/fuzzing/fuzzer_corpus/5d290605979c6ae723f8c79db98fcdee8027691b new file mode 100644 index 000000000000..b5707279e84a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5d290605979c6ae723f8c79db98fcdee8027691b @@ -0,0 +1,348 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + class_declaration { + name { + name: "X" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "X" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "v" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + compound_member_access { + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + path { + simple_member_access { + field: "n" + object { + identifier { + name: "X" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + simple_member_access { + field: "F" + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + compound_member_access { + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "X" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/88334a8f1ee0dbc684677ed92da372bdc9e4ebe1 b/explorer/fuzzing/fuzzer_corpus/5d2c41a41b6e8763c34b8a5953ffc75203af02bb similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/88334a8f1ee0dbc684677ed92da372bdc9e4ebe1 rename to explorer/fuzzing/fuzzer_corpus/5d2c41a41b6e8763c34b8a5953ffc75203af02bb index e4db8437b928..1b8f3826e83e 100644 --- a/explorer/fuzzing/fuzzer_corpus/88334a8f1ee0dbc684677ed92da372bdc9e4ebe1 +++ b/explorer/fuzzing/fuzzer_corpus/5d2c41a41b6e8763c34b8a5953ffc75203af02bb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -93,6 +95,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/325183e04a4232e4b1cf2779ca2c7c18ab314a06 b/explorer/fuzzing/fuzzer_corpus/5db5461375b313563b11c30a656e5e83957a908d similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/325183e04a4232e4b1cf2779ca2c7c18ab314a06 rename to explorer/fuzzing/fuzzer_corpus/5db5461375b313563b11c30a656e5e83957a908d index 18c40ee9b173..d344f49342da 100644 --- a/explorer/fuzzing/fuzzer_corpus/325183e04a4232e4b1cf2779ca2c7c18ab314a06 +++ b/explorer/fuzzing/fuzzer_corpus/5db5461375b313563b11c30a656e5e83957a908d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -107,6 +109,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/ba16f7124d3f36801e67746ed5c8aa93c00b0eb6 b/explorer/fuzzing/fuzzer_corpus/5dd9c62b5221d7a85e9e1b4a4b331be2c339ab97 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ba16f7124d3f36801e67746ed5c8aa93c00b0eb6 rename to explorer/fuzzing/fuzzer_corpus/5dd9c62b5221d7a85e9e1b4a4b331be2c339ab97 index 4c4e11253aaf..a284c460bc70 100644 --- a/explorer/fuzzing/fuzzer_corpus/ba16f7124d3f36801e67746ed5c8aa93c00b0eb6 +++ b/explorer/fuzzing/fuzzer_corpus/5dd9c62b5221d7a85e9e1b4a4b331be2c339ab97 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e92c187a41749c00eb383152e62a768bf4f9c36e b/explorer/fuzzing/fuzzer_corpus/5e1b0ea6622640145c4876931e297c5edb8231d8 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/e92c187a41749c00eb383152e62a768bf4f9c36e rename to explorer/fuzzing/fuzzer_corpus/5e1b0ea6622640145c4876931e297c5edb8231d8 index cd24971e7082..f30b8aeef796 100644 --- a/explorer/fuzzing/fuzzer_corpus/e92c187a41749c00eb383152e62a768bf4f9c36e +++ b/explorer/fuzzing/fuzzer_corpus/5e1b0ea6622640145c4876931e297c5edb8231d8 @@ -20,7 +20,9 @@ compilation_unit { } declarations { function { - name: "AssignIntTo" + name { + name: "AssignIntTo" + } param_pattern { fields { binding_pattern { @@ -75,6 +77,7 @@ compilation_unit { name: "x" } } + op: Plain } } } @@ -82,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3cd31acb9dd13b0d1cbe4b65161bab8426abf284 b/explorer/fuzzing/fuzzer_corpus/5e3b2219c7b0a5e971058249c4531d2069e951e9 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/3cd31acb9dd13b0d1cbe4b65161bab8426abf284 rename to explorer/fuzzing/fuzzer_corpus/5e3b2219c7b0a5e971058249c4531d2069e951e9 index 9632566e8bb8..234422af8424 100644 --- a/explorer/fuzzing/fuzzer_corpus/3cd31acb9dd13b0d1cbe4b65161bab8426abf284 +++ b/explorer/fuzzing/fuzzer_corpus/5e3b2219c7b0a5e971058249c4531d2069e951e9 @@ -18,7 +18,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5fb13293fefc17d09c0cc7c2e25e6eba45bacb71 b/explorer/fuzzing/fuzzer_corpus/5fb13293fefc17d09c0cc7c2e25e6eba45bacb71 new file mode 100644 index 000000000000..1b6066e3e382 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5fb13293fefc17d09c0cc7c2e25e6eba45bacb71 @@ -0,0 +1,237 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Container" + } + members { + let { + pattern { + generic_binding { + name: "Element" + type { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Front" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Element" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Container" + } + } + clauses { + equals { + lhs { + designator { + name: "Element" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "Element" + object { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Front" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "B" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Container" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "Element" + object { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a6203328741fe94234059cb67cab980a8e841870 b/explorer/fuzzing/fuzzer_corpus/61d367a42b7becd1b4b939d56353897a36e5f096 similarity index 65% rename from explorer/fuzzing/fuzzer_corpus/a6203328741fe94234059cb67cab980a8e841870 rename to explorer/fuzzing/fuzzer_corpus/61d367a42b7becd1b4b939d56353897a36e5f096 index ed16777a934e..a38b079bc966 100644 --- a/explorer/fuzzing/fuzzer_corpus/a6203328741fe94234059cb67cab980a8e841870 +++ b/explorer/fuzzing/fuzzer_corpus/61d367a42b7becd1b4b939d56353897a36e5f096 @@ -5,28 +5,19 @@ compilation_unit { is_api: true declarations { function { - name: "DoNegate" + name { + name: "F" + } deduced_parameters { name: "T" type { - where { - base { - identifier { - name: "Negate" + tuple_literal { + fields { + tuple_literal { } } - clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { - designator { - name: "Self" - } - } + fields { + tuple_literal { } } } @@ -51,8 +42,7 @@ compilation_unit { return_term { kind: Expression type { - identifier { - name: "T" + tuple_literal { } } } @@ -60,13 +50,17 @@ compilation_unit { statements { return_expression_statement { expression { - operator { - op: Neg - arguments { + index { + object { identifier { name: "x" } } + offset { + int_literal { + value: 0 + } + } } } } @@ -76,7 +70,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -88,19 +84,26 @@ compilation_unit { } body { statements { - return_expression_statement { + expression_statement { expression { call { function { identifier { - name: "DoNegate" + name: "F" } } argument { tuple_literal { fields { - int_literal { - value: 3 + tuple_literal { + fields { + tuple_literal { + } + } + fields { + tuple_literal { + } + } } } } @@ -109,6 +112,15 @@ compilation_unit { } } } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0320fd304c1b6d244bb71809ae47b94cc10e3598 b/explorer/fuzzing/fuzzer_corpus/61f23f04c75df376c54549d73cc0decdcb786bf2 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/0320fd304c1b6d244bb71809ae47b94cc10e3598 rename to explorer/fuzzing/fuzzer_corpus/61f23f04c75df376c54549d73cc0decdcb786bf2 index a937b73dceec..cab1dc4064bf 100644 --- a/explorer/fuzzing/fuzzer_corpus/0320fd304c1b6d244bb71809ae47b94cc10e3598 +++ b/explorer/fuzzing/fuzzer_corpus/61f23f04c75df376c54549d73cc0decdcb786bf2 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -64,6 +66,7 @@ compilation_unit { name: "x" } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/61f3084cf911f5dfd5487e87683572a914d1869f b/explorer/fuzzing/fuzzer_corpus/61f3084cf911f5dfd5487e87683572a914d1869f new file mode 100644 index 000000000000..c288e1d7c34a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/61f3084cf911f5dfd5487e87683572a914d1869f @@ -0,0 +1,325 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + function { + name { + name: "Origin" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p1" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p2" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 42 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p3" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "p1" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p2" + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p3" + } + } + } + } + arguments { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/65e4b22f63395739b3f46bf64e39b816311d622d b/explorer/fuzzing/fuzzer_corpus/6219bbd6eb7e0d3fa7e8bc5fa554e2e2aff95733 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/65e4b22f63395739b3f46bf64e39b816311d622d rename to explorer/fuzzing/fuzzer_corpus/6219bbd6eb7e0d3fa7e8bc5fa554e2e2aff95733 index 21baf3a4351e..507c18b74f36 100644 --- a/explorer/fuzzing/fuzzer_corpus/65e4b22f63395739b3f46bf64e39b816311d622d +++ b/explorer/fuzzing/fuzzer_corpus/6219bbd6eb7e0d3fa7e8bc5fa554e2e2aff95733 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -105,6 +107,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/304271293fd1fec0a8ace7f9bccc9a052bc8721c b/explorer/fuzzing/fuzzer_corpus/625b7bfd93cbc6ff7a3c8224e64a4ed8505589c1 similarity index 86% rename from explorer/fuzzing/fuzzer_corpus/304271293fd1fec0a8ace7f9bccc9a052bc8721c rename to explorer/fuzzing/fuzzer_corpus/625b7bfd93cbc6ff7a3c8224e64a4ed8505589c1 index 1ec9be001f6c..28abd9ef25cd 100644 --- a/explorer/fuzzing/fuzzer_corpus/304271293fd1fec0a8ace7f9bccc9a052bc8721c +++ b/explorer/fuzzing/fuzzer_corpus/625b7bfd93cbc6ff7a3c8224e64a4ed8505589c1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -39,20 +41,15 @@ compilation_unit { while_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 0 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 0 } } } @@ -80,6 +77,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -108,6 +106,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0ff60a71d43fa4bb8b98926ecc4c3c9264ba73af b/explorer/fuzzing/fuzzer_corpus/62b8e32751dc67f7885174de27430929aa7a4ad9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/0ff60a71d43fa4bb8b98926ecc4c3c9264ba73af rename to explorer/fuzzing/fuzzer_corpus/62b8e32751dc67f7885174de27430929aa7a4ad9 index 360cc58026c9..bcfc595827ff 100644 --- a/explorer/fuzzing/fuzzer_corpus/0ff60a71d43fa4bb8b98926ecc4c3c9264ba73af +++ b/explorer/fuzzing/fuzzer_corpus/62b8e32751dc67f7885174de27430929aa7a4ad9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/62bbd62118bce3d51da4dcf8408ca2ac6160b6ab b/explorer/fuzzing/fuzzer_corpus/62bbd62118bce3d51da4dcf8408ca2ac6160b6ab new file mode 100644 index 000000000000..5a768b077a09 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/62bbd62118bce3d51da4dcf8408ca2ac6160b6ab @@ -0,0 +1,350 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "SubWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + operator { + op: Sub + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Sub + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Sub + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/55b0c5c02dcab63d51e86120ab38a47f9aefd5bf b/explorer/fuzzing/fuzzer_corpus/62d6f3f23f38c08250ccc296707f3d8b31b458fc similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/55b0c5c02dcab63d51e86120ab38a47f9aefd5bf rename to explorer/fuzzing/fuzzer_corpus/62d6f3f23f38c08250ccc296707f3d8b31b458fc index 2fa2b1e899a3..e6fe83b542b3 100644 --- a/explorer/fuzzing/fuzzer_corpus/55b0c5c02dcab63d51e86120ab38a47f9aefd5bf +++ b/explorer/fuzzing/fuzzer_corpus/62d6f3f23f38c08250ccc296707f3d8b31b458fc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -84,7 +86,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3d55597fe1480cf9f0546c3d2ab1ecf0e0da3749 b/explorer/fuzzing/fuzzer_corpus/631fdd18ae26fb841982077231672ba638d5466d similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/3d55597fe1480cf9f0546c3d2ab1ecf0e0da3749 rename to explorer/fuzzing/fuzzer_corpus/631fdd18ae26fb841982077231672ba638d5466d index 64715dbe286f..121604d4faf7 100644 --- a/explorer/fuzzing/fuzzer_corpus/3d55597fe1480cf9f0546c3d2ab1ecf0e0da3749 +++ b/explorer/fuzzing/fuzzer_corpus/631fdd18ae26fb841982077231672ba638d5466d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f1c6de67f5f6832de02f7052080a64f1b14168c8 b/explorer/fuzzing/fuzzer_corpus/63378befc2730b6eeca04e21fc914fce5442844b similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/f1c6de67f5f6832de02f7052080a64f1b14168c8 rename to explorer/fuzzing/fuzzer_corpus/63378befc2730b6eeca04e21fc914fce5442844b index f9a54417974e..e1929b57986a 100644 --- a/explorer/fuzzing/fuzzer_corpus/f1c6de67f5f6832de02f7052080a64f1b14168c8 +++ b/explorer/fuzzing/fuzzer_corpus/63378befc2730b6eeca04e21fc914fce5442844b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { } return_term { @@ -21,7 +23,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/634aba8b73bb4c4c12485ac91c2b3dcb631358d0 b/explorer/fuzzing/fuzzer_corpus/634aba8b73bb4c4c12485ac91c2b3dcb631358d0 new file mode 100644 index 000000000000..39f164da519e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/634aba8b73bb4c4c12485ac91c2b3dcb631358d0 @@ -0,0 +1,104 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "X" + } + members { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "X" + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/63857ff19609e08af0207d8b1dab6e4de65dbbde b/explorer/fuzzing/fuzzer_corpus/63857ff19609e08af0207d8b1dab6e4de65dbbde new file mode 100644 index 000000000000..0c4569f9392a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/63857ff19609e08af0207d8b1dab6e4de65dbbde @@ -0,0 +1,120 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + int_literal { + value: 0 + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "y" + } + } + rhs { + identifier { + name: "x" + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "y" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/649c2be3e1b157349cd44f67894ad550e9d33ee8 b/explorer/fuzzing/fuzzer_corpus/649c2be3e1b157349cd44f67894ad550e9d33ee8 new file mode 100644 index 000000000000..872e6c15ee44 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/649c2be3e1b157349cd44f67894ad550e9d33ee8 @@ -0,0 +1,132 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + string_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "CreateEmpty" + object { + call { + function { + identifier { + name: "Optional" + } + } + argument { + tuple_literal { + fields { + string_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + call { + function { + simple_member_access { + field: "HasValue" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + then_block { + statements { + return_expression_statement { + expression { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/db51b71d05c77ffb5fae42a2b67894958b008cf9 b/explorer/fuzzing/fuzzer_corpus/6506dca4030d6950129d63f064289299d3caaf39 similarity index 65% rename from explorer/fuzzing/fuzzer_corpus/db51b71d05c77ffb5fae42a2b67894958b008cf9 rename to explorer/fuzzing/fuzzer_corpus/6506dca4030d6950129d63f064289299d3caaf39 index f269dd8ba0b0..647f00ffbf94 100644 --- a/explorer/fuzzing/fuzzer_corpus/db51b71d05c77ffb5fae42a2b67894958b008cf9 +++ b/explorer/fuzzing/fuzzer_corpus/6506dca4030d6950129d63f064289299d3caaf39 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "I" + name { + name: "I" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -22,7 +26,9 @@ compilation_unit { } members { function { - name: "M" + name { + name: "M" + } self_pattern { binding_pattern { name: "self" @@ -48,18 +54,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -90,7 +91,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -115,7 +118,9 @@ compilation_unit { } members { function { - name: "M" + name { + name: "M" + } self_pattern { binding_pattern { name: "self" @@ -156,7 +161,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -209,7 +216,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -234,7 +243,9 @@ compilation_unit { } members { function { - name: "M" + name { + name: "M" + } self_pattern { binding_pattern { name: "self" @@ -275,7 +286,9 @@ compilation_unit { } declarations { alias { - name: "IF" + name { + name: "IF" + } target { simple_member_access { field: "F" @@ -290,7 +303,9 @@ compilation_unit { } declarations { alias { - name: "IM" + name { + name: "IM" + } target { simple_member_access { field: "M" @@ -305,7 +320,9 @@ compilation_unit { } declarations { alias { - name: "AIF" + name { + name: "AIF" + } target { compound_member_access { object { @@ -324,7 +341,9 @@ compilation_unit { } declarations { alias { - name: "AIM" + name { + name: "AIM" + } target { compound_member_access { object { @@ -343,7 +362,9 @@ compilation_unit { } declarations { alias { - name: "AG" + name { + name: "AG" + } target { simple_member_access { field: "G" @@ -358,7 +379,9 @@ compilation_unit { } declarations { alias { - name: "i32IF" + name { + name: "i32IF" + } target { compound_member_access { object { @@ -376,7 +399,9 @@ compilation_unit { } declarations { alias { - name: "i32IM" + name { + name: "i32IM" + } target { compound_member_access { object { @@ -394,7 +419,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -440,39 +467,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IF" - } - } + call { + function { + compound_member_access { + object { + identifier { + name: "A" } } - argument { - tuple_literal { + path { + identifier { + name: "IF" } } } } - arguments { - int_literal { - value: 1 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 1 + } + } } } then_block { @@ -492,39 +514,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "IF" - } - } + call { + function { + compound_member_access { + object { + identifier { + name: "a" } } - argument { - tuple_literal { + path { + identifier { + name: "IF" } } } } - arguments { - int_literal { - value: 1 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 1 + } + } } } then_block { @@ -544,39 +561,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "IM" - } - } + call { + function { + compound_member_access { + object { + identifier { + name: "a" } } - argument { - tuple_literal { + path { + identifier { + name: "IM" } } } } - arguments { - int_literal { - value: 2 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 2 + } + } } } then_block { @@ -596,48 +608,43 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { compound_member_access { object { identifier { - name: "a" + name: "A" } } path { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IM" - } - } + identifier { + name: "IM" } } } } - argument { - tuple_literal { - } - } } } - arguments { - int_literal { - value: 2 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 2 + } + } } } then_block { @@ -657,30 +664,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - identifier { - name: "AIF" - } - } - argument { - tuple_literal { - } - } + call { + function { + identifier { + name: "AIF" } } - arguments { - int_literal { - value: 1 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 1 + } + } } } then_block { @@ -700,39 +702,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "AIM" - } - } + call { + function { + compound_member_access { + object { + identifier { + name: "a" } } - argument { - tuple_literal { + path { + identifier { + name: "AIM" } } } } - arguments { - int_literal { - value: 2 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 2 + } + } } } then_block { @@ -752,39 +749,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "AG" - } - } + call { + function { + compound_member_access { + object { + identifier { + name: "a" } } - argument { - tuple_literal { + path { + identifier { + name: "AG" } } } } - arguments { - int_literal { - value: 3 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 3 + } + } } } then_block { @@ -804,38 +796,33 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IF" - } - } + call { + function { + compound_member_access { + object { + int_type_literal { } } - argument { - tuple_literal { + path { + identifier { + name: "IF" } } } } - arguments { - int_literal { - value: 4 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 4 + } + } } } then_block { @@ -855,39 +842,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "IF" - } - } + call { + function { + compound_member_access { + object { + int_literal { + value: 0 } } - argument { - tuple_literal { + path { + identifier { + name: "IF" } } } } - arguments { - int_literal { - value: 4 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 4 + } + } } } then_block { @@ -907,39 +889,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "IM" - } - } + call { + function { + compound_member_access { + object { + int_literal { + value: 0 } } - argument { - tuple_literal { + path { + identifier { + name: "IM" } } } } - arguments { - int_literal { - value: 5 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 5 + } + } } } then_block { @@ -959,47 +936,42 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { + call { + function { + compound_member_access { + object { + int_literal { + value: 0 + } + } + path { compound_member_access { object { - int_literal { - value: 0 + int_type_literal { } } path { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IM" - } - } + identifier { + name: "IM" } } } } - argument { - tuple_literal { - } - } } } - arguments { - int_literal { - value: 5 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 5 + } + } } } then_block { @@ -1019,30 +991,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - identifier { - name: "i32IF" - } - } - argument { - tuple_literal { - } - } + call { + function { + identifier { + name: "i32IF" } } - arguments { - int_literal { - value: 4 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 4 + } + } } } then_block { @@ -1062,39 +1029,34 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "i32IM" - } - } + call { + function { + compound_member_access { + object { + int_literal { + value: 0 } } - argument { - tuple_literal { + path { + identifier { + name: "i32IM" } } } } - arguments { - int_literal { - value: 5 + argument { + tuple_literal { } } } } + arguments { + int_literal { + value: 5 + } + } } } then_block { diff --git a/explorer/fuzzing/fuzzer_corpus/3e01369a9e8cf3f970c089945ec276bcbeede55c b/explorer/fuzzing/fuzzer_corpus/65c43429b61c8397acd866f828fcb47cbb7c16f4 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3e01369a9e8cf3f970c089945ec276bcbeede55c rename to explorer/fuzzing/fuzzer_corpus/65c43429b61c8397acd866f828fcb47cbb7c16f4 index 6fa69fdea8e9..656d967b2eaa 100644 --- a/explorer/fuzzing/fuzzer_corpus/3e01369a9e8cf3f970c089945ec276bcbeede55c +++ b/explorer/fuzzing/fuzzer_corpus/65c43429b61c8397acd866f828fcb47cbb7c16f4 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -257,7 +260,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { function { - name: "ScaleGeneric" + name { + name: "ScaleGeneric" + } deduced_parameters { name: "U" type { @@ -438,7 +445,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -549,7 +558,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/65e88126f8b67fa52bc1cdad9b1eb44f52709925 b/explorer/fuzzing/fuzzer_corpus/65e88126f8b67fa52bc1cdad9b1eb44f52709925 new file mode 100644 index 000000000000..fd5df5a3c36c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/65e88126f8b67fa52bc1cdad9b1eb44f52709925 @@ -0,0 +1,82 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: true + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + int_literal { + value: 0 + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + statements { + return_var_statement { + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3a1da05a244c47594a645929ded6293a983044c2 b/explorer/fuzzing/fuzzer_corpus/673f35f759ee84f2f94657b0930f2b74b429b144 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/3a1da05a244c47594a645929ded6293a983044c2 rename to explorer/fuzzing/fuzzer_corpus/673f35f759ee84f2f94657b0930f2b74b429b144 index 9476d751100e..0af04260575c 100644 --- a/explorer/fuzzing/fuzzer_corpus/3a1da05a244c47594a645929ded6293a983044c2 +++ b/explorer/fuzzing/fuzzer_corpus/673f35f759ee84f2f94657b0930f2b74b429b144 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Iface" + name { + name: "Iface" + } members { let { pattern { @@ -19,18 +21,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "PickType" + name { + name: "PickType" + } param_pattern { fields { binding_pattern { @@ -67,7 +64,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -169,13 +168,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "N" - } - } - rhs { + rewrite { + member_name: "N" + replacement { int_literal { value: 5 } @@ -188,7 +183,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6740e9ab30860f2c0277ff36e850c53ca4091e89 b/explorer/fuzzing/fuzzer_corpus/6740e9ab30860f2c0277ff36e850c53ca4091e89 new file mode 100644 index 000000000000..e923bc731c7b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6740e9ab30860f2c0277ff36e850c53ca4091e89 @@ -0,0 +1,719 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Maker" + } + members { + function { + name { + name: "Make" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + } + } + } + } + declarations { + constraint { + name { + name: "IndirectMaker" + } + members { + interface_extends { + base { + call { + function { + identifier { + name: "Maker" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + constraint { + name { + name: "MoreIndirectMaker" + } + members { + interface_extends { + base { + call { + function { + identifier { + name: "IndirectMaker" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "PointerFactory" + } + members { + variable { + binding { + name: "p" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "Maker" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "p" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "CallIndirect" + } + deduced_parameters { + name: "T" + type { + call { + function { + identifier { + name: "IndirectMaker" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "CallMoreIndirect" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "MoreIndirectMaker" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Deref + arguments { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 5 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "f" + type { + expression_pattern { + expression { + identifier { + name: "PointerFactory" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "p" + expression { + operator { + op: AddressOf + arguments { + identifier { + name: "n" + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + operator { + op: Deref + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "f" + } + } + path { + simple_member_access { + field: "Make" + object { + call { + function { + identifier { + name: "Maker" + } + } + argument { + tuple_literal { + fields { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + operator { + op: Deref + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "f" + } + } + path { + simple_member_access { + field: "Make" + object { + call { + function { + identifier { + name: "IndirectMaker" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + operator { + op: Deref + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "f" + } + } + path { + simple_member_access { + field: "Make" + object { + identifier { + name: "MoreIndirectMaker" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "CallIndirect" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "f" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "CallMoreIndirect" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "f" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/676dcd14b69ef443edb46d3f7d0bb24e07d4acbd b/explorer/fuzzing/fuzzer_corpus/676dcd14b69ef443edb46d3f7d0bb24e07d4acbd new file mode 100644 index 000000000000..219b02ef70b1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/676dcd14b69ef443edb46d3f7d0bb24e07d4acbd @@ -0,0 +1,104 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + operator { + op: Eq + arguments { + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + body { + statements { + assign { + lhs { + identifier { + name: "y" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d993423470d20f56f3e3aec843740bb77c4c7419 b/explorer/fuzzing/fuzzer_corpus/67b09e185ee33d38580bc1ae4be51419b7a7ebc9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d993423470d20f56f3e3aec843740bb77c4c7419 rename to explorer/fuzzing/fuzzer_corpus/67b09e185ee33d38580bc1ae4be51419b7a7ebc9 index ce627cb93d77..5f7fa53b5831 100644 --- a/explorer/fuzzing/fuzzer_corpus/d993423470d20f56f3e3aec843740bb77c4c7419 +++ b/explorer/fuzzing/fuzzer_corpus/67b09e185ee33d38580bc1ae4be51419b7a7ebc9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/693b9959c2755a9a294266be5333fe1a08dd7732 b/explorer/fuzzing/fuzzer_corpus/693b9959c2755a9a294266be5333fe1a08dd7732 new file mode 100644 index 000000000000..185d63f3f9a8 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/693b9959c2755a9a294266be5333fe1a08dd7732 @@ -0,0 +1,268 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "MyAddWith" + } + members { + let { + pattern { + generic_binding { + name: "Result" + type { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Result" + } + } + } + } + } + } + } + declarations { + constraint { + name { + name: "MyAdd" + } + members { + interface_extends { + base { + where { + base { + call { + function { + identifier { + name: "MyAddWith" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Self" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "MyAdd" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "self" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "n" + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "MyAdd" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/693c700b7aee574a54f5703171f786851195a97b b/explorer/fuzzing/fuzzer_corpus/693c700b7aee574a54f5703171f786851195a97b new file mode 100644 index 000000000000..23555d3a58f6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/693c700b7aee574a54f5703171f786851195a97b @@ -0,0 +1,120 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "A" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "a" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + identifier { + name: "b" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/693eab692d17bea44af514d53bc2373d40ab0927 b/explorer/fuzzing/fuzzer_corpus/693eab692d17bea44af514d53bc2373d40ab0927 new file mode 100644 index 000000000000..90d1bb579110 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/693eab692d17bea44af514d53bc2373d40ab0927 @@ -0,0 +1,137 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "val" + } + } + path { + simple_member_access { + field: "Op" + object { + identifier { + name: "Negate" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + operator { + op: Neg + arguments { + identifier { + name: "val" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/69db4f861b4949d098e5705e9392d06585a5c8a9 b/explorer/fuzzing/fuzzer_corpus/69db4f861b4949d098e5705e9392d06585a5c8a9 new file mode 100644 index 000000000000..a9c79f8e774e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/69db4f861b4949d098e5705e9392d06585a5c8a9 @@ -0,0 +1,63 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/45df8150a602efa2d03b8e0c7006dd9c51ca397b b/explorer/fuzzing/fuzzer_corpus/6a95e8884b0a9a11c49828db369179c7d52e6f7f similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/45df8150a602efa2d03b8e0c7006dd9c51ca397b rename to explorer/fuzzing/fuzzer_corpus/6a95e8884b0a9a11c49828db369179c7d52e6f7f index 4d3547de63a1..2611e3ee3d62 100644 --- a/explorer/fuzzing/fuzzer_corpus/45df8150a602efa2d03b8e0c7006dd9c51ca397b +++ b/explorer/fuzzing/fuzzer_corpus/6a95e8884b0a9a11c49828db369179c7d52e6f7f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { tuple_pattern { @@ -62,6 +64,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -76,6 +79,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -102,7 +106,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6ab7d6a964a424b00748ce1b65fedc4cce3ee1c8 b/explorer/fuzzing/fuzzer_corpus/6ab7d6a964a424b00748ce1b65fedc4cce3ee1c8 new file mode 100644 index 000000000000..49af0d492e2c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6ab7d6a964a424b00748ce1b65fedc4cce3ee1c8 @@ -0,0 +1,469 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + members { + function { + name { + name: "Square" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + function { + name { + name: "Origin" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Complex" + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Complex" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "r" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "i" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "r" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "Complex" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "Complex" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + rhs { + int_literal { + value: 3 + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "r" + object { + identifier { + name: "c" + } + } + } + } + rhs { + int_literal { + value: 4 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Sub + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "r" + object { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + arguments { + int_literal { + value: 7 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7baaf27cb799b8ddad1b6a8cff4d7e8088e1dbde b/explorer/fuzzing/fuzzer_corpus/6ac46cfb4a998ede3392679c83839398fffea96f similarity index 80% rename from explorer/fuzzing/fuzzer_corpus/7baaf27cb799b8ddad1b6a8cff4d7e8088e1dbde rename to explorer/fuzzing/fuzzer_corpus/6ac46cfb4a998ede3392679c83839398fffea96f index 8208a3482867..4c85777b0dac 100644 --- a/explorer/fuzzing/fuzzer_corpus/7baaf27cb799b8ddad1b6a8cff4d7e8088e1dbde +++ b/explorer/fuzzing/fuzzer_corpus/6ac46cfb4a998ede3392679c83839398fffea96f @@ -5,13 +5,8 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "Vector" } } } @@ -31,7 +26,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/56fb111f6e74f0cb64563f7a11364068f5d68b00 b/explorer/fuzzing/fuzzer_corpus/6ad89dc865016d2d3a0841b78165e85a1f10a15d similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/56fb111f6e74f0cb64563f7a11364068f5d68b00 rename to explorer/fuzzing/fuzzer_corpus/6ad89dc865016d2d3a0841b78165e85a1f10a15d index 28ee97eae59b..d0f1e25f5675 100644 --- a/explorer/fuzzing/fuzzer_corpus/56fb111f6e74f0cb64563f7a11364068f5d68b00 +++ b/explorer/fuzzing/fuzzer_corpus/6ad89dc865016d2d3a0841b78165e85a1f10a15d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Add" + name { + name: "ComputeSum" + } param_pattern { fields { binding_pattern { @@ -126,7 +128,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -146,7 +150,7 @@ compilation_unit { call { function { identifier { - name: "Add" + name: "ComputeSum" } } argument { diff --git a/explorer/fuzzing/fuzzer_corpus/6ae5582a206dd285cc4b6a16c4b43ee0eac60513 b/explorer/fuzzing/fuzzer_corpus/6ae5582a206dd285cc4b6a16c4b43ee0eac60513 new file mode 100644 index 000000000000..90c624dd658e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6ae5582a206dd285cc4b6a16c4b43ee0eac60513 @@ -0,0 +1,373 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Number" + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name { + name: "Add" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name { + name: "Add" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "self" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "value_a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "value_b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value_a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "value_b" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "value_b" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "value_a" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7739c384b82e7dd2630d7c342173d00b40e4e77c b/explorer/fuzzing/fuzzer_corpus/6b36dec52800ad9f326b75b51de5237a009abddf similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/7739c384b82e7dd2630d7c342173d00b40e4e77c rename to explorer/fuzzing/fuzzer_corpus/6b36dec52800ad9f326b75b51de5237a009abddf index 689bcdee4279..cb64a4e99cbb 100644 --- a/explorer/fuzzing/fuzzer_corpus/7739c384b82e7dd2630d7c342173d00b40e4e77c +++ b/explorer/fuzzing/fuzzer_corpus/6b36dec52800ad9f326b75b51de5237a009abddf @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -49,18 +53,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "ScaleGeneric" + name { + name: "ScaleGeneric" + } deduced_parameters { name: "T" type { @@ -139,7 +138,9 @@ compilation_unit { } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -185,7 +186,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -298,7 +301,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6a95cd131220c0a2fe144506527062363d229bbe b/explorer/fuzzing/fuzzer_corpus/6b55b4906ab4a1bc8fb2e2c1dcb9815fccbc857e similarity index 60% rename from explorer/fuzzing/fuzzer_corpus/6a95cd131220c0a2fe144506527062363d229bbe rename to explorer/fuzzing/fuzzer_corpus/6b55b4906ab4a1bc8fb2e2c1dcb9815fccbc857e index c21f109f675d..1610d325e9da 100644 --- a/explorer/fuzzing/fuzzer_corpus/6a95cd131220c0a2fe144506527062363d229bbe +++ b/explorer/fuzzing/fuzzer_corpus/6b55b4906ab4a1bc8fb2e2c1dcb9815fccbc857e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -20,30 +22,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftLeft - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 0 - } - } - } - } + op: BitShiftLeft arguments { int_literal { value: 1 } } + arguments { + int_literal { + value: 0 + } + } + } + } + arguments { + int_literal { + value: 1 } } } @@ -65,32 +62,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitShiftLeft arguments { - operator { - op: BitShiftLeft - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 3 - } - } + int_literal { + value: 1 } } arguments { int_literal { - value: 8 + value: 3 } } } } + arguments { + int_literal { + value: 8 + } + } } } then_block { @@ -110,30 +102,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftLeft - arguments { - int_literal { - value: 0 - } - } - arguments { - int_literal { - value: 3 - } - } - } - } + op: BitShiftLeft arguments { int_literal { value: 0 } } + arguments { + int_literal { + value: 3 + } + } + } + } + arguments { + int_literal { + value: 0 } } } @@ -155,32 +142,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitShiftLeft arguments { - operator { - op: BitShiftLeft - arguments { - int_literal { - value: 3 - } - } - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 3 } } arguments { int_literal { - value: 6 + value: 1 } } } } + arguments { + int_literal { + value: 6 + } + } } } then_block { @@ -200,40 +182,35 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftLeft - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } + op: BitShiftLeft arguments { operator { op: Neg arguments { int_literal { - value: 4 + value: 1 } } } } + arguments { + int_literal { + value: 2 + } + } + } + } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 4 + } + } } } } @@ -255,30 +232,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftRight - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 0 - } - } - } - } + op: BitShiftRight arguments { int_literal { value: 1 } } + arguments { + int_literal { + value: 0 + } + } + } + } + arguments { + int_literal { + value: 1 } } } @@ -300,32 +272,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitShiftRight arguments { - operator { - op: BitShiftRight - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 1 } } arguments { int_literal { - value: 0 + value: 1 } } } } + arguments { + int_literal { + value: 0 + } + } } } then_block { @@ -345,23 +312,13 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitShiftRight arguments { - operator { - op: BitShiftRight - arguments { - int_literal { - value: 3 - } - } - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 3 } } arguments { @@ -371,6 +328,11 @@ compilation_unit { } } } + arguments { + int_literal { + value: 1 + } + } } } then_block { @@ -390,30 +352,10 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftRight - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } + op: BitShiftRight arguments { operator { op: Neg @@ -424,6 +366,21 @@ compilation_unit { } } } + arguments { + int_literal { + value: 1 + } + } + } + } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } } } } @@ -445,40 +402,35 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitShiftRight - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 2 - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } + op: BitShiftRight arguments { operator { op: Neg arguments { int_literal { - value: 1 + value: 2 } } } } + arguments { + int_literal { + value: 1 + } + } + } + } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } } } } @@ -496,6 +448,113 @@ compilation_unit { } } } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "n" + } + } + rhs { + int_literal { + value: 3 + } + } + op: ShiftLeft + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "n" + } + } + rhs { + int_literal { + value: 1 + } + } + op: ShiftRight + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } statements { return_expression_statement { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/6b8b5a07609562f73a0fea986fe4fbaac6f07302 b/explorer/fuzzing/fuzzer_corpus/6b8b5a07609562f73a0fea986fe4fbaac6f07302 new file mode 100644 index 000000000000..5a96f2536463 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6b8b5a07609562f73a0fea986fe4fbaac6f07302 @@ -0,0 +1,75 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + function { + name { + name: "ScalarZero" + } + param_pattern { + } + return_term { + kind: Expression + type { + simple_member_access { + field: "ScalarType" + object { + identifier { + name: "Self" + } + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "ScalarType" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6b8d32899c42da294378f3bcdd6b31bb825ceaa7 b/explorer/fuzzing/fuzzer_corpus/6b8d32899c42da294378f3bcdd6b31bb825ceaa7 new file mode 100644 index 000000000000..1db5a557e753 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6b8d32899c42da294378f3bcdd6b31bb825ceaa7 @@ -0,0 +1,260 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + array_type_literal { + element_type { + identifier { + name: "A" + } + } + size { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 6 + } + } + } + } + } + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + array_type_literal { + element_type { + array_type_literal { + element_type { + identifier { + name: "A" + } + } + size { + int_literal { + value: 2 + } + } + } + } + size { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 4 + } + } + } + } + } + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + fields { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6bd6a2e44dbfe2c7012bc97507b56ec79d14ec36 b/explorer/fuzzing/fuzzer_corpus/6bd6a2e44dbfe2c7012bc97507b56ec79d14ec36 new file mode 100644 index 000000000000..29db6b7526a0 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6bd6a2e44dbfe2c7012bc97507b56ec79d14ec36 @@ -0,0 +1,128 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M1" + } + members { + function { + name { + name: "F1" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6bf3f7a037ac5bcdfff8b904bdd801aa04e6e3f9 b/explorer/fuzzing/fuzzer_corpus/6bf3f7a037ac5bcdfff8b904bdd801aa04e6e3f9 new file mode 100644 index 000000000000..b17b3a5b5334 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/6bf3f7a037ac5bcdfff8b904bdd801aa04e6e3f9 @@ -0,0 +1,73 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "C" + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_type_literal { + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4912c6e4c630887f6aab9a9d2db35b5391ffc044 b/explorer/fuzzing/fuzzer_corpus/6cef9effeb2257bb69c9b96fe57051bdaf07ebdc similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/4912c6e4c630887f6aab9a9d2db35b5391ffc044 rename to explorer/fuzzing/fuzzer_corpus/6cef9effeb2257bb69c9b96fe57051bdaf07ebdc index 3beab0017f42..2dfa749b79bb 100644 --- a/explorer/fuzzing/fuzzer_corpus/4912c6e4c630887f6aab9a9d2db35b5391ffc044 +++ b/explorer/fuzzing/fuzzer_corpus/6cef9effeb2257bb69c9b96fe57051bdaf07ebdc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5face9a218209d4da098180061d730d861b81e89 b/explorer/fuzzing/fuzzer_corpus/6d446a00a2ec3646a47ca64c9d47900af609c04d similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/5face9a218209d4da098180061d730d861b81e89 rename to explorer/fuzzing/fuzzer_corpus/6d446a00a2ec3646a47ca64c9d47900af609c04d index e803eef30c3f..9b1be9bca283 100644 --- a/explorer/fuzzing/fuzzer_corpus/5face9a218209d4da098180061d730d861b81e89 +++ b/explorer/fuzzing/fuzzer_corpus/6d446a00a2ec3646a47ca64c9d47900af609c04d @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -125,7 +131,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ff37e9a89344e54b728980de9254aa7c79e8aaea b/explorer/fuzzing/fuzzer_corpus/6e805a62f04827f2dab730e0bda6d7e3b2a396ac similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/ff37e9a89344e54b728980de9254aa7c79e8aaea rename to explorer/fuzzing/fuzzer_corpus/6e805a62f04827f2dab730e0bda6d7e3b2a396ac index 1a437067d909..0849963d17bc 100644 --- a/explorer/fuzzing/fuzzer_corpus/ff37e9a89344e54b728980de9254aa7c79e8aaea +++ b/explorer/fuzzing/fuzzer_corpus/6e805a62f04827f2dab730e0bda6d7e3b2a396ac @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3018f242798c2d5dce1556674891b7dc3a3c0dae b/explorer/fuzzing/fuzzer_corpus/6ea3e5dc732350e61fa2e1b2b4af3dac49fbd7a2 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3018f242798c2d5dce1556674891b7dc3a3c0dae rename to explorer/fuzzing/fuzzer_corpus/6ea3e5dc732350e61fa2e1b2b4af3dac49fbd7a2 index b1ddb5c6f54b..302e0480a2cf 100644 --- a/explorer/fuzzing/fuzzer_corpus/3018f242798c2d5dce1556674891b7dc3a3c0dae +++ b/explorer/fuzzing/fuzzer_corpus/6ea3e5dc732350e61fa2e1b2b4af3dac49fbd7a2 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "swap" + name { + name: "swap" + } deduced_parameters { name: "T" type { @@ -104,7 +106,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4454bf82b4fa49d39d130690d84d352c6f10f68c b/explorer/fuzzing/fuzzer_corpus/700edad66fdc0ecca488b76faa561bd812a32de1 similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/4454bf82b4fa49d39d130690d84d352c6f10f68c rename to explorer/fuzzing/fuzzer_corpus/700edad66fdc0ecca488b76faa561bd812a32de1 index d9e101543f49..a38b540e812a 100644 --- a/explorer/fuzzing/fuzzer_corpus/4454bf82b4fa49d39d130690d84d352c6f10f68c +++ b/explorer/fuzzing/fuzzer_corpus/700edad66fdc0ecca488b76faa561bd812a32de1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -33,7 +35,7 @@ compilation_unit { } init { string_literal { - value: "A block string literal\n\"\"\"#\n" + value: "A block string literal\n\'\'\'#\n" } } is_returned: false @@ -51,7 +53,7 @@ compilation_unit { } arguments { string_literal { - value: "A block string literal\n\"\"\"#\n" + value: "A block string literal\n\'\'\'#\n" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0628004dd8a25e850a804fb21da38644e9734e1d b/explorer/fuzzing/fuzzer_corpus/70381203ec4a62c0892c9169af38afda36aff77b similarity index 59% rename from explorer/fuzzing/fuzzer_corpus/0628004dd8a25e850a804fb21da38644e9734e1d rename to explorer/fuzzing/fuzzer_corpus/70381203ec4a62c0892c9169af38afda36aff77b index 3400f72af459..2a76c871ecbc 100644 --- a/explorer/fuzzing/fuzzer_corpus/0628004dd8a25e850a804fb21da38644e9734e1d +++ b/explorer/fuzzing/fuzzer_corpus/70381203ec4a62c0892c9169af38afda36aff77b @@ -5,44 +5,21 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "A" + } members { function { - name: "Origin" + name { + name: "Create" + } param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } } return_term { kind: Expression type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } + identifier { + name: "Self" } } } @@ -52,18 +29,10 @@ compilation_unit { expression { struct_literal { fields { - name: "x" + name: "value_a" expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" + int_literal { + value: 1 } } } @@ -75,42 +44,39 @@ compilation_unit { } } members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } + variable { + binding { + name: "value_a" + type { + expression_pattern { + expression { + int_type_literal { } } } } } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + function { + name { + name: "Create" + } param_pattern { } return_term { kind: Expression type { identifier { - name: "T" + name: "Self" } } } @@ -118,11 +84,34 @@ compilation_unit { statements { return_expression_statement { expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" + struct_literal { + fields { + name: "base" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "value_b" + expression { + int_literal { + value: 2 + } } } } @@ -135,12 +124,11 @@ compilation_unit { members { variable { binding { - name: "x" + name: "value_b" type { expression_pattern { expression { - identifier { - name: "T" + int_type_literal { } } } @@ -148,38 +136,13 @@ compilation_unit { } } } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - int_type_literal { - } - } - } - } - } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -194,24 +157,12 @@ compilation_unit { variable_definition { pattern { binding_pattern { - name: "p" + name: "b" type { expression_pattern { expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } + identifier { + name: "B" } } } @@ -222,33 +173,16 @@ compilation_unit { call { function { simple_member_access { - field: "Origin" + field: "Create" object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } + identifier { + name: "B" } } } } argument { tuple_literal { - fields { - int_literal { - value: 0 - } - } } } } @@ -257,27 +191,78 @@ compilation_unit { } } statements { - return_expression_statement { + expression_statement { expression { call { function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } + identifier { + name: "Print" } } argument { tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "value_a" + object { + identifier { + name: "b" + } + } + } + } } } } } } } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "value_b" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } } } } diff --git a/explorer/fuzzing/fuzzer_corpus/74e870476a366facfe06964039a647667963b684 b/explorer/fuzzing/fuzzer_corpus/70c1ffb0e5928af3588ad282ca66e09cecea781f similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/74e870476a366facfe06964039a647667963b684 rename to explorer/fuzzing/fuzzer_corpus/70c1ffb0e5928af3588ad282ca66e09cecea781f index d8990906156a..33d5d73ffd5c 100644 --- a/explorer/fuzzing/fuzzer_corpus/74e870476a366facfe06964039a647667963b684 +++ b/explorer/fuzzing/fuzzer_corpus/70c1ffb0e5928af3588ad282ca66e09cecea781f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/94b9e894207384a2fcb65d7422c04f18d179f4e5 b/explorer/fuzzing/fuzzer_corpus/70e5a8e81363e001a3c04485baff3c0b45f543c7 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/94b9e894207384a2fcb65d7422c04f18d179f4e5 rename to explorer/fuzzing/fuzzer_corpus/70e5a8e81363e001a3c04485baff3c0b45f543c7 index b7586a104e1b..42fd798eecdd 100644 --- a/explorer/fuzzing/fuzzer_corpus/94b9e894207384a2fcb65d7422c04f18d179f4e5 +++ b/explorer/fuzzing/fuzzer_corpus/70e5a8e81363e001a3c04485baff3c0b45f543c7 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "C" + name { + name: "C" + } type_params { fields { generic_binding { @@ -21,7 +23,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { generic_binding { @@ -68,7 +72,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -108,7 +114,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/71343714ac735fe6c6370bebfe3f30e2555fceed b/explorer/fuzzing/fuzzer_corpus/71343714ac735fe6c6370bebfe3f30e2555fceed new file mode 100644 index 000000000000..612068e6f38e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/71343714ac735fe6c6370bebfe3f30e2555fceed @@ -0,0 +1,202 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M1" + } + members { + function { + name { + name: "F1" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M2" + } + members { + function { + name { + name: "F2" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M3" + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + members { + function { + name { + name: "F3" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + mix { + mixin { + identifier { + name: "M2" + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M3" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0334411b5237b6560686cb80741953d202625403 b/explorer/fuzzing/fuzzer_corpus/7196097c3c0a0a0c5e13f3ebd44cb8f70e3a369e similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/0334411b5237b6560686cb80741953d202625403 rename to explorer/fuzzing/fuzzer_corpus/7196097c3c0a0a0c5e13f3ebd44cb8f70e3a369e index b99b5b608df9..417f2c621c2a 100644 --- a/explorer/fuzzing/fuzzer_corpus/0334411b5237b6560686cb80741953d202625403 +++ b/explorer/fuzzing/fuzzer_corpus/7196097c3c0a0a0c5e13f3ebd44cb8f70e3a369e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Id" + name { + name: "Id" + } param_pattern { fields { binding_pattern { @@ -39,7 +41,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/799d9db1d6c8c2b97fe5e30317cd27b37a7d24e3 b/explorer/fuzzing/fuzzer_corpus/72e14e2a23ba4e07dd8ecac1d2a0f307982e22fd similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/799d9db1d6c8c2b97fe5e30317cd27b37a7d24e3 rename to explorer/fuzzing/fuzzer_corpus/72e14e2a23ba4e07dd8ecac1d2a0f307982e22fd index 842d1d63c890..8963f9b200df 100644 --- a/explorer/fuzzing/fuzzer_corpus/799d9db1d6c8c2b97fe5e30317cd27b37a7d24e3 +++ b/explorer/fuzzing/fuzzer_corpus/72e14e2a23ba4e07dd8ecac1d2a0f307982e22fd @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Has" + name { + name: "Has" + } members { function { - name: "Get" + name { + name: "Get" + } param_pattern { } return_term { @@ -21,13 +25,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -56,7 +53,9 @@ compilation_unit { } members { function { - name: "Get" + name { + name: "Get" + } param_pattern { } return_term { @@ -83,10 +82,14 @@ compilation_unit { } declarations { class_declaration { - name: "WithType" + name { + name: "WithType" + } members { function { - name: "Get" + name { + name: "Get" + } param_pattern { } return_term { @@ -150,7 +153,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0ac4e657eed8b5281248287683e3528421b1a4b6 b/explorer/fuzzing/fuzzer_corpus/7301e760d4cd4136a6260e0e5db5f884621f6711 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/0ac4e657eed8b5281248287683e3528421b1a4b6 rename to explorer/fuzzing/fuzzer_corpus/7301e760d4cd4136a6260e0e5db5f884621f6711 index f28df52e4c42..c248ed49c913 100644 --- a/explorer/fuzzing/fuzzer_corpus/0ac4e657eed8b5281248287683e3528421b1a4b6 +++ b/explorer/fuzzing/fuzzer_corpus/7301e760d4cd4136a6260e0e5db5f884621f6711 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Foo" + name { + name: "Foo" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b9f46b91be4c9c41fe281be82a3562cafbc10dbc b/explorer/fuzzing/fuzzer_corpus/743374116966cde7bea7be19c3b44f4f4742cc84 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b9f46b91be4c9c41fe281be82a3562cafbc10dbc rename to explorer/fuzzing/fuzzer_corpus/743374116966cde7bea7be19c3b44f4f4742cc84 index 52879fc090d9..81933fb0fa20 100644 --- a/explorer/fuzzing/fuzzer_corpus/b9f46b91be4c9c41fe281be82a3562cafbc10dbc +++ b/explorer/fuzzing/fuzzer_corpus/743374116966cde7bea7be19c3b44f4f4742cc84 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -136,6 +140,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/c7287f3ba5df5bacd5a9f2d922af57f635dfe245 b/explorer/fuzzing/fuzzer_corpus/746204b64652d56258e37760629e723c7162cc3a similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/c7287f3ba5df5bacd5a9f2d922af57f635dfe245 rename to explorer/fuzzing/fuzzer_corpus/746204b64652d56258e37760629e723c7162cc3a index 12a2437b996f..1cb428d81e5a 100644 --- a/explorer/fuzzing/fuzzer_corpus/c7287f3ba5df5bacd5a9f2d922af57f635dfe245 +++ b/explorer/fuzzing/fuzzer_corpus/746204b64652d56258e37760629e723c7162cc3a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "LazyEq" + name { + name: "LazyEq" + } members { variable { binding { @@ -63,7 +65,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -124,7 +128,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { fields { binding_pattern { @@ -193,7 +199,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8baefc41bc78c1c5c387f78402b1d34f94665fe1 b/explorer/fuzzing/fuzzer_corpus/747118a48116697aaf5e83f4d15e75409118b8b1 similarity index 90% rename from explorer/fuzzing/fuzzer_corpus/8baefc41bc78c1c5c387f78402b1d34f94665fe1 rename to explorer/fuzzing/fuzzer_corpus/747118a48116697aaf5e83f4d15e75409118b8b1 index 67f1fb93b2d9..18c152acd9b4 100644 --- a/explorer/fuzzing/fuzzer_corpus/8baefc41bc78c1c5c387f78402b1d34f94665fe1 +++ b/explorer/fuzzing/fuzzer_corpus/747118a48116697aaf5e83f4d15e75409118b8b1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { let { pattern { @@ -19,18 +21,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -77,13 +74,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Dim" - } - } - rhs { + rewrite { + member_name: "Dim" + replacement { int_literal { value: 2 } @@ -98,7 +91,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/db3bcd11c33c4355693ee64ceade13f60cc498a5 b/explorer/fuzzing/fuzzer_corpus/74f4572d6afa47a85b20d69c03c4b5818229508b similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/db3bcd11c33c4355693ee64ceade13f60cc498a5 rename to explorer/fuzzing/fuzzer_corpus/74f4572d6afa47a85b20d69c03c4b5818229508b index 102489df8422..4245a2e59b48 100644 --- a/explorer/fuzzing/fuzzer_corpus/db3bcd11c33c4355693ee64ceade13f60cc498a5 +++ b/explorer/fuzzing/fuzzer_corpus/74f4572d6afa47a85b20d69c03c4b5818229508b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ints" + name { + name: "Ints" + } alternatives { name: "None" signature { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/47c1f4fc527c9a4a4c6cd4e313ac2e29555066cb b/explorer/fuzzing/fuzzer_corpus/750a107625f4dae089bbb0769a301289e768e3aa similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/47c1f4fc527c9a4a4c6cd4e313ac2e29555066cb rename to explorer/fuzzing/fuzzer_corpus/750a107625f4dae089bbb0769a301289e768e3aa index 43e48d4d70e0..e40a3cf77855 100644 --- a/explorer/fuzzing/fuzzer_corpus/47c1f4fc527c9a4a4c6cd4e313ac2e29555066cb +++ b/explorer/fuzzing/fuzzer_corpus/750a107625f4dae089bbb0769a301289e768e3aa @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Shape" + name { + name: "Shape" + } members { variable { binding { @@ -25,10 +27,14 @@ compilation_unit { } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -69,7 +75,9 @@ compilation_unit { } members { function { - name: "GetSetX" + name { + name: "GetSetX" + } self_pattern { addr_pattern { binding_pattern { @@ -165,6 +173,7 @@ compilation_unit { name: "x" } } + op: Plain } } statements { @@ -213,7 +222,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/95eaa007ffbbefec318e9378682df57143dc32ad b/explorer/fuzzing/fuzzer_corpus/75bf07b0ccfce55eb53f712ddb01b97724ec0fe8 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/95eaa007ffbbefec318e9378682df57143dc32ad rename to explorer/fuzzing/fuzzer_corpus/75bf07b0ccfce55eb53f712ddb01b97724ec0fe8 index 7e1c19352edb..132f8c7f84fb 100644 --- a/explorer/fuzzing/fuzzer_corpus/95eaa007ffbbefec318e9378682df57143dc32ad +++ b/explorer/fuzzing/fuzzer_corpus/75bf07b0ccfce55eb53f712ddb01b97724ec0fe8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "CompareStr" + name { + name: "CompareStr" + } param_pattern { fields { binding_pattern { @@ -73,7 +75,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6c8ba22787c4fb7090d6009ef523ac4d933c1c7a b/explorer/fuzzing/fuzzer_corpus/768d1a1eca62b0a19d89ded728ccb834470015a1 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/6c8ba22787c4fb7090d6009ef523ac4d933c1c7a rename to explorer/fuzzing/fuzzer_corpus/768d1a1eca62b0a19d89ded728ccb834470015a1 index 07288d9df1b5..7f0a66143fe3 100644 --- a/explorer/fuzzing/fuzzer_corpus/6c8ba22787c4fb7090d6009ef523ac4d933c1c7a +++ b/explorer/fuzzing/fuzzer_corpus/768d1a1eca62b0a19d89ded728ccb834470015a1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3a56c95203d25effc213b596eeb3eeb9c01682e2 b/explorer/fuzzing/fuzzer_corpus/77c33306ba5c8c2cdc3024719f87f55a2724c754 similarity index 83% rename from explorer/fuzzing/fuzzer_corpus/3a56c95203d25effc213b596eeb3eeb9c01682e2 rename to explorer/fuzzing/fuzzer_corpus/77c33306ba5c8c2cdc3024719f87f55a2724c754 index 66c56bc4aba3..4b92ea73ac87 100644 --- a/explorer/fuzzing/fuzzer_corpus/3a56c95203d25effc213b596eeb3eeb9c01682e2 +++ b/explorer/fuzzing/fuzzer_corpus/77c33306ba5c8c2cdc3024719f87f55a2724c754 @@ -4,25 +4,29 @@ compilation_unit { } is_api: true declarations { - class_declaration { - name: "C" + constraint { + name { + name: "X" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { kind: Omitted } - body { - } } } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0126fe3569132be0b4e285618c8fe5b63234a334 b/explorer/fuzzing/fuzzer_corpus/785b758dbefa9d1df1a68e97b99529245a615e0a similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/0126fe3569132be0b4e285618c8fe5b63234a334 rename to explorer/fuzzing/fuzzer_corpus/785b758dbefa9d1df1a68e97b99529245a615e0a index bd625a2b8d32..fc1da3a98da1 100644 --- a/explorer/fuzzing/fuzzer_corpus/0126fe3569132be0b4e285618c8fe5b63234a334 +++ b/explorer/fuzzing/fuzzer_corpus/785b758dbefa9d1df1a68e97b99529245a615e0a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { generic_binding { @@ -135,7 +139,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/79176b267da0dd33a6ca194a94b38a711707c24d b/explorer/fuzzing/fuzzer_corpus/79176b267da0dd33a6ca194a94b38a711707c24d new file mode 100644 index 000000000000..e1eefeb25e90 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/79176b267da0dd33a6ca194a94b38a711707c24d @@ -0,0 +1,227 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Container" + } + members { + let { + pattern { + generic_binding { + name: "Element" + type { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Front" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Element" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "A" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Container" + } + } + clauses { + rewrite { + member_name: "Element" + replacement { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + simple_member_access { + field: "Element" + object { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Front" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "B" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Container" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f97202d1fa9a38ec83beedefee620c8fabb7759a b/explorer/fuzzing/fuzzer_corpus/7953600f9a139afbc9c5259103942beeebe2137c similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/f97202d1fa9a38ec83beedefee620c8fabb7759a rename to explorer/fuzzing/fuzzer_corpus/7953600f9a139afbc9c5259103942beeebe2137c index 965241506f44..f112acad966e 100644 --- a/explorer/fuzzing/fuzzer_corpus/f97202d1fa9a38ec83beedefee620c8fabb7759a +++ b/explorer/fuzzing/fuzzer_corpus/7953600f9a139afbc9c5259103942beeebe2137c @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ade679b65c11c0087793757da14860a4ad0206b5 b/explorer/fuzzing/fuzzer_corpus/7966121e536a00b3ed0b612ec9c4129af371106e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ade679b65c11c0087793757da14860a4ad0206b5 rename to explorer/fuzzing/fuzzer_corpus/7966121e536a00b3ed0b612ec9c4129af371106e index 22802f646f6b..f968b7b3e925 100644 --- a/explorer/fuzzing/fuzzer_corpus/ade679b65c11c0087793757da14860a4ad0206b5 +++ b/explorer/fuzzing/fuzzer_corpus/7966121e536a00b3ed0b612ec9c4129af371106e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ecea59a9cb6f58e0b9019352a683f3a364f63cd8 b/explorer/fuzzing/fuzzer_corpus/797132dd445ddf47c9af603d780036bc0ffeac83 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ecea59a9cb6f58e0b9019352a683f3a364f63cd8 rename to explorer/fuzzing/fuzzer_corpus/797132dd445ddf47c9af603d780036bc0ffeac83 index 64845e63f635..6e52c1eba18b 100644 --- a/explorer/fuzzing/fuzzer_corpus/ecea59a9cb6f58e0b9019352a683f3a364f63cd8 +++ b/explorer/fuzzing/fuzzer_corpus/797132dd445ddf47c9af603d780036bc0ffeac83 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "AddMul" + name { + name: "AddMul" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Mul" + name { + name: "Mul" + } self_pattern { binding_pattern { name: "self" @@ -92,13 +98,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -115,7 +114,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -176,7 +177,9 @@ compilation_unit { } members { function { - name: "Mul" + name { + name: "Mul" + } self_pattern { binding_pattern { name: "self" @@ -239,7 +242,9 @@ compilation_unit { } declarations { class_declaration { - name: "Holder" + name { + name: "Holder" + } members { variable { binding { @@ -272,10 +277,14 @@ compilation_unit { } declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -290,7 +299,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -333,7 +344,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -376,7 +389,9 @@ compilation_unit { } members { function { - name: "Hold" + name { + name: "Hold" + } self_pattern { binding_pattern { name: "self" @@ -430,18 +445,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -499,7 +509,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -540,7 +552,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -649,7 +663,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -747,7 +763,9 @@ compilation_unit { } members { function { - name: "Hold" + name { + name: "Hold" + } self_pattern { binding_pattern { name: "self" @@ -823,7 +841,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -978,7 +998,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/bf5288c1a6c09ac6f9542dde91f8080aecf8ffc1 b/explorer/fuzzing/fuzzer_corpus/799cb0db63d5d948ca4ce3e6a438e6d03a363b07 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/bf5288c1a6c09ac6f9542dde91f8080aecf8ffc1 rename to explorer/fuzzing/fuzzer_corpus/799cb0db63d5d948ca4ce3e6a438e6d03a363b07 index e4958127b9c6..b01def49f87a 100644 --- a/explorer/fuzzing/fuzzer_corpus/bf5288c1a6c09ac6f9542dde91f8080aecf8ffc1 +++ b/explorer/fuzzing/fuzzer_corpus/799cb0db63d5d948ca4ce3e6a438e6d03a363b07 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "ReturnFalse" + name { + name: "ReturnFalse" + } param_pattern { } return_term { @@ -58,6 +60,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -74,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/79d7857c66a89562059d86a9e3ee1c3a644d50ac b/explorer/fuzzing/fuzzer_corpus/79d7857c66a89562059d86a9e3ee1c3a644d50ac new file mode 100644 index 000000000000..8cfd73595afc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/79d7857c66a89562059d86a9e3ee1c3a644d50ac @@ -0,0 +1,117 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "TwoTypes" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "U" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "X" + type { + where { + base { + identifier { + name: "TwoTypes" + } + } + clauses { + rewrite { + member_name: "U" + replacement { + operator { + op: Ptr + arguments { + designator { + name: "U" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "T" + replacement { + designator { + name: "U" + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/79f09fae3aeb20dfc1e988e2fcbd1bff13db295f b/explorer/fuzzing/fuzzer_corpus/79f09fae3aeb20dfc1e988e2fcbd1bff13db295f new file mode 100644 index 000000000000..0f004e2fae66 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/79f09fae3aeb20dfc1e988e2fcbd1bff13db295f @@ -0,0 +1,247 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Base" + } + members { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + } + } + declarations { + interface { + name { + name: "Extension" + } + members { + interface_extends { + base { + identifier { + name: "Base" + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + where { + base { + type_type_literal { + } + } + clauses { + is { + type { + designator { + name: "Self" + } + } + constraint { + identifier { + name: "Extension" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "x" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "Extension" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Extension" + } + } + members { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "i32.F" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7a5c922589df17ecc5835d3943d4e2268b75d220 b/explorer/fuzzing/fuzzer_corpus/7a5c922589df17ecc5835d3943d4e2268b75d220 new file mode 100644 index 000000000000..196a02b16004 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/7a5c922589df17ecc5835d3943d4e2268b75d220 @@ -0,0 +1,231 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "TypeLike" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + type_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + array_type_literal { + element_type { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "TypeLike" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + size { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + index { + object { + identifier { + name: "v" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + arguments { + index { + object { + identifier { + name: "v" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7abcaef173ca2d52652cb3457d945e27f7ee0aad b/explorer/fuzzing/fuzzer_corpus/7abcaef173ca2d52652cb3457d945e27f7ee0aad new file mode 100644 index 000000000000..4880b99f449a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/7abcaef173ca2d52652cb3457d945e27f7ee0aad @@ -0,0 +1,46 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + fields { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/18a346283d534bc2e8ac6bd6b83f32ab1ce8840e b/explorer/fuzzing/fuzzer_corpus/7ade8ffa35294159dd8341822eaf0045b55e0eed similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/18a346283d534bc2e8ac6bd6b83f32ab1ce8840e rename to explorer/fuzzing/fuzzer_corpus/7ade8ffa35294159dd8341822eaf0045b55e0eed index 72fd0ff963fc..3461a90708fc 100644 --- a/explorer/fuzzing/fuzzer_corpus/18a346283d534bc2e8ac6bd6b83f32ab1ce8840e +++ b/explorer/fuzzing/fuzzer_corpus/7ade8ffa35294159dd8341822eaf0045b55e0eed @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -101,6 +103,7 @@ compilation_unit { value: 2 } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/4af561fcd94fa05229187eaa34ffa63b7ad61494 b/explorer/fuzzing/fuzzer_corpus/7bacad50af2d1a03e8895abd390b606dffe73912 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/4af561fcd94fa05229187eaa34ffa63b7ad61494 rename to explorer/fuzzing/fuzzer_corpus/7bacad50af2d1a03e8895abd390b606dffe73912 index 24497eece1d6..af2b30663f0c 100644 --- a/explorer/fuzzing/fuzzer_corpus/4af561fcd94fa05229187eaa34ffa63b7ad61494 +++ b/explorer/fuzzing/fuzzer_corpus/7bacad50af2d1a03e8895abd390b606dffe73912 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5e27fc6c6ebf8aa6690eb3a0ba5dea1edcc70e1b b/explorer/fuzzing/fuzzer_corpus/7c0f663879e94a5b343b9cfbde2c12a5ef03a53c similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/5e27fc6c6ebf8aa6690eb3a0ba5dea1edcc70e1b rename to explorer/fuzzing/fuzzer_corpus/7c0f663879e94a5b343b9cfbde2c12a5ef03a53c index 2545fc4ce179..db5e25dd0139 100644 --- a/explorer/fuzzing/fuzzer_corpus/5e27fc6c6ebf8aa6690eb3a0ba5dea1edcc70e1b +++ b/explorer/fuzzing/fuzzer_corpus/7c0f663879e94a5b343b9cfbde2c12a5ef03a53c @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3598b6a104a952dfc65fad1fbd8f4d14ca233647 b/explorer/fuzzing/fuzzer_corpus/7d23fc6af8c121d6031662230dbc4c5be9cc1c71 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/3598b6a104a952dfc65fad1fbd8f4d14ca233647 rename to explorer/fuzzing/fuzzer_corpus/7d23fc6af8c121d6031662230dbc4c5be9cc1c71 index bac3f7db9845..aba036ad7eb2 100644 --- a/explorer/fuzzing/fuzzer_corpus/3598b6a104a952dfc65fad1fbd8f4d14ca233647 +++ b/explorer/fuzzing/fuzzer_corpus/7d23fc6af8c121d6031662230dbc4c5be9cc1c71 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -81,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d17cefb7b011dede9bbfdb0aa80ac6b15673421d b/explorer/fuzzing/fuzzer_corpus/7e11ddd6225ab4f5b4768bb3e57813b7d00efd49 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/d17cefb7b011dede9bbfdb0aa80ac6b15673421d rename to explorer/fuzzing/fuzzer_corpus/7e11ddd6225ab4f5b4768bb3e57813b7d00efd49 index f9c8c3774714..9a9f909711e5 100644 --- a/explorer/fuzzing/fuzzer_corpus/d17cefb7b011dede9bbfdb0aa80ac6b15673421d +++ b/explorer/fuzzing/fuzzer_corpus/7e11ddd6225ab4f5b4768bb3e57813b7d00efd49 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "I" + name { + name: "I" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -63,18 +67,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -103,7 +102,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -252,7 +253,9 @@ compilation_unit { } declarations { function { - name: "Run" + name { + name: "Run" + } deduced_parameters { name: "V" type { @@ -607,7 +610,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1c833bb7c794465474634ef5f6ee0fa9380955ca b/explorer/fuzzing/fuzzer_corpus/7e2746a39201e0372d5512b5d07ec968fd1296e8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1c833bb7c794465474634ef5f6ee0fa9380955ca rename to explorer/fuzzing/fuzzer_corpus/7e2746a39201e0372d5512b5d07ec968fd1296e8 index 963e6906032c..88e807ca35e0 100644 --- a/explorer/fuzzing/fuzzer_corpus/1c833bb7c794465474634ef5f6ee0fa9380955ca +++ b/explorer/fuzzing/fuzzer_corpus/7e2746a39201e0372d5512b5d07ec968fd1296e8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ints" + name { + name: "Ints" + } alternatives { name: "None" signature { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -204,6 +208,7 @@ compilation_unit { } } } + op: Plain } } } @@ -265,6 +270,7 @@ compilation_unit { } } } + op: Plain } } } @@ -315,6 +321,7 @@ compilation_unit { value: 2 } } + op: Plain } } } @@ -375,6 +382,7 @@ compilation_unit { } } } + op: Plain } } } @@ -427,6 +435,7 @@ compilation_unit { } } } + op: Plain } } } @@ -477,6 +486,7 @@ compilation_unit { value: 5 } } + op: Plain } } } @@ -498,7 +508,9 @@ compilation_unit { } declarations { choice { - name: "MoreInts" + name { + name: "MoreInts" + } alternatives { name: "None" signature { diff --git a/explorer/fuzzing/fuzzer_corpus/4068bf50f059b8f7e57a8dd291c1504c15104a7e b/explorer/fuzzing/fuzzer_corpus/7e2a2d5f2ca21106e70dd832ab2c795d31dd8c17 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/4068bf50f059b8f7e57a8dd291c1504c15104a7e rename to explorer/fuzzing/fuzzer_corpus/7e2a2d5f2ca21106e70dd832ab2c795d31dd8c17 index 209c3c51e577..2e4787f3fd98 100644 --- a/explorer/fuzzing/fuzzer_corpus/4068bf50f059b8f7e57a8dd291c1504c15104a7e +++ b/explorer/fuzzing/fuzzer_corpus/7e2a2d5f2ca21106e70dd832ab2c795d31dd8c17 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e54033442e8e0bcc79163730eb8bb705f96a16ab b/explorer/fuzzing/fuzzer_corpus/7e3b1ea1f2b40cfe7dd4ce72a43cd8b5e00637f0 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/e54033442e8e0bcc79163730eb8bb705f96a16ab rename to explorer/fuzzing/fuzzer_corpus/7e3b1ea1f2b40cfe7dd4ce72a43cd8b5e00637f0 index 2eea37edbc00..292405932d2d 100644 --- a/explorer/fuzzing/fuzzer_corpus/e54033442e8e0bcc79163730eb8bb705f96a16ab +++ b/explorer/fuzzing/fuzzer_corpus/7e3b1ea1f2b40cfe7dd4ce72a43cd8b5e00637f0 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "test" + name { + name: "test" + } param_pattern { fields { binding_pattern { @@ -43,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/4d41ecad50244310db98271c3707cef0b04bc97b b/explorer/fuzzing/fuzzer_corpus/7e9eeb66c47e49e06eeff2d93fb401f467c30fdf similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/4d41ecad50244310db98271c3707cef0b04bc97b rename to explorer/fuzzing/fuzzer_corpus/7e9eeb66c47e49e06eeff2d93fb401f467c30fdf index 64942348b496..d93827bbdd49 100644 --- a/explorer/fuzzing/fuzzer_corpus/4d41ecad50244310db98271c3707cef0b04bc97b +++ b/explorer/fuzzing/fuzzer_corpus/7e9eeb66c47e49e06eeff2d93fb401f467c30fdf @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "SwizzleWith" + name { + name: "SwizzleWith" + } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -48,13 +52,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -83,7 +80,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -159,7 +158,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -251,7 +252,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7ef42cdd9381bb7dc751b0530516414d10b58d68 b/explorer/fuzzing/fuzzer_corpus/7ef42cdd9381bb7dc751b0530516414d10b58d68 new file mode 100644 index 000000000000..21b083c51a0b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/7ef42cdd9381bb7dc751b0530516414d10b58d68 @@ -0,0 +1,52 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "a" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/39f118ee2121de551414b80dca0c8daa35c3b987 b/explorer/fuzzing/fuzzer_corpus/7f260f482af7146c582240a9b8de772dcdffe0f3 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/39f118ee2121de551414b80dca0c8daa35c3b987 rename to explorer/fuzzing/fuzzer_corpus/7f260f482af7146c582240a9b8de772dcdffe0f3 index 490d70171a39..4f2c6576b1b3 100644 --- a/explorer/fuzzing/fuzzer_corpus/39f118ee2121de551414b80dca0c8daa35c3b987 +++ b/explorer/fuzzing/fuzzer_corpus/7f260f482af7146c582240a9b8de772dcdffe0f3 @@ -5,13 +5,8 @@ compilation_unit { is_api: true declarations { interface { - name: "I" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "I" } } } @@ -31,7 +26,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { generic_binding { @@ -180,7 +177,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e43d3ef85d9d38a38672ec93544d045b1c94141a b/explorer/fuzzing/fuzzer_corpus/7fddec4675773d06799615ff6bfa69d4b906b353 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/e43d3ef85d9d38a38672ec93544d045b1c94141a rename to explorer/fuzzing/fuzzer_corpus/7fddec4675773d06799615ff6bfa69d4b906b353 index bca0f11072c0..002139cab047 100644 --- a/explorer/fuzzing/fuzzer_corpus/e43d3ef85d9d38a38672ec93544d045b1c94141a +++ b/explorer/fuzzing/fuzzer_corpus/7fddec4675773d06799615ff6bfa69d4b906b353 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "SetX" + name { + name: "SetX" + } self_pattern { binding_pattern { name: "self" @@ -95,6 +101,7 @@ compilation_unit { value: 10 } } + op: Plain } } } @@ -134,7 +141,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3b0da1a894c91d614701f7ccc88ed10c7e801457 b/explorer/fuzzing/fuzzer_corpus/8037762d5a218fae491d02aa757fb3369bda9426 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/3b0da1a894c91d614701f7ccc88ed10c7e801457 rename to explorer/fuzzing/fuzzer_corpus/8037762d5a218fae491d02aa757fb3369bda9426 index c1f0295e73f6..406b783e419f 100644 --- a/explorer/fuzzing/fuzzer_corpus/3b0da1a894c91d614701f7ccc88ed10c7e801457 +++ b/explorer/fuzzing/fuzzer_corpus/8037762d5a218fae491d02aa757fb3369bda9426 @@ -5,12 +5,16 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -38,7 +42,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/8093a8763a55e91e83b621e091f6da25cffc7dae b/explorer/fuzzing/fuzzer_corpus/8093a8763a55e91e83b621e091f6da25cffc7dae new file mode 100644 index 000000000000..63ad650ee43e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/8093a8763a55e91e83b621e091f6da25cffc7dae @@ -0,0 +1,93 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + int_literal { + value: 0 + } + } + clauses { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + statement { + block { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/811069452ad656f7050892b008d38f6affd52cd5 b/explorer/fuzzing/fuzzer_corpus/811069452ad656f7050892b008d38f6affd52cd5 new file mode 100644 index 000000000000..bd681dd2607f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/811069452ad656f7050892b008d38f6affd52cd5 @@ -0,0 +1,689 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "CompareEqualValues" + } + deduced_parameters { + name: "T" + type { + call { + function { + identifier { + name: "EqWith" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "format" + type { + expression_pattern { + expression { + string_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + if_expression { + condition { + operator { + op: Eq + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + if_expression { + condition { + operator { + op: NotEq + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + then_expression { + int_literal { + value: 0 + } + } + else_expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "CompareDifferentValues" + } + deduced_parameters { + name: "U" + type { + call { + function { + identifier { + name: "EqWith" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "format" + type { + expression_pattern { + expression { + string_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + if_expression { + condition { + operator { + op: Eq + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + then_expression { + int_literal { + value: 0 + } + } + else_expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + if_expression { + condition { + operator { + op: NotEq + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "CompareAll" + } + deduced_parameters { + name: "V" + type { + call { + function { + identifier { + name: "EqWith" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "format" + type { + expression_pattern { + expression { + string_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareEqualValues" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "a" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareEqualValues" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + identifier { + name: "b" + } + } + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareDifferentValues" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareDifferentValues" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "format" + } + } + fields { + identifier { + name: "b" + } + } + fields { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareAll" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "bool: {0}" + } + } + fields { + bool_literal { + value: false + } + } + fields { + bool_literal { + value: true + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareAll" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "string: {0}" + } + } + fields { + string_literal { + value: "hello" + } + } + fields { + string_literal { + value: "world" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "CompareAll" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "int: {0}" + } + } + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/81bfc600dcb7e3e016fffe7399b9186b0da24867 b/explorer/fuzzing/fuzzer_corpus/81bfc600dcb7e3e016fffe7399b9186b0da24867 new file mode 100644 index 000000000000..6da43a552082 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/81bfc600dcb7e3e016fffe7399b9186b0da24867 @@ -0,0 +1,347 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "A" + } + members { + let { + pattern { + generic_binding { + name: "AResult" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "B" + } + members { + let { + pattern { + generic_binding { + name: "BResult" + type { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "I" + } + members { + let { + pattern { + generic_binding { + name: "X" + type { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "Y" + type { + simple_member_access { + field: "AResult" + object { + simple_member_access { + field: "BResult" + object { + identifier { + name: "X" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "CA" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "AResult" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "CB" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "B" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "BResult" + replacement { + identifier { + name: "CA" + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "CI" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "I" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "X" + replacement { + identifier { + name: "CB" + } + } + } + } + clauses { + rewrite { + member_name: "Y" + replacement { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "CI" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + simple_member_access { + field: "Y" + object { + call { + function { + identifier { + name: "I" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2c14058de399008d689923991bc195c29001efcc b/explorer/fuzzing/fuzzer_corpus/82062a4058a65188662e584e9290464c5cbec42f similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/2c14058de399008d689923991bc195c29001efcc rename to explorer/fuzzing/fuzzer_corpus/82062a4058a65188662e584e9290464c5cbec42f index e04fa874a5c9..307a45b37e12 100644 --- a/explorer/fuzzing/fuzzer_corpus/2c14058de399008d689923991bc195c29001efcc +++ b/explorer/fuzzing/fuzzer_corpus/82062a4058a65188662e584e9290464c5cbec42f @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8231f88ed019d7c867f63fd99a72ff83c877ce42 b/explorer/fuzzing/fuzzer_corpus/8231f88ed019d7c867f63fd99a72ff83c877ce42 new file mode 100644 index 000000000000..ec3e00112f5e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/8231f88ed019d7c867f63fd99a72ff83c877ce42 @@ -0,0 +1,69 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "Point" + } + members { + function { + name { + qualifiers: "Point" + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/391137139a4e8562e68024f65f38a043a493931b b/explorer/fuzzing/fuzzer_corpus/824b055dca1a7fc530205097c771552062b3c481 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/391137139a4e8562e68024f65f38a043a493931b rename to explorer/fuzzing/fuzzer_corpus/824b055dca1a7fc530205097c771552062b3c481 index 6acac945d29a..26751a99ecb8 100644 --- a/explorer/fuzzing/fuzzer_corpus/391137139a4e8562e68024f65f38a043a493931b +++ b/explorer/fuzzing/fuzzer_corpus/824b055dca1a7fc530205097c771552062b3c481 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -46,6 +48,7 @@ compilation_unit { value: 1 } } + op: Add } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/34d3923f8e4a9ceb3ff3d44e54343b1f31ecfd15 b/explorer/fuzzing/fuzzer_corpus/84467b7cbaaa2931dc227bb0e46c3adac0ede663 similarity index 86% rename from explorer/fuzzing/fuzzer_corpus/34d3923f8e4a9ceb3ff3d44e54343b1f31ecfd15 rename to explorer/fuzzing/fuzzer_corpus/84467b7cbaaa2931dc227bb0e46c3adac0ede663 index 1d6320e4aa58..ef269bf82807 100644 --- a/explorer/fuzzing/fuzzer_corpus/34d3923f8e4a9ceb3ff3d44e54343b1f31ecfd15 +++ b/explorer/fuzzing/fuzzer_corpus/84467b7cbaaa2931dc227bb0e46c3adac0ede663 @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { alias { - name: "B" + name { + name: "B" + } target { where { base { @@ -43,7 +40,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9ced4acd9a7fd5cbf0f23b46b47a0f6976529730 b/explorer/fuzzing/fuzzer_corpus/84f33da279e8094d8b60651abed12669677a5c60 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/9ced4acd9a7fd5cbf0f23b46b47a0f6976529730 rename to explorer/fuzzing/fuzzer_corpus/84f33da279e8094d8b60651abed12669677a5c60 index 96551b946adc..bdc02395a4a9 100644 --- a/explorer/fuzzing/fuzzer_corpus/9ced4acd9a7fd5cbf0f23b46b47a0f6976529730 +++ b/explorer/fuzzing/fuzzer_corpus/84f33da279e8094d8b60651abed12669677a5c60 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "CompareStr" + name { + name: "CompareStr" + } param_pattern { fields { binding_pattern { @@ -73,7 +75,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/84f60d58147f313add8f2d4c2cca5ce728b51e9c b/explorer/fuzzing/fuzzer_corpus/84f60d58147f313add8f2d4c2cca5ce728b51e9c new file mode 100644 index 000000000000..3b5fc9097b8b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/84f60d58147f313add8f2d4c2cca5ce728b51e9c @@ -0,0 +1,89 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + auto_pattern { + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "p" + } + } + rhs { + struct_literal { + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2ccfd82373462cdd54eb11ff6eb0c71d47bb07c5 b/explorer/fuzzing/fuzzer_corpus/8506098ed285fa6cf6887ef694c68ff07fbac234 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/2ccfd82373462cdd54eb11ff6eb0c71d47bb07c5 rename to explorer/fuzzing/fuzzer_corpus/8506098ed285fa6cf6887ef694c68ff07fbac234 index 8b3a537900be..006303ebecae 100644 --- a/explorer/fuzzing/fuzzer_corpus/2ccfd82373462cdd54eb11ff6eb0c71d47bb07c5 +++ b/explorer/fuzzing/fuzzer_corpus/8506098ed285fa6cf6887ef694c68ff07fbac234 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,18 +70,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -136,7 +137,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -161,7 +164,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -250,7 +255,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -317,7 +324,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -444,7 +453,9 @@ compilation_unit { } declarations { function { - name: "Sum" + name { + name: "Sum" + } deduced_parameters { name: "E" type { @@ -559,6 +570,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -591,6 +603,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -607,7 +620,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/852294518955e4133ebe40d96ddd483ea675f576 b/explorer/fuzzing/fuzzer_corpus/852294518955e4133ebe40d96ddd483ea675f576 new file mode 100644 index 000000000000..72e433c3f7af --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/852294518955e4133ebe40d96ddd483ea675f576 @@ -0,0 +1,1052 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Hashable" + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Potato" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "Hashable" + } + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Potato.(Hashable.Hash)" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Potato.Hash" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Maker" + } + members { + let { + pattern { + generic_binding { + name: "Result" + type { + identifier { + name: "Hashable" + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Result" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Hashable" + } + } + members { + function { + name { + name: "Hash" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "i32.Hash" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Maker" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Maker" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Hash" + object { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "H" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Maker" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "Potato" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Hash" + object { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "I" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Maker" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "Potato" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Potato" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Hash" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "IntFactory" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "Maker" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + int_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "PotatoFactory" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "Maker" + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "Potato" + } + } + } + } + } + } + members { + function { + name { + name: "Make" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Potato" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "f" + type { + expression_pattern { + expression { + identifier { + name: "IntFactory" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "g" + type { + expression_pattern { + expression { + identifier { + name: "PotatoFactory" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "f" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "f" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "g" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "g" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + call { + function { + identifier { + name: "I" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "g" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5880e23795708e905d50bc8e9e0d62ac9a5f42bc b/explorer/fuzzing/fuzzer_corpus/85658e57b27175b7be324b93be25409f5cc2d155 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5880e23795708e905d50bc8e9e0d62ac9a5f42bc rename to explorer/fuzzing/fuzzer_corpus/85658e57b27175b7be324b93be25409f5cc2d155 index 28f01772fb36..1140df3dc885 100644 --- a/explorer/fuzzing/fuzzer_corpus/5880e23795708e905d50bc8e9e0d62ac9a5f42bc +++ b/explorer/fuzzing/fuzzer_corpus/85658e57b27175b7be324b93be25409f5cc2d155 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "B" + name { + name: "B" + } members { variable { binding { @@ -23,7 +25,9 @@ compilation_unit { } members { function { - name: "GetSetX" + name { + name: "GetSetX" + } self_pattern { addr_pattern { binding_pattern { @@ -119,6 +123,7 @@ compilation_unit { name: "x" } } + op: Plain } } statements { @@ -137,7 +142,9 @@ compilation_unit { } declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -158,7 +165,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1874f41efe6cbac77f4239267d6f05f9f5e26864 b/explorer/fuzzing/fuzzer_corpus/856d1a339b7da505ec405b29e2ad71128a2cd042 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1874f41efe6cbac77f4239267d6f05f9f5e26864 rename to explorer/fuzzing/fuzzer_corpus/856d1a339b7da505ec405b29e2ad71128a2cd042 index fa7e73e2063d..9a53204b2189 100644 --- a/explorer/fuzzing/fuzzer_corpus/1874f41efe6cbac77f4239267d6f05f9f5e26864 +++ b/explorer/fuzzing/fuzzer_corpus/856d1a339b7da505ec405b29e2ad71128a2cd042 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0e3ba8c056c66dd97f847130384042762743541f b/explorer/fuzzing/fuzzer_corpus/85d5189cc7d0ac992ae28f0eafcc5d4528482f32 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/0e3ba8c056c66dd97f847130384042762743541f rename to explorer/fuzzing/fuzzer_corpus/85d5189cc7d0ac992ae28f0eafcc5d4528482f32 index b5398c03fd80..1084be3d8a1b 100644 --- a/explorer/fuzzing/fuzzer_corpus/0e3ba8c056c66dd97f847130384042762743541f +++ b/explorer/fuzzing/fuzzer_corpus/85d5189cc7d0ac992ae28f0eafcc5d4528482f32 @@ -5,12 +5,16 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -38,7 +42,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/6715a67f217226aa888ed4b6768d8206279dd6e3 b/explorer/fuzzing/fuzzer_corpus/86538c458c4469fd4394a2cf09c5d38bf06dde01 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/6715a67f217226aa888ed4b6768d8206279dd6e3 rename to explorer/fuzzing/fuzzer_corpus/86538c458c4469fd4394a2cf09c5d38bf06dde01 index 7ff74f5e1593..420037ef10de 100644 --- a/explorer/fuzzing/fuzzer_corpus/6715a67f217226aa888ed4b6768d8206279dd6e3 +++ b/explorer/fuzzing/fuzzer_corpus/86538c458c4469fd4394a2cf09c5d38bf06dde01 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -50,7 +52,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -120,7 +124,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/865cb6ed43d05b0cd8865aca8e220a5f2f1c8ee2 b/explorer/fuzzing/fuzzer_corpus/865cb6ed43d05b0cd8865aca8e220a5f2f1c8ee2 new file mode 100644 index 000000000000..e40e76ed3db1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/865cb6ed43d05b0cd8865aca8e220a5f2f1c8ee2 @@ -0,0 +1,61 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + operator { + op: BitwiseAnd + arguments { + int_type_literal { + } + } + arguments { + type_type_literal { + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/8cc3347e8e6ae3631e051b66067b6763f223f2a0 b/explorer/fuzzing/fuzzer_corpus/867ca2a85f7d32348f245c8b4562d19256c4bdcd similarity index 58% rename from explorer/fuzzing/fuzzer_corpus/8cc3347e8e6ae3631e051b66067b6763f223f2a0 rename to explorer/fuzzing/fuzzer_corpus/867ca2a85f7d32348f245c8b4562d19256c4bdcd index 366f883133d6..519b765b10ca 100644 --- a/explorer/fuzzing/fuzzer_corpus/8cc3347e8e6ae3631e051b66067b6763f223f2a0 +++ b/explorer/fuzzing/fuzzer_corpus/867ca2a85f7d32348f245c8b4562d19256c4bdcd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -178,7 +180,7 @@ compilation_unit { name: "n" expression { int_literal { - value: 4 + value: 1 } } } @@ -204,7 +206,129 @@ compilation_unit { } arguments { int_literal { - value: 1 + value: 2 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 5 + } + } + op: Or + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: BitwiseOr + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 12 + } + } + } + } + } + } } } } @@ -214,13 +338,8 @@ compilation_unit { statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/1d9e0b21f3ae7bf7a8f19767054f3a72bc4b85a2 b/explorer/fuzzing/fuzzer_corpus/869a572f42c6d5ba437c45a7187b350b1bb27c94 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/1d9e0b21f3ae7bf7a8f19767054f3a72bc4b85a2 rename to explorer/fuzzing/fuzzer_corpus/869a572f42c6d5ba437c45a7187b350b1bb27c94 index 6a688237843b..9324338dcbb8 100644 --- a/explorer/fuzzing/fuzzer_corpus/1d9e0b21f3ae7bf7a8f19767054f3a72bc4b85a2 +++ b/explorer/fuzzing/fuzzer_corpus/869a572f42c6d5ba437c45a7187b350b1bb27c94 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Id" + name { + name: "Id" + } param_pattern { fields { binding_pattern { @@ -39,7 +41,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/86b24842438ed47cadc8ba57576d5bb33a35df88 b/explorer/fuzzing/fuzzer_corpus/86b24842438ed47cadc8ba57576d5bb33a35df88 new file mode 100644 index 000000000000..3a0649b8b3e2 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/86b24842438ed47cadc8ba57576d5bb33a35df88 @@ -0,0 +1,253 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "ConvertsFromInt" + } + members { + interface_impl { + impl_type { + int_type_literal { + } + } + constraint { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "ConvertIntTo" + } + param_pattern { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "ConvertsFromInt" + } + } + } + } + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "IntHolder" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "IntHolder" + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "IntHolder" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "IntHolder" + } + } + interface { + identifier { + name: "ConvertsFromInt" + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + identifier { + name: "ConvertIntTo" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "IntHolder" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/86d67468feb4d4a3ebded86e6007537cf79aaa7c b/explorer/fuzzing/fuzzer_corpus/86d67468feb4d4a3ebded86e6007537cf79aaa7c new file mode 100644 index 000000000000..9032b511ace3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/86d67468feb4d4a3ebded86e6007537cf79aaa7c @@ -0,0 +1,131 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Get" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Get" + object { + operator { + op: As + arguments { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + arguments { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/46016e5c590960d6537bb54994668e5530ba367b b/explorer/fuzzing/fuzzer_corpus/872a1696dda48bb21c65aaf1be4c599c0ba7ecf8 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/46016e5c590960d6537bb54994668e5530ba367b rename to explorer/fuzzing/fuzzer_corpus/872a1696dda48bb21c65aaf1be4c599c0ba7ecf8 index 83ad0d9084eb..72f925ca5e9a 100644 --- a/explorer/fuzzing/fuzzer_corpus/46016e5c590960d6537bb54994668e5530ba367b +++ b/explorer/fuzzing/fuzzer_corpus/872a1696dda48bb21c65aaf1be4c599c0ba7ecf8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -43,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -134,6 +138,7 @@ compilation_unit { name: "a" } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/874473ca5ab1dae91e7c4a71db943c174f1c39cd b/explorer/fuzzing/fuzzer_corpus/874473ca5ab1dae91e7c4a71db943c174f1c39cd new file mode 100644 index 000000000000..2c9ba370c22c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/874473ca5ab1dae91e7c4a71db943c174f1c39cd @@ -0,0 +1,72 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "C" + } + alternatives { + name: "X" + signature { + } + } + alternatives { + name: "Y" + signature { + fields { + if_expression { + condition { + simple_member_access { + field: "X" + object { + identifier { + name: "C" + } + } + } + } + then_expression { + int_type_literal { + } + } + else_expression { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7c6dbdf85b299b6d8719132bd8ac732f2bd8e460 b/explorer/fuzzing/fuzzer_corpus/879519ec3f915d5bec166b7c1adbea9be016060b similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7c6dbdf85b299b6d8719132bd8ac732f2bd8e460 rename to explorer/fuzzing/fuzzer_corpus/879519ec3f915d5bec166b7c1adbea9be016060b index a942d0a8a3cc..1268d0c745c8 100644 --- a/explorer/fuzzing/fuzzer_corpus/7c6dbdf85b299b6d8719132bd8ac732f2bd8e460 +++ b/explorer/fuzzing/fuzzer_corpus/879519ec3f915d5bec166b7c1adbea9be016060b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -65,6 +67,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -93,6 +96,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/1791a58953862700da2eb1b1372b10d82366a250 b/explorer/fuzzing/fuzzer_corpus/8837f02cbe18a4fc33680ebb3e38bf767537a0d3 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1791a58953862700da2eb1b1372b10d82366a250 rename to explorer/fuzzing/fuzzer_corpus/8837f02cbe18a4fc33680ebb3e38bf767537a0d3 index 33c77f441f9b..562524fe1ac6 100644 --- a/explorer/fuzzing/fuzzer_corpus/1791a58953862700da2eb1b1372b10d82366a250 +++ b/explorer/fuzzing/fuzzer_corpus/8837f02cbe18a4fc33680ebb3e38bf767537a0d3 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { fields { binding_pattern { @@ -89,7 +93,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -205,7 +211,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/61507506d828131fa1d7a748a0ba286f527f9f5d b/explorer/fuzzing/fuzzer_corpus/89bf648a72b186cde6349d5948d0fa6d5ad455de similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/61507506d828131fa1d7a748a0ba286f527f9f5d rename to explorer/fuzzing/fuzzer_corpus/89bf648a72b186cde6349d5948d0fa6d5ad455de index 4441ddce5a87..e0e63ff590c5 100644 --- a/explorer/fuzzing/fuzzer_corpus/61507506d828131fa1d7a748a0ba286f527f9f5d +++ b/explorer/fuzzing/fuzzer_corpus/89bf648a72b186cde6349d5948d0fa6d5ad455de @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "X" + name { + name: "X" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -16,13 +20,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -39,7 +36,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -53,7 +52,9 @@ compilation_unit { } declarations { function { - name: "G" + name { + name: "G" + } deduced_parameters { name: "T" type { @@ -121,7 +122,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/be78316bb9ec1686ddfa3c5643d8f5b9d898ad7d b/explorer/fuzzing/fuzzer_corpus/8a565b071d627367b678eadfe0000ad02312a51f similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/be78316bb9ec1686ddfa3c5643d8f5b9d898ad7d rename to explorer/fuzzing/fuzzer_corpus/8a565b071d627367b678eadfe0000ad02312a51f index 0917098cff34..35d3e522f4ac 100644 --- a/explorer/fuzzing/fuzzer_corpus/be78316bb9ec1686ddfa3c5643d8f5b9d898ad7d +++ b/explorer/fuzzing/fuzzer_corpus/8a565b071d627367b678eadfe0000ad02312a51f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "LazyEq" + name { + name: "LazyEq" + } members { variable { binding { @@ -63,7 +65,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -124,7 +128,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } param_pattern { fields { binding_pattern { @@ -193,7 +199,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a6165b09ea539eb68053fbfa06d2d77589881194 b/explorer/fuzzing/fuzzer_corpus/8adf65cc00034e071aa55d64643de66f92e08cb4 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a6165b09ea539eb68053fbfa06d2d77589881194 rename to explorer/fuzzing/fuzzer_corpus/8adf65cc00034e071aa55d64643de66f92e08cb4 index 117dd25eae6e..b3185c53248a 100644 --- a/explorer/fuzzing/fuzzer_corpus/a6165b09ea539eb68053fbfa06d2d77589881194 +++ b/explorer/fuzzing/fuzzer_corpus/8adf65cc00034e071aa55d64643de66f92e08cb4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8af1e91a050ed3a94b03ae4eaaa4ae65d8e5975c b/explorer/fuzzing/fuzzer_corpus/8af1e91a050ed3a94b03ae4eaaa4ae65d8e5975c new file mode 100644 index 000000000000..274670a5491f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/8af1e91a050ed3a94b03ae4eaaa4ae65d8e5975c @@ -0,0 +1,1669 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "AB" + } + alternatives { + name: "A" + signature { + } + } + alternatives { + name: "B" + signature { + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "AB" + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 6 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 7 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 8 + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/8b399fee75055c239d6e3a6324e4c5696b9cf365 b/explorer/fuzzing/fuzzer_corpus/8b399fee75055c239d6e3a6324e4c5696b9cf365 new file mode 100644 index 000000000000..ff0131990ba4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/8b399fee75055c239d6e3a6324e4c5696b9cf365 @@ -0,0 +1,490 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + impl { + kind: ExternalImpl + impl_type { + struct_type_literal { + fields { + name: "x" + expression { + int_type_literal { + } + } + } + fields { + name: "y" + expression { + int_type_literal { + } + } + } + } + } + interface { + call { + function { + identifier { + name: "EqWith" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Self" + } + } + } + } + } + } + members { + function { + name { + name: "Equal" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: And + arguments { + operator { + op: Eq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + arguments { + operator { + op: Eq + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "NotEqual" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Or + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "t1" + type { + expression_pattern { + expression { + struct_type_literal { + fields { + name: "x" + expression { + int_type_literal { + } + } + } + fields { + name: "y" + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 5 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "t2" + type { + expression_pattern { + expression { + struct_type_literal { + fields { + name: "x" + expression { + int_type_literal { + } + } + } + fields { + name: "y" + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 5 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "t1 == t2: {0}" + } + } + fields { + if_expression { + condition { + operator { + op: Eq + arguments { + identifier { + name: "t1" + } + } + arguments { + identifier { + name: "t2" + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "t1 != t2: {0}" + } + } + fields { + if_expression { + condition { + operator { + op: NotEq + arguments { + identifier { + name: "t1" + } + } + arguments { + identifier { + name: "t2" + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f8b0b8c01e46fe26a68c42f31dcd54a8fddbf011 b/explorer/fuzzing/fuzzer_corpus/8b3b56d79337df581f59f424f87fa05b9d3b9b9f similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/f8b0b8c01e46fe26a68c42f31dcd54a8fddbf011 rename to explorer/fuzzing/fuzzer_corpus/8b3b56d79337df581f59f424f87fa05b9d3b9b9f index 93c8993c7884..b5c08e54721a 100644 --- a/explorer/fuzzing/fuzzer_corpus/f8b0b8c01e46fe26a68c42f31dcd54a8fddbf011 +++ b/explorer/fuzzing/fuzzer_corpus/8b3b56d79337df581f59f424f87fa05b9d3b9b9f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "A" + name { + name: "A" + } alternatives { name: "Value" signature { @@ -44,7 +46,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -114,7 +118,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5bd05de92a0614fd1b2821395bedcc8eb548161d b/explorer/fuzzing/fuzzer_corpus/8d39f5c54290acb5e80f4c894eb4c9a9b4034079 similarity index 67% rename from explorer/fuzzing/fuzzer_corpus/5bd05de92a0614fd1b2821395bedcc8eb548161d rename to explorer/fuzzing/fuzzer_corpus/8d39f5c54290acb5e80f4c894eb4c9a9b4034079 index cdc183b72d56..e0165e4be48d 100644 --- a/explorer/fuzzing/fuzzer_corpus/5bd05de92a0614fd1b2821395bedcc8eb548161d +++ b/explorer/fuzzing/fuzzer_corpus/8d39f5c54290acb5e80f4c894eb4c9a9b4034079 @@ -44,7 +44,9 @@ compilation_unit { } members { function { - name: "Equal" + name { + name: "Equal" + } self_pattern { binding_pattern { name: "self" @@ -145,11 +147,118 @@ compilation_unit { } } } + members { + function { + name { + name: "NotEqual" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Or + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -228,6 +337,13 @@ compilation_unit { } } } + fields { + name: "y" + expression { + int_type_literal { + } + } + } } } } @@ -244,6 +360,14 @@ compilation_unit { } } } + fields { + name: "y" + expression { + int_literal { + value: 4 + } + } + } } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/5883a059833000a37165e1383392ba315ad878c4 b/explorer/fuzzing/fuzzer_corpus/8d8fc98ec23cae408d8ff32f0e7de3ba3944bbd7 similarity index 77% rename from explorer/fuzzing/fuzzer_corpus/5883a059833000a37165e1383392ba315ad878c4 rename to explorer/fuzzing/fuzzer_corpus/8d8fc98ec23cae408d8ff32f0e7de3ba3944bbd7 index 350e3e0d6b4f..883a8ef1d9b5 100644 --- a/explorer/fuzzing/fuzzer_corpus/5883a059833000a37165e1383392ba315ad878c4 +++ b/explorer/fuzzing/fuzzer_corpus/8d8fc98ec23cae408d8ff32f0e7de3ba3944bbd7 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "HasType" + name { + name: "HasType" + } members { let { pattern { @@ -19,13 +21,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -43,26 +38,18 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "T" - } - } - rhs { + rewrite { + member_name: "T" + replacement { int_type_literal { } } } } clauses { - equals { - lhs { - designator { - name: "T" - } - } - rhs { + rewrite { + member_name: "T" + replacement { struct_type_literal { fields { name: "a" @@ -81,7 +68,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/92908c828d6194488cf2303968d6a6fb6ef583bb b/explorer/fuzzing/fuzzer_corpus/8e3f4815a1ee1b0f4ba0e22948671d0ab521ffcc similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/92908c828d6194488cf2303968d6a6fb6ef583bb rename to explorer/fuzzing/fuzzer_corpus/8e3f4815a1ee1b0f4ba0e22948671d0ab521ffcc index acc6dedee7e3..9c7bc5ba3f01 100644 --- a/explorer/fuzzing/fuzzer_corpus/92908c828d6194488cf2303968d6a6fb6ef583bb +++ b/explorer/fuzzing/fuzzer_corpus/8e3f4815a1ee1b0f4ba0e22948671d0ab521ffcc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -62,7 +64,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d569c23ac65792c50f2cd74cd81cbb4b85cdde91 b/explorer/fuzzing/fuzzer_corpus/8e575a88fb791bc74ca549a648e40595728c462e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d569c23ac65792c50f2cd74cd81cbb4b85cdde91 rename to explorer/fuzzing/fuzzer_corpus/8e575a88fb791bc74ca549a648e40595728c462e index 77536b84d0f3..df07194bed46 100644 --- a/explorer/fuzzing/fuzzer_corpus/d569c23ac65792c50f2cd74cd81cbb4b85cdde91 +++ b/explorer/fuzzing/fuzzer_corpus/8e575a88fb791bc74ca549a648e40595728c462e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ints" + name { + name: "Ints" + } alternatives { name: "None" signature { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -227,6 +231,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -241,6 +246,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -255,6 +261,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -269,6 +276,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -283,6 +291,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/8e953633bcf1caaea59b180787b3734dceeb50da b/explorer/fuzzing/fuzzer_corpus/8e953633bcf1caaea59b180787b3734dceeb50da deleted file mode 100644 index 79830e60d90b..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/8e953633bcf1caaea59b180787b3734dceeb50da +++ /dev/null @@ -1,93 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - function { - name: "f" - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_literal { - value: 42 - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_expression_statement { - expression { - operator { - op: Sub - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_expression_statement { - expression { - call { - function { - identifier { - name: "f" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/c07f05ca01ccca7d904f0968784a9862a3fc54b4 b/explorer/fuzzing/fuzzer_corpus/8e9bcbf7165dd788f41880e494a6b34178c818d9 similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/c07f05ca01ccca7d904f0968784a9862a3fc54b4 rename to explorer/fuzzing/fuzzer_corpus/8e9bcbf7165dd788f41880e494a6b34178c818d9 index 198820c35007..38b6152e10c0 100644 --- a/explorer/fuzzing/fuzzer_corpus/c07f05ca01ccca7d904f0968784a9862a3fc54b4 +++ b/explorer/fuzzing/fuzzer_corpus/8e9bcbf7165dd788f41880e494a6b34178c818d9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ch" + name { + name: "Ch" + } alternatives { name: "Opt" signature { @@ -20,7 +22,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d5270649631faab3d3ae0d50aa13cb6c003fca62 b/explorer/fuzzing/fuzzer_corpus/8f11bf2d763d565d4003e723c117c3b7fd5a54f0 similarity index 90% rename from explorer/fuzzing/fuzzer_corpus/d5270649631faab3d3ae0d50aa13cb6c003fca62 rename to explorer/fuzzing/fuzzer_corpus/8f11bf2d763d565d4003e723c117c3b7fd5a54f0 index 79c3a936960e..171896a7658b 100644 --- a/explorer/fuzzing/fuzzer_corpus/d5270649631faab3d3ae0d50aa13cb6c003fca62 +++ b/explorer/fuzzing/fuzzer_corpus/8f11bf2d763d565d4003e723c117c3b7fd5a54f0 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "a" type { @@ -23,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8f560dc1a60532489b6c400e1efcb7d6a8941388 b/explorer/fuzzing/fuzzer_corpus/8f560dc1a60532489b6c400e1efcb7d6a8941388 new file mode 100644 index 000000000000..14ad1f1a1510 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/8f560dc1a60532489b6c400e1efcb7d6a8941388 @@ -0,0 +1,439 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Apple" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Banana" + } + members { + interface_impl { + impl_type { + identifier { + name: "Self" + } + } + constraint { + call { + function { + identifier { + name: "Apple" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + members { + function { + name { + name: "G" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Carrot" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Carrot" + } + } + interface { + call { + function { + identifier { + name: "Apple" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Carrot" + } + } + interface { + identifier { + name: "Banana" + } + } + members { + function { + name { + name: "G" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Carrot.G" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "H" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Banana" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "G" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "x" + } + } + path { + simple_member_access { + field: "F" + object { + call { + function { + identifier { + name: "Apple" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "Carrot" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9064723daf6148e18f7195f319095238fe717cf8 b/explorer/fuzzing/fuzzer_corpus/9064723daf6148e18f7195f319095238fe717cf8 new file mode 100644 index 000000000000..cf03157e8a3e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9064723daf6148e18f7195f319095238fe717cf8 @@ -0,0 +1,91 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "T" + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "T" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/90e98e569c2c9dccbbbf6036b2ca560996e27456 b/explorer/fuzzing/fuzzer_corpus/90e98e569c2c9dccbbbf6036b2ca560996e27456 new file mode 100644 index 000000000000..351a29a4aec4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/90e98e569c2c9dccbbbf6036b2ca560996e27456 @@ -0,0 +1,857 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name { + name: "Add" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + } + } + members { + function { + name { + name: "Scale" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Add" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "y" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + op: Plain + } + } + } + } + } + members { + function { + name { + name: "Scale" + } + self_pattern { + addr_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + op: Plain + } + } + statements { + assign { + lhs { + simple_member_access { + field: "y" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + rhs { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + operator { + op: Deref + arguments { + identifier { + name: "self" + } + } + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + op: Plain + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "AddAndScaleGeneric" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "T" + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + path { + simple_member_access { + field: "Scale" + object { + identifier { + name: "Vector" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + operator { + op: Deref + arguments { + identifier { + name: "p" + } + } + } + } + path { + compound_member_access { + object { + identifier { + name: "T" + } + } + path { + simple_member_access { + field: "Scale" + object { + identifier { + name: "Vector" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "a" + } + } + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a7ae7fb61a1a6a4be9b7d5bd7c86c7338b3c5723 b/explorer/fuzzing/fuzzer_corpus/9120ffbf9f9ce9d0a6c5737fe311aa702a19d72a similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/a7ae7fb61a1a6a4be9b7d5bd7c86c7338b3c5723 rename to explorer/fuzzing/fuzzer_corpus/9120ffbf9f9ce9d0a6c5737fe311aa702a19d72a index ddc68d46160c..d93edc85e82e 100644 --- a/explorer/fuzzing/fuzzer_corpus/a7ae7fb61a1a6a4be9b7d5bd7c86c7338b3c5723 +++ b/explorer/fuzzing/fuzzer_corpus/9120ffbf9f9ce9d0a6c5737fe311aa702a19d72a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9118596a75bd4e7564935e46f2bcba30498ab3f2 b/explorer/fuzzing/fuzzer_corpus/91362973dc5b0ed1e93d5f4e8e1e0b21ed98c3e9 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/9118596a75bd4e7564935e46f2bcba30498ab3f2 rename to explorer/fuzzing/fuzzer_corpus/91362973dc5b0ed1e93d5f4e8e1e0b21ed98c3e9 index c29b2a6e8f68..6c88e89dee6f 100644 --- a/explorer/fuzzing/fuzzer_corpus/9118596a75bd4e7564935e46f2bcba30498ab3f2 +++ b/explorer/fuzzing/fuzzer_corpus/91362973dc5b0ed1e93d5f4e8e1e0b21ed98c3e9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -65,6 +67,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3434928d1dc3a66f3a3f1f44b3937e864ef81f4e b/explorer/fuzzing/fuzzer_corpus/9215313bd5600fa9a790a2a025db8dd25208d1de similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/3434928d1dc3a66f3a3f1f44b3937e864ef81f4e rename to explorer/fuzzing/fuzzer_corpus/9215313bd5600fa9a790a2a025db8dd25208d1de index 0235a3d530d6..a0eefdd49dd0 100644 --- a/explorer/fuzzing/fuzzer_corpus/3434928d1dc3a66f3a3f1f44b3937e864ef81f4e +++ b/explorer/fuzzing/fuzzer_corpus/9215313bd5600fa9a790a2a025db8dd25208d1de @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -81,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/523326cf1a9136b072a298728c75f50206bfef96 b/explorer/fuzzing/fuzzer_corpus/92ba578d44ebff520e839924230e16dfbeb26536 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/523326cf1a9136b072a298728c75f50206bfef96 rename to explorer/fuzzing/fuzzer_corpus/92ba578d44ebff520e839924230e16dfbeb26536 index 8b4b054f1e0c..28b90d1f780e 100644 --- a/explorer/fuzzing/fuzzer_corpus/523326cf1a9136b072a298728c75f50206bfef96 +++ b/explorer/fuzzing/fuzzer_corpus/92ba578d44ebff520e839924230e16dfbeb26536 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/93c10ced6270f76ac1c5b8f10c78eb12c361fd9e b/explorer/fuzzing/fuzzer_corpus/93c10ced6270f76ac1c5b8f10c78eb12c361fd9e new file mode 100644 index 000000000000..4348eaf9fae5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/93c10ced6270f76ac1c5b8f10c78eb12c361fd9e @@ -0,0 +1,125 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + int_type_literal { + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "a" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "A" + } + } + } + } + } + } + } + } + init { + identifier { + name: "b" + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/93cba88aa6339c5b99fb1179a53081e985a22b40 b/explorer/fuzzing/fuzzer_corpus/93cba88aa6339c5b99fb1179a53081e985a22b40 new file mode 100644 index 000000000000..92f3b7f5a772 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/93cba88aa6339c5b99fb1179a53081e985a22b40 @@ -0,0 +1,653 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "value_c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value_c" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "value_d" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value_d" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "E" + } + members { + variable { + binding { + name: "value_e" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value_e" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "value_c" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "value_d" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value_c" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "e" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "value_e" + expression { + int_literal { + value: 3 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value_d" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value_c" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "e.Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "e" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "dp" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "D" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*dp).Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "dp" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "dc" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*dc).Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "dc" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ab2ec9a2169b29c4f69b34ed736815415ef6c23b b/explorer/fuzzing/fuzzer_corpus/9418eff433af407d7baa42c96fa8a821b5bd1413 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/ab2ec9a2169b29c4f69b34ed736815415ef6c23b rename to explorer/fuzzing/fuzzer_corpus/9418eff433af407d7baa42c96fa8a821b5bd1413 index 5390075f6f9a..211255564cff 100644 --- a/explorer/fuzzing/fuzzer_corpus/ab2ec9a2169b29c4f69b34ed736815415ef6c23b +++ b/explorer/fuzzing/fuzzer_corpus/9418eff433af407d7baa42c96fa8a821b5bd1413 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/494a90d848d73add49cf3874374b4eaf9cb64e99 b/explorer/fuzzing/fuzzer_corpus/9475c489913e570bc90c01c9a867ce67b5640087 similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/494a90d848d73add49cf3874374b4eaf9cb64e99 rename to explorer/fuzzing/fuzzer_corpus/9475c489913e570bc90c01c9a867ce67b5640087 index 59c08fac6892..e48ccb3203c9 100644 --- a/explorer/fuzzing/fuzzer_corpus/494a90d848d73add49cf3874374b4eaf9cb64e99 +++ b/explorer/fuzzing/fuzzer_corpus/9475c489913e570bc90c01c9a867ce67b5640087 @@ -20,7 +20,9 @@ compilation_unit { } declarations { alias { - name: "A" + name { + name: "A" + } target { identifier { name: "v" @@ -30,7 +32,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b776e5348b36145d20b7c4bf8ef621567735aa83 b/explorer/fuzzing/fuzzer_corpus/947944c011b708642cc80e31b42d0ba3d38426a7 similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/b776e5348b36145d20b7c4bf8ef621567735aa83 rename to explorer/fuzzing/fuzzer_corpus/947944c011b708642cc80e31b42d0ba3d38426a7 index 081e54f6bcea..b3680dc45672 100644 --- a/explorer/fuzzing/fuzzer_corpus/b776e5348b36145d20b7c4bf8ef621567735aa83 +++ b/explorer/fuzzing/fuzzer_corpus/947944c011b708642cc80e31b42d0ba3d38426a7 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "HasName" + name { + name: "HasName" + } members { let { pattern { @@ -19,13 +21,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -43,13 +38,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Name" - } - } - rhs { + rewrite { + member_name: "Name" + replacement { string_literal { value: "i32" } @@ -75,13 +66,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Name" - } - } - rhs { + rewrite { + member_name: "Name" + replacement { string_literal { value: "String" } @@ -94,7 +81,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b1a9889594325eae530b60400fa8999b303ac2d3 b/explorer/fuzzing/fuzzer_corpus/949c23e4727e022b5ce9d33d4fde5d52d2990630 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b1a9889594325eae530b60400fa8999b303ac2d3 rename to explorer/fuzzing/fuzzer_corpus/949c23e4727e022b5ce9d33d4fde5d52d2990630 index f49df9807d2b..0919f8cd99dc 100644 --- a/explorer/fuzzing/fuzzer_corpus/b1a9889594325eae530b60400fa8999b303ac2d3 +++ b/explorer/fuzzing/fuzzer_corpus/949c23e4727e022b5ce9d33d4fde5d52d2990630 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/94d55b3b044001e9f35feb3eda9c09ad5e4987b2 b/explorer/fuzzing/fuzzer_corpus/94d55b3b044001e9f35feb3eda9c09ad5e4987b2 new file mode 100644 index 000000000000..b75fcea8e12a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/94d55b3b044001e9f35feb3eda9c09ad5e4987b2 @@ -0,0 +1,152 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0e06d7c74d2b9659b8ce114a93e3a4fbc1d22a5b b/explorer/fuzzing/fuzzer_corpus/956018ad0b7aa4d9f9fa03487c5f00d7e0be25f4 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/0e06d7c74d2b9659b8ce114a93e3a4fbc1d22a5b rename to explorer/fuzzing/fuzzer_corpus/956018ad0b7aa4d9f9fa03487c5f00d7e0be25f4 index 11a5b0351d87..574230cc6799 100644 --- a/explorer/fuzzing/fuzzer_corpus/0e06d7c74d2b9659b8ce114a93e3a4fbc1d22a5b +++ b/explorer/fuzzing/fuzzer_corpus/956018ad0b7aa4d9f9fa03487c5f00d7e0be25f4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -209,6 +211,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/959ab866676eb9034a8dbf532200bf297e045806 b/explorer/fuzzing/fuzzer_corpus/959ab866676eb9034a8dbf532200bf297e045806 new file mode 100644 index 000000000000..aeb6ad45eae7 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/959ab866676eb9034a8dbf532200bf297e045806 @@ -0,0 +1,442 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Iface" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + equals { + lhs { + designator { + name: "T" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + class_declaration { + name { + name: "Class" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "U" + type { + where { + base { + type_type_literal { + } + } + clauses { + equals { + lhs { + designator { + name: "Self" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + identifier { + name: "U" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "H" + } + deduced_parameters { + name: "V" + type { + where { + base { + type_type_literal { + } + } + clauses { + equals { + lhs { + designator { + name: "Self" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + deduced_parameters { + name: "W" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + equals { + lhs { + designator { + name: "T" + } + } + rhs { + identifier { + name: "V" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "W" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Class" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/362694fa674b4233cb14a35dae968676dbd303d9 b/explorer/fuzzing/fuzzer_corpus/95f55554ccb996e94a54818e5d692fe7e46637e6 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/362694fa674b4233cb14a35dae968676dbd303d9 rename to explorer/fuzzing/fuzzer_corpus/95f55554ccb996e94a54818e5d692fe7e46637e6 index 49d6dbb7d496..948606a96450 100644 --- a/explorer/fuzzing/fuzzer_corpus/362694fa674b4233cb14a35dae968676dbd303d9 +++ b/explorer/fuzzing/fuzzer_corpus/95f55554ccb996e94a54818e5d692fe7e46637e6 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -126,7 +128,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/6ba5c4041a499038b7ebacfc540911bd341b21ca b/explorer/fuzzing/fuzzer_corpus/96697f48f2d3ea7a465d45e840cdbaea7265c9da similarity index 77% rename from explorer/fuzzing/fuzzer_corpus/6ba5c4041a499038b7ebacfc540911bd341b21ca rename to explorer/fuzzing/fuzzer_corpus/96697f48f2d3ea7a465d45e840cdbaea7265c9da index dfabf499ecbd..a5dce25ffdac 100644 --- a/explorer/fuzzing/fuzzer_corpus/6ba5c4041a499038b7ebacfc540911bd341b21ca +++ b/explorer/fuzzing/fuzzer_corpus/96697f48f2d3ea7a465d45e840cdbaea7265c9da @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "HasThreeTypes" + name { + name: "HasThreeTypes" + } members { let { pattern { @@ -45,13 +47,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -69,28 +64,19 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "A" - } - } - rhs { + rewrite { + member_name: "A" + replacement { int_type_literal { } } } } clauses { - equals { - lhs { - designator { - name: "B" - } - } - rhs { - designator { - name: "C" + rewrite { + member_name: "C" + replacement { + int_type_literal { } } } @@ -101,7 +87,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/668a3b16a5de75a61879bab4913d239084809840 b/explorer/fuzzing/fuzzer_corpus/9696b507ce04184fd4fe2cbac445d3d8cc16cf88 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/668a3b16a5de75a61879bab4913d239084809840 rename to explorer/fuzzing/fuzzer_corpus/9696b507ce04184fd4fe2cbac445d3d8cc16cf88 index e433d0b0416e..932efc431f4f 100644 --- a/explorer/fuzzing/fuzzer_corpus/668a3b16a5de75a61879bab4913d239084809840 +++ b/explorer/fuzzing/fuzzer_corpus/9696b507ce04184fd4fe2cbac445d3d8cc16cf88 @@ -5,12 +5,16 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -38,7 +42,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/da1ba8fc95a22683068aed496a0b97fca851f7a0 b/explorer/fuzzing/fuzzer_corpus/96a504c8350c3d69aef1eb3c63f43f73acc6a899 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/da1ba8fc95a22683068aed496a0b97fca851f7a0 rename to explorer/fuzzing/fuzzer_corpus/96a504c8350c3d69aef1eb3c63f43f73acc6a899 index d55b01ec349a..74fbdd0d76f2 100644 --- a/explorer/fuzzing/fuzzer_corpus/da1ba8fc95a22683068aed496a0b97fca851f7a0 +++ b/explorer/fuzzing/fuzzer_corpus/96a504c8350c3d69aef1eb3c63f43f73acc6a899 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "capture" + name { + name: "capture" + } param_pattern { } return_term { @@ -83,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/96f08313767988395fc4ff5ee5004de1f859bcf3 b/explorer/fuzzing/fuzzer_corpus/96f08313767988395fc4ff5ee5004de1f859bcf3 deleted file mode 100644 index dd2c074e253e..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/96f08313767988395fc4ff5ee5004de1f859bcf3 +++ /dev/null @@ -1,674 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_expression_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_expression_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - is_returned: false - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - is_returned: false - } - } - statements { - return_expression_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 4 - } - } - } - } - } - is_returned: false - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - is_returned: false - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - is_returned: false - } - } - statements { - return_expression_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/be7234f031df39934f1179f6b4421fa13d8be151 b/explorer/fuzzing/fuzzer_corpus/96f494f4264c4c5ff5f351423d60ab98f6a6b12b similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/be7234f031df39934f1179f6b4421fa13d8be151 rename to explorer/fuzzing/fuzzer_corpus/96f494f4264c4c5ff5f351423d60ab98f6a6b12b index 70fdfdeca898..3d565968bc52 100644 --- a/explorer/fuzzing/fuzzer_corpus/be7234f031df39934f1179f6b4421fa13d8be151 +++ b/explorer/fuzzing/fuzzer_corpus/96f494f4264c4c5ff5f351423d60ab98f6a6b12b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "f" + name { + name: "f" + } param_pattern { } return_term { @@ -33,7 +35,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/94c9bbbf4dad5466e7b504f2268c73ea1c078da3 b/explorer/fuzzing/fuzzer_corpus/973324f1915325eec6893bd8e505625d2ac1d9f3 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/94c9bbbf4dad5466e7b504f2268c73ea1c078da3 rename to explorer/fuzzing/fuzzer_corpus/973324f1915325eec6893bd8e505625d2ac1d9f3 index 1a4a57fb59eb..acb6f993b4fb 100644 --- a/explorer/fuzzing/fuzzer_corpus/94c9bbbf4dad5466e7b504f2268c73ea1c078da3 +++ b/explorer/fuzzing/fuzzer_corpus/973324f1915325eec6893bd8e505625d2ac1d9f3 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -257,7 +260,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -359,7 +364,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -539,7 +546,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7e5ad74d28c93d5e759eaf8809365a01437700ec b/explorer/fuzzing/fuzzer_corpus/978b667e4d12c196abd3a4e1ec52f94e57b3ad5e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7e5ad74d28c93d5e759eaf8809365a01437700ec rename to explorer/fuzzing/fuzzer_corpus/978b667e4d12c196abd3a4e1ec52f94e57b3ad5e index 221e3122261a..a1f9523861a9 100644 --- a/explorer/fuzzing/fuzzer_corpus/7e5ad74d28c93d5e759eaf8809365a01437700ec +++ b/explorer/fuzzing/fuzzer_corpus/978b667e4d12c196abd3a4e1ec52f94e57b3ad5e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -89,7 +91,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d19476938456b2af289c2becee9cf635a1c18bf5 b/explorer/fuzzing/fuzzer_corpus/98607e0a14ad66068f230243fceeffc600cc57a4 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/d19476938456b2af289c2becee9cf635a1c18bf5 rename to explorer/fuzzing/fuzzer_corpus/98607e0a14ad66068f230243fceeffc600cc57a4 index 70ead1f8dfc5..f32945d236a4 100644 --- a/explorer/fuzzing/fuzzer_corpus/d19476938456b2af289c2becee9cf635a1c18bf5 +++ b/explorer/fuzzing/fuzzer_corpus/98607e0a14ad66068f230243fceeffc600cc57a4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/990a34d604db8cb646b94ed74212a06796bf6639 b/explorer/fuzzing/fuzzer_corpus/990a34d604db8cb646b94ed74212a06796bf6639 new file mode 100644 index 000000000000..fc11ce557e9a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/990a34d604db8cb646b94ed74212a06796bf6639 @@ -0,0 +1,302 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "X" + } + } + } + declarations { + interface { + name { + name: "Y" + } + members { + let { + pattern { + generic_binding { + name: "M" + type { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Z" + } + members { + let { + pattern { + generic_binding { + name: "N" + type { + where { + base { + call { + function { + identifier { + name: "Y" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + clauses { + is { + type { + int_type_literal { + } + } + constraint { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + } + } + clauses { + rewrite { + member_name: "M" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + call { + function { + identifier { + name: "Y" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "M" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + identifier { + name: "Z" + } + } + clauses { + rewrite { + member_name: "N" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "A" + type { + identifier { + name: "Z" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7be545a1b21999c894553c2c0355d36ef5a292d8 b/explorer/fuzzing/fuzzer_corpus/9a3c36288c9320a9c2fe8250584ac23e96fcd357 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/7be545a1b21999c894553c2c0355d36ef5a292d8 rename to explorer/fuzzing/fuzzer_corpus/9a3c36288c9320a9c2fe8250584ac23e96fcd357 index db917c99dffc..07af1f6d97a2 100644 --- a/explorer/fuzzing/fuzzer_corpus/7be545a1b21999c894553c2c0355d36ef5a292d8 +++ b/explorer/fuzzing/fuzzer_corpus/9a3c36288c9320a9c2fe8250584ac23e96fcd357 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9a435ff6608006cf717e4ea6d7e22a793081b096 b/explorer/fuzzing/fuzzer_corpus/9a435ff6608006cf717e4ea6d7e22a793081b096 new file mode 100644 index 000000000000..90896099f05e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9a435ff6608006cf717e4ea6d7e22a793081b096 @@ -0,0 +1,48 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + interface_extends { + base { + int_type_literal { + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3131bb7cd777c8112ea2f2221f1b4624d55b191e b/explorer/fuzzing/fuzzer_corpus/9a86715151b6f28bd7bec84534ae0cbe248d6374 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/3131bb7cd777c8112ea2f2221f1b4624d55b191e rename to explorer/fuzzing/fuzzer_corpus/9a86715151b6f28bd7bec84534ae0cbe248d6374 index c8278d3e4086..a2332098de04 100644 --- a/explorer/fuzzing/fuzzer_corpus/3131bb7cd777c8112ea2f2221f1b4624d55b191e +++ b/explorer/fuzzing/fuzzer_corpus/9a86715151b6f28bd7bec84534ae0cbe248d6374 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "HasF" + name { + name: "HasF" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -49,18 +53,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -76,7 +75,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -176,7 +177,9 @@ compilation_unit { } declarations { class_declaration { - name: "Y" + name { + name: "Y" + } members { variable { binding { @@ -220,7 +223,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -276,7 +281,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9ca0587cdea69c87cee4dcecb747f5201f47fce7 b/explorer/fuzzing/fuzzer_corpus/9ca0587cdea69c87cee4dcecb747f5201f47fce7 new file mode 100644 index 000000000000..893703c3f006 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9ca0587cdea69c87cee4dcecb747f5201f47fce7 @@ -0,0 +1,456 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "E" + } + members { + variable { + binding { + name: "val" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Foo" + } + param_pattern { + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "val" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "e" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 3 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "val" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "D" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c1" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "e" + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c2" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + identifier { + name: "d" + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c1).val: {0}" + } + } + fields { + simple_member_access { + field: "val" + object { + operator { + op: Deref + arguments { + identifier { + name: "c1" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c2).val: {0}" + } + } + fields { + simple_member_access { + field: "val" + object { + operator { + op: Deref + arguments { + identifier { + name: "c2" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*d).val: {0}" + } + } + fields { + simple_member_access { + field: "val" + object { + operator { + op: Deref + arguments { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "e.val: {0}" + } + } + fields { + simple_member_access { + field: "val" + object { + identifier { + name: "e" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7df73cb6dd9570e29a1dafb72a6777ef698770a7 b/explorer/fuzzing/fuzzer_corpus/9d40d743d76f2b406047513146ca9db3d2af7550 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7df73cb6dd9570e29a1dafb72a6777ef698770a7 rename to explorer/fuzzing/fuzzer_corpus/9d40d743d76f2b406047513146ca9db3d2af7550 index 3649bd301826..34878f97f080 100644 --- a/explorer/fuzzing/fuzzer_corpus/7df73cb6dd9570e29a1dafb72a6777ef698770a7 +++ b/explorer/fuzzing/fuzzer_corpus/9d40d743d76f2b406047513146ca9db3d2af7550 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AssignIntTo" + name { + name: "AssignIntTo" + } param_pattern { fields { binding_pattern { @@ -60,6 +62,7 @@ compilation_unit { name: "x" } } + op: Plain } } } @@ -67,7 +70,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/01fd407b28fe2154900e62c790943150b2c3147d b/explorer/fuzzing/fuzzer_corpus/9de303a702b10616ceb04deaa52af70899c4db4d similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/01fd407b28fe2154900e62c790943150b2c3147d rename to explorer/fuzzing/fuzzer_corpus/9de303a702b10616ceb04deaa52af70899c4db4d index 62d6266e926f..baac7fe046cd 100644 --- a/explorer/fuzzing/fuzzer_corpus/01fd407b28fe2154900e62c790943150b2c3147d +++ b/explorer/fuzzing/fuzzer_corpus/9de303a702b10616ceb04deaa52af70899c4db4d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -131,6 +133,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/9402b4cdd92ee71835a8583e34cb7661e716b8e9 b/explorer/fuzzing/fuzzer_corpus/9e19f13bb23a93ba4f740a11563c2246fee796be similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/9402b4cdd92ee71835a8583e34cb7661e716b8e9 rename to explorer/fuzzing/fuzzer_corpus/9e19f13bb23a93ba4f740a11563c2246fee796be index e6d96a13b64e..aea9304cdfd9 100644 --- a/explorer/fuzzing/fuzzer_corpus/9402b4cdd92ee71835a8583e34cb7661e716b8e9 +++ b/explorer/fuzzing/fuzzer_corpus/9e19f13bb23a93ba4f740a11563c2246fee796be @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,21 +24,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -48,7 +49,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -60,21 +63,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "C" + name { + name: "C" + } members { function { - name: "H" + name { + name: "H" + } param_pattern { } return_term { @@ -87,13 +87,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -110,7 +103,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -189,7 +184,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -214,7 +211,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -239,7 +238,9 @@ compilation_unit { } members { function { - name: "H" + name { + name: "H" + } param_pattern { } return_term { @@ -266,7 +267,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9edaf75a29bfaf3a1dc00b3356ad93a904ec1bf4 b/explorer/fuzzing/fuzzer_corpus/9edaf75a29bfaf3a1dc00b3356ad93a904ec1bf4 new file mode 100644 index 000000000000..4773da347a8d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9edaf75a29bfaf3a1dc00b3356ad93a904ec1bf4 @@ -0,0 +1,90 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + struct_type_literal { + fields { + name: "x" + expression { + int_type_literal { + } + } + } + fields { + name: "y" + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + rhs { + simple_member_access { + field: "y" + object { + identifier { + name: "p" + } + } + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9f2b40328127947524429569157002cc2c8b4113 b/explorer/fuzzing/fuzzer_corpus/9f2b40328127947524429569157002cc2c8b4113 new file mode 100644 index 000000000000..4f83bd40bfe8 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9f2b40328127947524429569157002cc2c8b4113 @@ -0,0 +1,90 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/931196ac2d5e82f698fd3a192b2d4598ea6f33fe b/explorer/fuzzing/fuzzer_corpus/9f7214ed05fbc790b9101054c0cac6f4f60de1c5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/931196ac2d5e82f698fd3a192b2d4598ea6f33fe rename to explorer/fuzzing/fuzzer_corpus/9f7214ed05fbc790b9101054c0cac6f4f60de1c5 index 5a6fa903d327..240949c13853 100644 --- a/explorer/fuzzing/fuzzer_corpus/931196ac2d5e82f698fd3a192b2d4598ea6f33fe +++ b/explorer/fuzzing/fuzzer_corpus/9f7214ed05fbc790b9101054c0cac6f4f60de1c5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ad563e78a8bf7d21e0488c3900bf27fd842c611a b/explorer/fuzzing/fuzzer_corpus/a08d92d7abc23040943022426fb46a276cc2101e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ad563e78a8bf7d21e0488c3900bf27fd842c611a rename to explorer/fuzzing/fuzzer_corpus/a08d92d7abc23040943022426fb46a276cc2101e index cbdc213a6deb..0fba2bc14fea 100644 --- a/explorer/fuzzing/fuzzer_corpus/ad563e78a8bf7d21e0488c3900bf27fd842c611a +++ b/explorer/fuzzing/fuzzer_corpus/a08d92d7abc23040943022426fb46a276cc2101e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "add" + name { + name: "add" + } param_pattern { fields { binding_pattern { @@ -62,7 +64,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a0cf3d4ea5a416fd9a0734096c0214a9143ed71d b/explorer/fuzzing/fuzzer_corpus/a0cf3d4ea5a416fd9a0734096c0214a9143ed71d new file mode 100644 index 000000000000..ed99c402bac7 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a0cf3d4ea5a416fd9a0734096c0214a9143ed71d @@ -0,0 +1,91 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + match { + expression { + identifier { + name: "x" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + is_default: true + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a0d6afaa5de15f753b76e48ce21b77300d4247b0 b/explorer/fuzzing/fuzzer_corpus/a0d6afaa5de15f753b76e48ce21b77300d4247b0 new file mode 100644 index 000000000000..61754e1fc902 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a0d6afaa5de15f753b76e48ce21b77300d4247b0 @@ -0,0 +1,548 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + members { + function { + name { + name: "Bar" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + members { + function { + name { + name: "Bar" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.Foo() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.Bar() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Bar" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.Foo() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.Bar() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Bar" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "cc" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "cc.Foo() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "cc" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "cc.Bar() -> {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Bar" + object { + operator { + op: Deref + arguments { + identifier { + name: "cc" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a103add196c50b16925c2d218749cc812d912a7a b/explorer/fuzzing/fuzzer_corpus/a103add196c50b16925c2d218749cc812d912a7a new file mode 100644 index 000000000000..1b7984d80241 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a103add196c50b16925c2d218749cc812d912a7a @@ -0,0 +1,99 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + operator { + op: BitwiseAnd + arguments { + type_type_literal { + } + } + arguments { + type_type_literal { + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a209f05520c67a6c6cb41c5b44bfb06cd598fc78 b/explorer/fuzzing/fuzzer_corpus/a3050fa0d18aecf519f74d21c344a5727f80c10a similarity index 69% rename from explorer/fuzzing/fuzzer_corpus/a209f05520c67a6c6cb41c5b44bfb06cd598fc78 rename to explorer/fuzzing/fuzzer_corpus/a3050fa0d18aecf519f74d21c344a5727f80c10a index f843b90a2b26..1f50a8887ebb 100644 --- a/explorer/fuzzing/fuzzer_corpus/a209f05520c67a6c6cb41c5b44bfb06cd598fc78 +++ b/explorer/fuzzing/fuzzer_corpus/a3050fa0d18aecf519f74d21c344a5727f80c10a @@ -3,9 +3,26 @@ compilation_unit { package_name: "ExplorerTest" } is_api: true + declarations { + namespace { + name { + name: "Namespace" + } + } + } + declarations { + interface { + name { + qualifiers: "Namespace" + name: "AddWith" + } + } + } declarations { function { - name: "DoAdd" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -20,8 +37,7 @@ compilation_unit { argument { tuple_literal { fields { - designator { - name: "Self" + int_type_literal { } } } @@ -29,15 +45,10 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { - designator { - name: "Self" + rewrite { + member_name: "Result" + replacement { + int_type_literal { } } } @@ -48,21 +59,7 @@ compilation_unit { param_pattern { fields { binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" + name: "n" type { expression_pattern { expression { @@ -78,8 +75,7 @@ compilation_unit { return_term { kind: Expression type { - identifier { - name: "T" + int_type_literal { } } } @@ -91,12 +87,12 @@ compilation_unit { op: Add arguments { identifier { - name: "x" + name: "n" } } arguments { - identifier { - name: "y" + int_literal { + value: 1 } } } @@ -108,7 +104,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -125,7 +123,7 @@ compilation_unit { call { function { identifier { - name: "DoAdd" + name: "F" } } argument { @@ -135,11 +133,6 @@ compilation_unit { value: 1 } } - fields { - int_literal { - value: 2 - } - } } } } diff --git a/explorer/fuzzing/fuzzer_corpus/d9d9b68b19cd2a959e255930c0bed7716be069f4 b/explorer/fuzzing/fuzzer_corpus/a39216150512f65b529af0981e77f61b3301ff22 similarity index 81% rename from explorer/fuzzing/fuzzer_corpus/d9d9b68b19cd2a959e255930c0bed7716be069f4 rename to explorer/fuzzing/fuzzer_corpus/a39216150512f65b529af0981e77f61b3301ff22 index 28d77e24bdba..ddd531e94e46 100644 --- a/explorer/fuzzing/fuzzer_corpus/d9d9b68b19cd2a959e255930c0bed7716be069f4 +++ b/explorer/fuzzing/fuzzer_corpus/a39216150512f65b529af0981e77f61b3301ff22 @@ -5,25 +5,15 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { interface { - name: "B" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "B" } } } @@ -60,7 +50,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b75d52ba945f27249b646ddce2c1e0f79df33a29 b/explorer/fuzzing/fuzzer_corpus/a3b3ebf7fc4022ce6c2ef4d257edb183aa15bf1e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b75d52ba945f27249b646ddce2c1e0f79df33a29 rename to explorer/fuzzing/fuzzer_corpus/a3b3ebf7fc4022ce6c2ef4d257edb183aa15bf1e index 34b8fa0242e8..7508350b94a4 100644 --- a/explorer/fuzzing/fuzzer_corpus/b75d52ba945f27249b646ddce2c1e0f79df33a29 +++ b/explorer/fuzzing/fuzzer_corpus/a3b3ebf7fc4022ce6c2ef4d257edb183aa15bf1e @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "ReturnFalse" + name { + name: "ReturnFalse" + } param_pattern { } return_term { @@ -58,6 +60,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -74,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a3e7fdd6333766ddcf6e0ea91314908660d30ffb b/explorer/fuzzing/fuzzer_corpus/a3e7fdd6333766ddcf6e0ea91314908660d30ffb new file mode 100644 index 000000000000..30b5c417ce82 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a3e7fdd6333766ddcf6e0ea91314908660d30ffb @@ -0,0 +1,201 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "MyOptionalElement" + } + alternatives { + name: "None" + signature { + fields { + identifier { + name: "ZZ" + } + } + } + } + alternatives { + name: "Element" + signature { + fields { + identifier { + name: "ZZ" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "f" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "MyOptionalElement" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "f" + } + } + rhs { + call { + function { + simple_member_access { + field: "None" + object { + call { + function { + identifier { + name: "MyOptionalElement" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 22 + } + } + } + } + } + } + op: Plain + } + } + statements { + match { + expression { + identifier { + name: "f" + } + } + clauses { + pattern { + alternative_pattern { + choice_type { + call { + function { + identifier { + name: "MyOptionalElement" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + alternative_name: "None" + arguments { + fields { + var_pattern { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3dd4c4365c9ec4609b888049caf211440667c503 b/explorer/fuzzing/fuzzer_corpus/a4b77ba4911d2e3e0ffbee880c454b47c1a67cc8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3dd4c4365c9ec4609b888049caf211440667c503 rename to explorer/fuzzing/fuzzer_corpus/a4b77ba4911d2e3e0ffbee880c454b47c1a67cc8 index 016cfefd4061..b46e4c822dda 100644 --- a/explorer/fuzzing/fuzzer_corpus/3dd4c4365c9ec4609b888049caf211440667c503 +++ b/explorer/fuzzing/fuzzer_corpus/a4b77ba4911d2e3e0ffbee880c454b47c1a67cc8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -87,6 +89,7 @@ compilation_unit { name: "y" } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/4000d5257ee4ed228629d14c2d784a2f2085b499 b/explorer/fuzzing/fuzzer_corpus/a4ff3bea934cdfdc0f66a25641fe6b19016ef1da similarity index 65% rename from explorer/fuzzing/fuzzer_corpus/4000d5257ee4ed228629d14c2d784a2f2085b499 rename to explorer/fuzzing/fuzzer_corpus/a4ff3bea934cdfdc0f66a25641fe6b19016ef1da index a6349cf25d82..117210edae5d 100644 --- a/explorer/fuzzing/fuzzer_corpus/4000d5257ee4ed228629d14c2d784a2f2085b499 +++ b/explorer/fuzzing/fuzzer_corpus/a4ff3bea934cdfdc0f66a25641fe6b19016ef1da @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -20,28 +22,23 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: Complement arguments { - operator { - op: Complement - arguments { - int_literal { - value: 0 - } - } + int_literal { + value: 0 } } + } + } + arguments { + operator { + op: Neg arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 1 } } } @@ -65,28 +62,23 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: Complement arguments { - operator { - op: Complement - arguments { - int_literal { - value: 1 - } - } + int_literal { + value: 1 } } + } + } + arguments { + operator { + op: Neg arguments { - operator { - op: Neg - arguments { - int_literal { - value: 2 - } - } + int_literal { + value: 2 } } } @@ -110,30 +102,25 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: Complement arguments { operator { - op: Complement + op: Neg arguments { - operator { - op: Neg - arguments { - int_literal { - value: 3 - } - } + int_literal { + value: 3 } } } } - arguments { - int_literal { - value: 2 - } - } + } + } + arguments { + int_literal { + value: 2 } } } @@ -155,32 +142,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseAnd arguments { - operator { - op: BitwiseAnd - arguments { - int_literal { - value: 3 - } - } - arguments { - int_literal { - value: 6 - } - } + int_literal { + value: 3 } } arguments { int_literal { - value: 2 + value: 6 } } } } + arguments { + int_literal { + value: 2 + } + } } } then_block { @@ -200,26 +182,16 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseAnd arguments { operator { - op: BitwiseAnd - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } - } - } + op: Neg arguments { int_literal { - value: 4 + value: 1 } } } @@ -231,6 +203,11 @@ compilation_unit { } } } + arguments { + int_literal { + value: 4 + } + } } } then_block { @@ -250,31 +227,16 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseAnd arguments { operator { - op: BitwiseAnd + op: Neg arguments { - operator { - op: Neg - arguments { - int_literal { - value: 1 - } - } - } - } - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 2 - } - } + int_literal { + value: 1 } } } @@ -291,6 +253,16 @@ compilation_unit { } } } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 2 + } + } + } + } } } then_block { @@ -310,32 +282,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseOr arguments { - operator { - op: BitwiseOr - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 4 - } - } + int_literal { + value: 1 } } arguments { int_literal { - value: 5 + value: 4 } } } } + arguments { + int_literal { + value: 5 + } + } } } then_block { @@ -355,32 +322,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseOr arguments { - operator { - op: BitwiseOr - arguments { - int_literal { - value: 5 - } - } - arguments { - int_literal { - value: 3 - } - } + int_literal { + value: 5 } } arguments { int_literal { - value: 7 + value: 3 } } } } + arguments { + int_literal { + value: 7 + } + } } } then_block { @@ -400,40 +362,35 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq - arguments { - operator { - op: BitwiseOr - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 2 - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } + op: BitwiseOr arguments { operator { op: Neg arguments { int_literal { - value: 1 + value: 2 } } } } + arguments { + int_literal { + value: 1 + } + } + } + } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } } } } @@ -455,32 +412,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseXor arguments { - operator { - op: BitwiseXor - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 4 - } - } + int_literal { + value: 1 } } arguments { int_literal { - value: 5 + value: 4 } } } } + arguments { + int_literal { + value: 5 + } + } } } then_block { @@ -500,32 +452,27 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseXor arguments { - operator { - op: BitwiseXor - arguments { - int_literal { - value: 5 - } - } - arguments { - int_literal { - value: 3 - } - } + int_literal { + value: 5 } } arguments { int_literal { - value: 6 + value: 3 } } } } + arguments { + int_literal { + value: 6 + } + } } } then_block { @@ -545,42 +492,37 @@ compilation_unit { if_statement { condition { operator { - op: Not + op: NotEq arguments { operator { - op: Eq + op: BitwiseXor arguments { operator { - op: BitwiseXor + op: Neg arguments { - operator { - op: Neg - arguments { - int_literal { - value: 2 - } - } - } - } - arguments { - operator { - op: Neg - arguments { - int_literal { - value: 3 - } - } + int_literal { + value: 2 } } } } arguments { - int_literal { - value: 3 + operator { + op: Neg + arguments { + int_literal { + value: 3 + } + } } } } } + arguments { + int_literal { + value: 3 + } + } } } then_block { diff --git a/explorer/fuzzing/fuzzer_corpus/3ca276906b513a73ab13574c7c7b2b0449e5abae b/explorer/fuzzing/fuzzer_corpus/a5cbe60f4b842b38d4daeb66b4f8b8efebe1deb7 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/3ca276906b513a73ab13574c7c7b2b0449e5abae rename to explorer/fuzzing/fuzzer_corpus/a5cbe60f4b842b38d4daeb66b4f8b8efebe1deb7 index 5f6b18c24b2a..82912180917b 100644 --- a/explorer/fuzzing/fuzzer_corpus/3ca276906b513a73ab13574c7c7b2b0449e5abae +++ b/explorer/fuzzing/fuzzer_corpus/a5cbe60f4b842b38d4daeb66b4f8b8efebe1deb7 @@ -5,13 +5,8 @@ compilation_unit { is_api: true declarations { interface { - name: "Similar" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "Similar" } } } @@ -72,7 +67,9 @@ compilation_unit { } declarations { function { - name: "CheckSimilar" + name { + name: "CheckSimilar" + } deduced_parameters { name: "T" type { @@ -140,7 +137,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c31325e73bf43da3b05613f71414ca7ab56f2bac b/explorer/fuzzing/fuzzer_corpus/a60a8a53538192ead1fdde89d92778dba80f9224 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/c31325e73bf43da3b05613f71414ca7ab56f2bac rename to explorer/fuzzing/fuzzer_corpus/a60a8a53538192ead1fdde89d92778dba80f9224 index 53210d801703..cf27cffa6d3d 100644 --- a/explorer/fuzzing/fuzzer_corpus/c31325e73bf43da3b05613f71414ca7ab56f2bac +++ b/explorer/fuzzing/fuzzer_corpus/a60a8a53538192ead1fdde89d92778dba80f9224 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -101,6 +103,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { @@ -115,6 +118,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/103128bcb516ce489aaaa1532aa50bf80aeca61f b/explorer/fuzzing/fuzzer_corpus/a63969e9231d175a9a38e210ddd976ddd91320a0 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/103128bcb516ce489aaaa1532aa50bf80aeca61f rename to explorer/fuzzing/fuzzer_corpus/a63969e9231d175a9a38e210ddd976ddd91320a0 index 1df949715260..77d11e73604c 100644 --- a/explorer/fuzzing/fuzzer_corpus/103128bcb516ce489aaaa1532aa50bf80aeca61f +++ b/explorer/fuzzing/fuzzer_corpus/a63969e9231d175a9a38e210ddd976ddd91320a0 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -118,7 +120,7 @@ compilation_unit { tuple_literal { fields { string_literal { - value: "HALLO WELT " + value: "HALLO WELT {0}" } } fields { @@ -154,6 +156,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/a6bafba04f6e5e43d76633724a0858c611a00248 b/explorer/fuzzing/fuzzer_corpus/a6bafba04f6e5e43d76633724a0858c611a00248 new file mode 100644 index 000000000000..3817a854fb4b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a6bafba04f6e5e43d76633724a0858c611a00248 @@ -0,0 +1,296 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "ManyTypes" + } + members { + let { + pattern { + generic_binding { + name: "T0" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T1" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T2" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T3" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T4" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T5" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T6" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T7" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T8" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "T9" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "M" + type { + where { + base { + identifier { + name: "ManyTypes" + } + } + clauses { + rewrite { + member_name: "T0" + replacement { + designator { + name: "T1" + } + } + } + } + clauses { + rewrite { + member_name: "T1" + replacement { + designator { + name: "T2" + } + } + } + } + clauses { + rewrite { + member_name: "T2" + replacement { + designator { + name: "T3" + } + } + } + } + clauses { + rewrite { + member_name: "T3" + replacement { + designator { + name: "T4" + } + } + } + } + clauses { + rewrite { + member_name: "T4" + replacement { + designator { + name: "T5" + } + } + } + } + clauses { + rewrite { + member_name: "T5" + replacement { + designator { + name: "T6" + } + } + } + } + clauses { + rewrite { + member_name: "T6" + replacement { + designator { + name: "T7" + } + } + } + } + clauses { + rewrite { + member_name: "T7" + replacement { + designator { + name: "T8" + } + } + } + } + clauses { + rewrite { + member_name: "T8" + replacement { + designator { + name: "T9" + } + } + } + } + clauses { + rewrite { + member_name: "T9" + replacement { + designator { + name: "T0" + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/131845e36ae4393f4e18481b38d58c44b65ae696 b/explorer/fuzzing/fuzzer_corpus/a6c74d103e741edd3f4a0b34d114b451bebd4593 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/131845e36ae4393f4e18481b38d58c44b65ae696 rename to explorer/fuzzing/fuzzer_corpus/a6c74d103e741edd3f4a0b34d114b451bebd4593 index b51b116294eb..8254f072110c 100644 --- a/explorer/fuzzing/fuzzer_corpus/131845e36ae4393f4e18481b38d58c44b65ae696 +++ b/explorer/fuzzing/fuzzer_corpus/a6c74d103e741edd3f4a0b34d114b451bebd4593 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a6cbb1c4cbbae44391bce60832b7f9b034f3839e b/explorer/fuzzing/fuzzer_corpus/a6cbb1c4cbbae44391bce60832b7f9b034f3839e new file mode 100644 index 000000000000..8fa248d6a982 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a6cbb1c4cbbae44391bce60832b7f9b034f3839e @@ -0,0 +1,354 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Apple" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Banana" + } + members { + interface_extends { + base { + call { + function { + identifier { + name: "Apple" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + members { + function { + name { + name: "G" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Carrot" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Carrot" + } + } + interface { + identifier { + name: "Banana" + } + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "G" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Carrot.G" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "Carrot" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "c" + } + } + path { + simple_member_access { + field: "G" + object { + identifier { + name: "Banana" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "c" + } + } + path { + simple_member_access { + field: "F" + object { + call { + function { + identifier { + name: "Apple" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/17a226907550562b780d15f6ff2e022f3ed880cc b/explorer/fuzzing/fuzzer_corpus/a7f8b0f9b13cfd705824c887103f516d87d48ca4 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/17a226907550562b780d15f6ff2e022f3ed880cc rename to explorer/fuzzing/fuzzer_corpus/a7f8b0f9b13cfd705824c887103f516d87d48ca4 index 27da8af9b755..34f4d005137b 100644 --- a/explorer/fuzzing/fuzzer_corpus/17a226907550562b780d15f6ff2e022f3ed880cc +++ b/explorer/fuzzing/fuzzer_corpus/a7f8b0f9b13cfd705824c887103f516d87d48ca4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "CompareStr" + name { + name: "CompareStr" + } param_pattern { fields { binding_pattern { @@ -73,7 +75,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b7a025423669496deafe37c81a0af636ba21c108 b/explorer/fuzzing/fuzzer_corpus/a84a42d64867252e2e7144cfb8c31dc7a2d9526e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/b7a025423669496deafe37c81a0af636ba21c108 rename to explorer/fuzzing/fuzzer_corpus/a84a42d64867252e2e7144cfb8c31dc7a2d9526e index 56c73c8c2a31..99d9f99ee841 100644 --- a/explorer/fuzzing/fuzzer_corpus/b7a025423669496deafe37c81a0af636ba21c108 +++ b/explorer/fuzzing/fuzzer_corpus/a84a42d64867252e2e7144cfb8c31dc7a2d9526e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8a9e4f4bdad7e7666079f83c8429038a7196d240 b/explorer/fuzzing/fuzzer_corpus/a9a32f0f6f90b118987f1813f2ea7e7726f399ed similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/8a9e4f4bdad7e7666079f83c8429038a7196d240 rename to explorer/fuzzing/fuzzer_corpus/a9a32f0f6f90b118987f1813f2ea7e7726f399ed index 27c99f24a9c7..737f1eed37e5 100644 --- a/explorer/fuzzing/fuzzer_corpus/8a9e4f4bdad7e7666079f83c8429038a7196d240 +++ b/explorer/fuzzing/fuzzer_corpus/a9a32f0f6f90b118987f1813f2ea7e7726f399ed @@ -45,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a9f29fe9b82f4f0291f37c61777dc38f202cfdd9 b/explorer/fuzzing/fuzzer_corpus/a9f29fe9b82f4f0291f37c61777dc38f202cfdd9 new file mode 100644 index 000000000000..85d2e4b77a2a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a9f29fe9b82f4f0291f37c61777dc38f202cfdd9 @@ -0,0 +1,90 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "t" + type { + auto_pattern { + } + } + } + } + init { + int_literal { + value: 5 + } + } + is_returned: false + } + } + statements { + match { + expression { + identifier { + name: "t" + } + } + clauses { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f6b30690735283f02587055b9f8f5ae0a7833e60 b/explorer/fuzzing/fuzzer_corpus/aabfa1065ebe0a671c2a78961b101a1d45ab0acd similarity index 57% rename from explorer/fuzzing/fuzzer_corpus/f6b30690735283f02587055b9f8f5ae0a7833e60 rename to explorer/fuzzing/fuzzer_corpus/aabfa1065ebe0a671c2a78961b101a1d45ab0acd index f4de977b4cb6..4fbc2787ea92 100644 --- a/explorer/fuzzing/fuzzer_corpus/f6b30690735283f02587055b9f8f5ae0a7833e60 +++ b/explorer/fuzzing/fuzzer_corpus/aabfa1065ebe0a671c2a78961b101a1d45ab0acd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -178,7 +180,7 @@ compilation_unit { name: "n" expression { int_literal { - value: 5 + value: 13 } } } @@ -204,7 +206,134 @@ compilation_unit { } arguments { int_literal { - value: 1 + value: 7 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + operator { + op: Neg + arguments { + int_literal { + value: 2 + } + } + } + } + op: And + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + } + } } } } @@ -214,13 +343,8 @@ compilation_unit { statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/abef7d05195421c940d49409627c5b24d4f2b916 b/explorer/fuzzing/fuzzer_corpus/abef7d05195421c940d49409627c5b24d4f2b916 new file mode 100644 index 000000000000..99f89e3db3cc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/abef7d05195421c940d49409627c5b24d4f2b916 @@ -0,0 +1,57 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e5931743b8a74dbbce5c55fa701312edb4c40a12 b/explorer/fuzzing/fuzzer_corpus/ac06160978bdf5b1ee077ff7b4e0136ab2ed94a2 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/e5931743b8a74dbbce5c55fa701312edb4c40a12 rename to explorer/fuzzing/fuzzer_corpus/ac06160978bdf5b1ee077ff7b4e0136ab2ed94a2 index 0266c4bab544..83ae5b35b9d5 100644 --- a/explorer/fuzzing/fuzzer_corpus/e5931743b8a74dbbce5c55fa701312edb4c40a12 +++ b/explorer/fuzzing/fuzzer_corpus/ac06160978bdf5b1ee077ff7b4e0136ab2ed94a2 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -49,7 +53,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -77,7 +83,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/7ce654c7dbc1242d117e03ee292315c464c0e50e b/explorer/fuzzing/fuzzer_corpus/ac7cd64ec76981e445dafd5575bb4064bf58679e similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7ce654c7dbc1242d117e03ee292315c464c0e50e rename to explorer/fuzzing/fuzzer_corpus/ac7cd64ec76981e445dafd5575bb4064bf58679e index 9366153011f0..a2e2205310ac 100644 --- a/explorer/fuzzing/fuzzer_corpus/7ce654c7dbc1242d117e03ee292315c464c0e50e +++ b/explorer/fuzzing/fuzzer_corpus/ac7cd64ec76981e445dafd5575bb4064bf58679e @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,18 +70,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -124,7 +125,9 @@ compilation_unit { } declarations { function { - name: "Origin" + name { + name: "Origin" + } deduced_parameters { name: "U" type { @@ -226,7 +229,9 @@ compilation_unit { } declarations { function { - name: "Clone" + name { + name: "Clone" + } deduced_parameters { name: "U" type { @@ -325,7 +330,9 @@ compilation_unit { } declarations { function { - name: "SumXY" + name { + name: "SumXY" + } deduced_parameters { name: "U" type { @@ -426,7 +433,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -451,7 +460,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -514,7 +525,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c9eaac22587d9772d74df77cdb8c648e0fc49363 b/explorer/fuzzing/fuzzer_corpus/acc5855acb0ff0978d05f4b38c1b4f294cd24e10 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/c9eaac22587d9772d74df77cdb8c648e0fc49363 rename to explorer/fuzzing/fuzzer_corpus/acc5855acb0ff0978d05f4b38c1b4f294cd24e10 index 3a7dbd68b95f..1593a01c9d71 100644 --- a/explorer/fuzzing/fuzzer_corpus/c9eaac22587d9772d74df77cdb8c648e0fc49363 +++ b/explorer/fuzzing/fuzzer_corpus/acc5855acb0ff0978d05f4b38c1b4f294cd24e10 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,21 +70,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -158,7 +161,9 @@ compilation_unit { } members { function { - name: "Clone" + name { + name: "Clone" + } self_pattern { binding_pattern { name: "self" @@ -249,7 +254,9 @@ compilation_unit { } members { function { - name: "SumXY" + name { + name: "SumXY" + } self_pattern { binding_pattern { name: "self" @@ -388,7 +395,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -413,7 +422,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -476,7 +487,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ad05da3e9c1f907b99b6048575fd6f1a27a69ede b/explorer/fuzzing/fuzzer_corpus/ad05da3e9c1f907b99b6048575fd6f1a27a69ede deleted file mode 100644 index be34c0930d64..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ad05da3e9c1f907b99b6048575fd6f1a27a69ede +++ /dev/null @@ -1,133 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "Print" - } - } - argument { - tuple_literal { - fields { - string_literal { - value: "strings equal: {0}" - } - } - fields { - if_expression { - condition { - operator { - op: Eq - arguments { - string_literal { - value: "hello" - } - } - arguments { - string_literal { - value: "world" - } - } - } - } - then_expression { - int_literal { - value: 1 - } - } - else_expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "Print" - } - } - argument { - tuple_literal { - fields { - string_literal { - value: "ints equal: {0}" - } - } - fields { - if_expression { - condition { - operator { - op: Eq - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - then_expression { - int_literal { - value: 1 - } - } - else_expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - statements { - return_expression_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/afddf967525322bdc77cb53ac91b91092e0b94e7 b/explorer/fuzzing/fuzzer_corpus/ae187d3c2a3f587cfc53c496fdaefc7237b5da06 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/afddf967525322bdc77cb53ac91b91092e0b94e7 rename to explorer/fuzzing/fuzzer_corpus/ae187d3c2a3f587cfc53c496fdaefc7237b5da06 index 835cf2c04c91..018ca60e1c40 100644 --- a/explorer/fuzzing/fuzzer_corpus/afddf967525322bdc77cb53ac91b91092e0b94e7 +++ b/explorer/fuzzing/fuzzer_corpus/ae187d3c2a3f587cfc53c496fdaefc7237b5da06 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -38,7 +40,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ae4250e3cccc84665079618f2b1e94890c23a863 b/explorer/fuzzing/fuzzer_corpus/ae4250e3cccc84665079618f2b1e94890c23a863 new file mode 100644 index 000000000000..c5bb8256f744 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ae4250e3cccc84665079618f2b1e94890c23a863 @@ -0,0 +1,244 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasAssoc" + } + members { + let { + pattern { + generic_binding { + name: "Assoc" + type { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "X" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithoutRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + equals { + lhs { + designator { + name: "Assoc" + } + } + rhs { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "WithRewrite" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + compound_member_access { + object { + identifier { + name: "x" + } + } + path { + simple_member_access { + field: "Assoc" + object { + identifier { + name: "WithoutRewrite" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ae6f380f5cff73707edfdf951fed67cef050702d b/explorer/fuzzing/fuzzer_corpus/ae6f380f5cff73707edfdf951fed67cef050702d new file mode 100644 index 000000000000..418b1d9a1638 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ae6f380f5cff73707edfdf951fed67cef050702d @@ -0,0 +1,134 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "A" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + identifier { + name: "n" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 2 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/8770437dce3449b8e44b1f2d53519005dd3a1197 b/explorer/fuzzing/fuzzer_corpus/ae7fb22c5903ae2bd7eb6c125aadc6e1c39a43b1 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/8770437dce3449b8e44b1f2d53519005dd3a1197 rename to explorer/fuzzing/fuzzer_corpus/ae7fb22c5903ae2bd7eb6c125aadc6e1c39a43b1 index cf243324b0ed..6a9150ccbfc1 100644 --- a/explorer/fuzzing/fuzzer_corpus/8770437dce3449b8e44b1f2d53519005dd3a1197 +++ b/explorer/fuzzing/fuzzer_corpus/ae7fb22c5903ae2bd7eb6c125aadc6e1c39a43b1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -25,7 +27,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/891e132f2d0d49a37082a9b86d5cc334b441f67d b/explorer/fuzzing/fuzzer_corpus/ae84a74278fbcaf0a9526002d80d7d688071f830 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/891e132f2d0d49a37082a9b86d5cc334b441f67d rename to explorer/fuzzing/fuzzer_corpus/ae84a74278fbcaf0a9526002d80d7d688071f830 index dc72e590f40d..f71d0a4df3a9 100644 --- a/explorer/fuzzing/fuzzer_corpus/891e132f2d0d49a37082a9b86d5cc334b441f67d +++ b/explorer/fuzzing/fuzzer_corpus/ae84a74278fbcaf0a9526002d80d7d688071f830 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,18 +24,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -47,7 +46,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -76,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -104,7 +107,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/aec8e41ec050f7ac7949c98922b69b326ead66dc b/explorer/fuzzing/fuzzer_corpus/aec8e41ec050f7ac7949c98922b69b326ead66dc new file mode 100644 index 000000000000..47a5f8db2a72 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/aec8e41ec050f7ac7949c98922b69b326ead66dc @@ -0,0 +1,156 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M1" + } + members { + function { + name { + name: "F1" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M2" + } + members { + function { + name { + name: "F1" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M2" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/aee45564efafd5ba31e2a2ff37ec28e6a7467454 b/explorer/fuzzing/fuzzer_corpus/aee45564efafd5ba31e2a2ff37ec28e6a7467454 new file mode 100644 index 000000000000..47dbdb87e4c6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/aee45564efafd5ba31e2a2ff37ec28e6a7467454 @@ -0,0 +1,49 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + identifier { + name: "N" + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b0491a3d1a612b9db8c3c0aea3beb47bb1c969bc b/explorer/fuzzing/fuzzer_corpus/b0491a3d1a612b9db8c3c0aea3beb47bb1c969bc new file mode 100644 index 000000000000..b6aad628203a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b0491a3d1a612b9db8c3c0aea3beb47bb1c969bc @@ -0,0 +1,139 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + match { + expression { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + clauses { + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + is_default: true + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/39e350656615be34b022ac0a977d0c1e164e30b3 b/explorer/fuzzing/fuzzer_corpus/b16cf513638e6de15cdbaa109f89af668838b96d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/39e350656615be34b022ac0a977d0c1e164e30b3 rename to explorer/fuzzing/fuzzer_corpus/b16cf513638e6de15cdbaa109f89af668838b96d index 34c7e5039953..2f7e4660771a 100644 --- a/explorer/fuzzing/fuzzer_corpus/39e350656615be34b022ac0a977d0c1e164e30b3 +++ b/explorer/fuzzing/fuzzer_corpus/b16cf513638e6de15cdbaa109f89af668838b96d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b199b67a1dc9ed62f467033a9d14b0a7404be0af b/explorer/fuzzing/fuzzer_corpus/b199b67a1dc9ed62f467033a9d14b0a7404be0af new file mode 100644 index 000000000000..0199896b37e3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b199b67a1dc9ed62f467033a9d14b0a7404be0af @@ -0,0 +1,2025 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "AB" + } + alternatives { + name: "A" + signature { + } + } + alternatives { + name: "B" + signature { + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "AB" + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + match { + expression { + tuple_literal { + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 6 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 7 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "A" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 8 + } + } + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + binding_pattern { + name: "_" + type { + expression_pattern { + expression { + identifier { + name: "AB" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + call { + function { + simple_member_access { + field: "B" + object { + identifier { + name: "AB" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 9 + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a490dc28d2c85f97c04da162bb24273e33f60e88 b/explorer/fuzzing/fuzzer_corpus/b1e9560f0665a4c7381526676797f330b5ddaf72 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/a490dc28d2c85f97c04da162bb24273e33f60e88 rename to explorer/fuzzing/fuzzer_corpus/b1e9560f0665a4c7381526676797f330b5ddaf72 index 2794e84b1e77..15d296de4b66 100644 --- a/explorer/fuzzing/fuzzer_corpus/a490dc28d2c85f97c04da162bb24273e33f60e88 +++ b/explorer/fuzzing/fuzzer_corpus/b1e9560f0665a4c7381526676797f330b5ddaf72 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "HasI32Param" + name { + name: "HasI32Param" + } type_params { fields { generic_binding { @@ -21,7 +23,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { binding_pattern { @@ -60,7 +64,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -101,7 +107,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/b24ab1329ade1d249042b49cbefaabe9e289d990 b/explorer/fuzzing/fuzzer_corpus/b24ab1329ade1d249042b49cbefaabe9e289d990 new file mode 100644 index 000000000000..5eb4588d4ef3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b24ab1329ade1d249042b49cbefaabe9e289d990 @@ -0,0 +1,117 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "TwoTypes" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "U" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "X" + type { + where { + base { + identifier { + name: "TwoTypes" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + designator { + name: "U" + } + } + } + } + clauses { + rewrite { + member_name: "U" + replacement { + operator { + op: Ptr + arguments { + designator { + name: "U" + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0f2f35d69e772d1548bb252041b45d254bb1f4c8 b/explorer/fuzzing/fuzzer_corpus/b273f6d89c4098dddc6a17fc2200950b2a1ca8b2 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/0f2f35d69e772d1548bb252041b45d254bb1f4c8 rename to explorer/fuzzing/fuzzer_corpus/b273f6d89c4098dddc6a17fc2200950b2a1ca8b2 index f4e12a604561..cf7c923d7cc0 100644 --- a/explorer/fuzzing/fuzzer_corpus/0f2f35d69e772d1548bb252041b45d254bb1f4c8 +++ b/explorer/fuzzing/fuzzer_corpus/b273f6d89c4098dddc6a17fc2200950b2a1ca8b2 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -22,7 +26,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -34,21 +40,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "H" + name { + name: "H" + } param_pattern { } return_term { @@ -60,18 +63,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Get1" + name { + name: "Get1" + } deduced_parameters { name: "T" type { @@ -164,7 +162,9 @@ compilation_unit { } declarations { function { - name: "Get2" + name { + name: "Get2" + } deduced_parameters { name: "T" type { @@ -234,7 +234,9 @@ compilation_unit { } declarations { function { - name: "Get3" + name { + name: "Get3" + } deduced_parameters { name: "T" type { @@ -369,7 +371,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -394,7 +398,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -433,7 +439,9 @@ compilation_unit { } members { function { - name: "H" + name { + name: "H" + } param_pattern { } return_term { @@ -460,7 +468,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2707aba6bd4e18dee9a06c5b7a9d3888c95744aa b/explorer/fuzzing/fuzzer_corpus/b29000a8e0ea6fec127c857cb6962831455a6864 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/2707aba6bd4e18dee9a06c5b7a9d3888c95744aa rename to explorer/fuzzing/fuzzer_corpus/b29000a8e0ea6fec127c857cb6962831455a6864 index 1ce4e0fcf871..1ba63da07553 100644 --- a/explorer/fuzzing/fuzzer_corpus/2707aba6bd4e18dee9a06c5b7a9d3888c95744aa +++ b/explorer/fuzzing/fuzzer_corpus/b29000a8e0ea6fec127c857cb6962831455a6864 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Cell" + name { + name: "Cell" + } members { function { - name: "Create" + name { + name: "Create" + } param_pattern { fields { binding_pattern { @@ -68,7 +72,9 @@ compilation_unit { } members { function { - name: "Get" + name { + name: "Get" + } self_pattern { binding_pattern { name: "self" @@ -113,7 +119,9 @@ compilation_unit { } members { function { - name: "Put" + name { + name: "Put" + } self_pattern { addr_pattern { binding_pattern { @@ -177,6 +185,7 @@ compilation_unit { name: "x" } } + op: Plain } } } @@ -184,7 +193,9 @@ compilation_unit { } members { function { - name: "CreateOther" + name { + name: "CreateOther" + } deduced_parameters { name: "U" type { @@ -294,7 +305,9 @@ compilation_unit { } declarations { class_declaration { - name: "Integer" + name { + name: "Integer" + } members { variable { binding { @@ -314,7 +327,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -443,6 +458,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/fc768f84e663241e32cc539c0e21bf78a2b9afcd b/explorer/fuzzing/fuzzer_corpus/b2acd6d4db835cc2de6d578a31e55c9723d376e8 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/fc768f84e663241e32cc539c0e21bf78a2b9afcd rename to explorer/fuzzing/fuzzer_corpus/b2acd6d4db835cc2de6d578a31e55c9723d376e8 index dd0e929e1220..adb4e17cd3cf 100644 --- a/explorer/fuzzing/fuzzer_corpus/fc768f84e663241e32cc539c0e21bf78a2b9afcd +++ b/explorer/fuzzing/fuzzer_corpus/b2acd6d4db835cc2de6d578a31e55c9723d376e8 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,21 +24,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -46,18 +47,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Get" + name { + name: "Get" + } deduced_parameters { name: "T" type { @@ -139,7 +135,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -178,7 +176,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -205,7 +205,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b301d94100ed0b15766a8e48767ea685c582104f b/explorer/fuzzing/fuzzer_corpus/b301d94100ed0b15766a8e48767ea685c582104f new file mode 100644 index 000000000000..9d38c0579fbe --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b301d94100ed0b15766a8e48767ea685c582104f @@ -0,0 +1,83 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "y" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ffb59a1f53af0394d71add63ca552a022a37dbf9 b/explorer/fuzzing/fuzzer_corpus/b378b42f85eee698486a62693531402037b1bc49 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ffb59a1f53af0394d71add63ca552a022a37dbf9 rename to explorer/fuzzing/fuzzer_corpus/b378b42f85eee698486a62693531402037b1bc49 index 4a1907970521..a0fa4e22095f 100644 --- a/explorer/fuzzing/fuzzer_corpus/ffb59a1f53af0394d71add63ca552a022a37dbf9 +++ b/explorer/fuzzing/fuzzer_corpus/b378b42f85eee698486a62693531402037b1bc49 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -74,6 +76,7 @@ compilation_unit { value: 1 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/91d28b3eb682e6191e35c9292d009c5ca616074a b/explorer/fuzzing/fuzzer_corpus/b39595171e8c39e233d22ff07474d2930dce8de0 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/91d28b3eb682e6191e35c9292d009c5ca616074a rename to explorer/fuzzing/fuzzer_corpus/b39595171e8c39e233d22ff07474d2930dce8de0 index 3b5784bd5701..58ce0d486d74 100644 --- a/explorer/fuzzing/fuzzer_corpus/91d28b3eb682e6191e35c9292d009c5ca616074a +++ b/explorer/fuzzing/fuzzer_corpus/b39595171e8c39e233d22ff07474d2930dce8de0 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -148,7 +149,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -257,7 +260,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -313,7 +318,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -462,7 +469,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e730b05d75b611410a52ddf9cbda54416a073ea0 b/explorer/fuzzing/fuzzer_corpus/b3fe9e4e59812a710955af9540ba6ab44efbaf64 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/e730b05d75b611410a52ddf9cbda54416a073ea0 rename to explorer/fuzzing/fuzzer_corpus/b3fe9e4e59812a710955af9540ba6ab44efbaf64 index 323fcb8ae279..d76fd5982c80 100644 --- a/explorer/fuzzing/fuzzer_corpus/e730b05d75b611410a52ddf9cbda54416a073ea0 +++ b/explorer/fuzzing/fuzzer_corpus/b3fe9e4e59812a710955af9540ba6ab44efbaf64 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b4336ccf8951de3a6f1eae4148f3c5623ddcb422 b/explorer/fuzzing/fuzzer_corpus/b4336ccf8951de3a6f1eae4148f3c5623ddcb422 new file mode 100644 index 000000000000..cce2a01ab17b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b4336ccf8951de3a6f1eae4148f3c5623ddcb422 @@ -0,0 +1,104 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b474e2aac0787cafe1ab33ed25b46bb23f885722 b/explorer/fuzzing/fuzzer_corpus/b474e2aac0787cafe1ab33ed25b46bb23f885722 new file mode 100644 index 000000000000..2cd5a80b6376 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b474e2aac0787cafe1ab33ed25b46bb23f885722 @@ -0,0 +1,107 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + else_block { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b4afee2c44f479eb96d78550c25ecd77bd3cf2da b/explorer/fuzzing/fuzzer_corpus/b4afee2c44f479eb96d78550c25ecd77bd3cf2da deleted file mode 100644 index 8c79eff3a22d..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/b4afee2c44f479eb96d78550c25ecd77bd3cf2da +++ /dev/null @@ -1,55 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - match { - expression { - int_literal { - value: 0 - } - } - clauses { - pattern { - expression_pattern { - expression { - int_literal { - value: 1 - } - } - } - } - statement { - block { - statements { - return_expression_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/1a0ec7a6bc5b1202b3c7218ccf0b34374a79b601 b/explorer/fuzzing/fuzzer_corpus/b4bb9c9262bb757df5e80767ccbae9a4ac881725 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/1a0ec7a6bc5b1202b3c7218ccf0b34374a79b601 rename to explorer/fuzzing/fuzzer_corpus/b4bb9c9262bb757df5e80767ccbae9a4ac881725 index d2eb62302fe3..667c118580d0 100644 --- a/explorer/fuzzing/fuzzer_corpus/1a0ec7a6bc5b1202b3c7218ccf0b34374a79b601 +++ b/explorer/fuzzing/fuzzer_corpus/b4bb9c9262bb757df5e80767ccbae9a4ac881725 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,21 +70,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -216,7 +219,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -241,7 +246,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -304,7 +311,9 @@ compilation_unit { } declarations { function { - name: "SumXY" + name { + name: "SumXY" + } deduced_parameters { name: "U" type { @@ -406,7 +415,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/76c28ba56a2fb427e269abe280eb86bfdae9619a b/explorer/fuzzing/fuzzer_corpus/b50aa9e7ace48dadf651bfa991001f91782dcaed similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/76c28ba56a2fb427e269abe280eb86bfdae9619a rename to explorer/fuzzing/fuzzer_corpus/b50aa9e7ace48dadf651bfa991001f91782dcaed index 4c9438ae4fcf..0b34f96ab603 100644 --- a/explorer/fuzzing/fuzzer_corpus/76c28ba56a2fb427e269abe280eb86bfdae9619a +++ b/explorer/fuzzing/fuzzer_corpus/b50aa9e7ace48dadf651bfa991001f91782dcaed @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "HasDefault" + name { + name: "HasDefault" + } members { function { - name: "Default" + name { + name: "Default" + } param_pattern { } return_term { @@ -21,13 +25,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -44,7 +41,9 @@ compilation_unit { } members { function { - name: "Default" + name { + name: "Default" + } param_pattern { } return_term { @@ -71,7 +70,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b55695cb397c83a01e77b4979eadc71307bf5bb5 b/explorer/fuzzing/fuzzer_corpus/b55695cb397c83a01e77b4979eadc71307bf5bb5 new file mode 100644 index 000000000000..e9de1f0d57b4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b55695cb397c83a01e77b4979eadc71307bf5bb5 @@ -0,0 +1,162 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasFoo" + } + members { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Omitted + } + } + } + } + } + declarations { + constraint { + name { + name: "ImplAsHasFoo" + } + members { + interface_impl { + impl_type { + identifier { + name: "Self" + } + } + constraint { + identifier { + name: "HasFoo" + } + } + } + } + } + } + declarations { + function { + name { + name: "CallFoo" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "ImplAsHasFoo" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "x" + } + } + path { + simple_member_access { + field: "Foo" + object { + identifier { + name: "HasFoo" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "x" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/91bb6864014922134b7f7cc47a74ecfd33c87535 b/explorer/fuzzing/fuzzer_corpus/b5b805036d15f3a938fad5b99b9b07899406fbbb similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/91bb6864014922134b7f7cc47a74ecfd33c87535 rename to explorer/fuzzing/fuzzer_corpus/b5b805036d15f3a938fad5b99b9b07899406fbbb index fb114fc875b6..1f81be6c24a1 100644 --- a/explorer/fuzzing/fuzzer_corpus/91bb6864014922134b7f7cc47a74ecfd33c87535 +++ b/explorer/fuzzing/fuzzer_corpus/b5b805036d15f3a938fad5b99b9b07899406fbbb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/b7073fc9e1dca3289d930ea8cebaddf7ac01f97b b/explorer/fuzzing/fuzzer_corpus/b7073fc9e1dca3289d930ea8cebaddf7ac01f97b new file mode 100644 index 000000000000..30fb045debc8 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b7073fc9e1dca3289d930ea8cebaddf7ac01f97b @@ -0,0 +1,103 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/87b10e70852827fcfe2e4493d50b9234a56358a5 b/explorer/fuzzing/fuzzer_corpus/b726270c1f1b906118bb7bd3f0e31fad70e53bb3 similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/87b10e70852827fcfe2e4493d50b9234a56358a5 rename to explorer/fuzzing/fuzzer_corpus/b726270c1f1b906118bb7bd3f0e31fad70e53bb3 index 8d02d3257b5c..9d844efd0021 100644 --- a/explorer/fuzzing/fuzzer_corpus/87b10e70852827fcfe2e4493d50b9234a56358a5 +++ b/explorer/fuzzing/fuzzer_corpus/b726270c1f1b906118bb7bd3f0e31fad70e53bb3 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -17,7 +19,9 @@ compilation_unit { } declarations { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -29,7 +33,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -52,6 +58,7 @@ compilation_unit { name: "G" } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/b74151b3e158893704ac65ea4234df17aa39ba2d b/explorer/fuzzing/fuzzer_corpus/b74151b3e158893704ac65ea4234df17aa39ba2d new file mode 100644 index 000000000000..432b83fd085e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b74151b3e158893704ac65ea4234df17aa39ba2d @@ -0,0 +1,102 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + function { + name { + name: "PickType" + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "GetZero" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "PickType" + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d891ff517f0a2ae8adb70de115e4dd7a3aeeb02d b/explorer/fuzzing/fuzzer_corpus/b82b61890040bf6bd38d81508e0919e979df0360 similarity index 56% rename from explorer/fuzzing/fuzzer_corpus/d891ff517f0a2ae8adb70de115e4dd7a3aeeb02d rename to explorer/fuzzing/fuzzer_corpus/b82b61890040bf6bd38d81508e0919e979df0360 index 5991d8d0e550..b1d2c5467f7b 100644 --- a/explorer/fuzzing/fuzzer_corpus/d891ff517f0a2ae8adb70de115e4dd7a3aeeb02d +++ b/explorer/fuzzing/fuzzer_corpus/b82b61890040bf6bd38d81508e0919e979df0360 @@ -5,63 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "Similar" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "Iface" } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "T" - } - } - interface { - call { - function { - identifier { - name: "Similar" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - call { - function { - identifier { - name: "Similar" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { } } } @@ -72,30 +25,29 @@ compilation_unit { } declarations { function { - name: "CheckSimilar" + name { + name: "F" + } deduced_parameters { name: "T" type { - type_type_literal { - } - } - } - deduced_parameters { - name: "U" - type { - call { - function { + where { + base { identifier { - name: "Similar" + name: "Iface" } } - argument { - tuple_literal { - fields { - identifier { + clauses { + equals { + lhs { + designator { name: "T" } } + rhs { + int_type_literal { + } + } } } } @@ -104,7 +56,7 @@ compilation_unit { param_pattern { fields { binding_pattern { - name: "a" + name: "x" type { expression_pattern { expression { @@ -116,20 +68,6 @@ compilation_unit { } } } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } } return_term { kind: Omitted @@ -140,7 +78,177 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "G" + } + deduced_parameters { + name: "U" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + equals { + lhs { + designator { + name: "T" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "H" + } + deduced_parameters { + name: "V" + type { + identifier { + name: "Iface" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Class" + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } param_pattern { } return_term { @@ -155,11 +263,12 @@ compilation_unit { variable_definition { pattern { binding_pattern { - name: "n" + name: "x" type { expression_pattern { expression { - int_type_literal { + identifier { + name: "Class" } } } @@ -167,8 +276,7 @@ compilation_unit { } } init { - int_literal { - value: 0 + struct_literal { } } is_returned: false @@ -180,19 +288,14 @@ compilation_unit { call { function { identifier { - name: "CheckSimilar" + name: "G" } } argument { tuple_literal { fields { - bool_literal { - value: true - } - } - fields { - bool_literal { - value: false + identifier { + name: "x" } } } @@ -207,46 +310,14 @@ compilation_unit { call { function { identifier { - name: "CheckSimilar" - } - } - argument { - tuple_literal { - fields { - bool_literal { - value: true - } - } - fields { - identifier { - name: "n" - } - } - } - } - } - } - } - } - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "CheckSimilar" + name: "H" } } argument { tuple_literal { fields { identifier { - name: "n" - } - } - fields { - bool_literal { - value: false + name: "x" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/8aa48e8e4f3e5c36d8124d87676cb3233c02ce04 b/explorer/fuzzing/fuzzer_corpus/b84e935c0a1d62f7eae55e1c41759d8aa23747dd similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/8aa48e8e4f3e5c36d8124d87676cb3233c02ce04 rename to explorer/fuzzing/fuzzer_corpus/b84e935c0a1d62f7eae55e1c41759d8aa23747dd index 9ee562f48b13..da6f6f6342a9 100644 --- a/explorer/fuzzing/fuzzer_corpus/8aa48e8e4f3e5c36d8124d87676cb3233c02ce04 +++ b/explorer/fuzzing/fuzzer_corpus/b84e935c0a1d62f7eae55e1c41759d8aa23747dd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -28,6 +30,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/b8d5ed2d1a8e04bbcb473f9207bb5f630d0666cc b/explorer/fuzzing/fuzzer_corpus/b8d5ed2d1a8e04bbcb473f9207bb5f630d0666cc new file mode 100644 index 000000000000..72ff31919b60 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b8d5ed2d1a8e04bbcb473f9207bb5f630d0666cc @@ -0,0 +1,87 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Assert" + } + } + argument { + tuple_literal { + fields { + bool_literal { + value: true + } + } + fields { + string_literal { + value: "HALLO WELT" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Assert" + } + } + argument { + tuple_literal { + fields { + bool_literal { + value: false + } + } + fields { + string_literal { + value: "HALLO WELT" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f45d09cfa397da20c9b99ae67e1f5e68c53ae37b b/explorer/fuzzing/fuzzer_corpus/b8fe3d1147b59ce7acbd34b111453df89e1f4060 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/f45d09cfa397da20c9b99ae67e1f5e68c53ae37b rename to explorer/fuzzing/fuzzer_corpus/b8fe3d1147b59ce7acbd34b111453df89e1f4060 index 7afb7c29a0dc..dd57eccad961 100644 --- a/explorer/fuzzing/fuzzer_corpus/f45d09cfa397da20c9b99ae67e1f5e68c53ae37b +++ b/explorer/fuzzing/fuzzer_corpus/b8fe3d1147b59ce7acbd34b111453df89e1f4060 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "apply" + name { + name: "apply" + } deduced_parameters { name: "T" type { @@ -97,7 +99,9 @@ compilation_unit { } declarations { function { - name: "positive" + name { + name: "positive" + } param_pattern { fields { binding_pattern { @@ -162,7 +166,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d0072654ed20717ed64b026b1df31cabc7a84867 b/explorer/fuzzing/fuzzer_corpus/b90c4652e387f309191792de386c87b605bb1b5e similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/d0072654ed20717ed64b026b1df31cabc7a84867 rename to explorer/fuzzing/fuzzer_corpus/b90c4652e387f309191792de386c87b605bb1b5e index 0c7178cae286..03a86df84504 100644 --- a/explorer/fuzzing/fuzzer_corpus/d0072654ed20717ed64b026b1df31cabc7a84867 +++ b/explorer/fuzzing/fuzzer_corpus/b90c4652e387f309191792de386c87b605bb1b5e @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "C" + name { + name: "C" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,7 +24,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -48,7 +54,9 @@ compilation_unit { } declarations { function { - name: "ReturnF" + name { + name: "ReturnF" + } param_pattern { } return_term { @@ -74,7 +82,9 @@ compilation_unit { } declarations { function { - name: "ReturnG" + name { + name: "ReturnG" + } param_pattern { } return_term { @@ -100,7 +110,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/883513d394054a818ea79073d6d123fc0009b916 b/explorer/fuzzing/fuzzer_corpus/b92d5aefda5ebdbd4f97bd058532aabac8bbc4f8 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/883513d394054a818ea79073d6d123fc0009b916 rename to explorer/fuzzing/fuzzer_corpus/b92d5aefda5ebdbd4f97bd058532aabac8bbc4f8 index 8db589b31d8b..dbf4fac6f565 100644 --- a/explorer/fuzzing/fuzzer_corpus/883513d394054a818ea79073d6d123fc0009b916 +++ b/explorer/fuzzing/fuzzer_corpus/b92d5aefda5ebdbd4f97bd058532aabac8bbc4f8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ba79ad54a3664f4e5749ded96c86af21106c4a72 b/explorer/fuzzing/fuzzer_corpus/ba79ad54a3664f4e5749ded96c86af21106c4a72 new file mode 100644 index 000000000000..c2238dba2523 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ba79ad54a3664f4e5749ded96c86af21106c4a72 @@ -0,0 +1,64 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "f" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "f" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ba81a58612be6ea3790e3eb6453cc528eca37ae7 b/explorer/fuzzing/fuzzer_corpus/ba81a58612be6ea3790e3eb6453cc528eca37ae7 new file mode 100644 index 000000000000..557d58053797 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ba81a58612be6ea3790e3eb6453cc528eca37ae7 @@ -0,0 +1,61 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "A" + } + } + } + declarations { + interface { + name { + name: "B" + } + members { + interface_impl { + impl_type { + int_literal { + value: 5 + } + } + constraint { + identifier { + name: "A" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/098d50dfd46567ec8237cccc129696c64a60a75b b/explorer/fuzzing/fuzzer_corpus/baa653209768e0bddfcbf20dab23706384a09a0f similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/098d50dfd46567ec8237cccc129696c64a60a75b rename to explorer/fuzzing/fuzzer_corpus/baa653209768e0bddfcbf20dab23706384a09a0f index c56c3e7ecc14..49e2123b2b40 100644 --- a/explorer/fuzzing/fuzzer_corpus/098d50dfd46567ec8237cccc129696c64a60a75b +++ b/explorer/fuzzing/fuzzer_corpus/baa653209768e0bddfcbf20dab23706384a09a0f @@ -20,7 +20,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -43,6 +45,7 @@ compilation_unit { value: 1 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/bb0e7dc79473b942b06030f09e977ca7d65b9909 b/explorer/fuzzing/fuzzer_corpus/bb0e7dc79473b942b06030f09e977ca7d65b9909 new file mode 100644 index 000000000000..3f8d271efb3c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/bb0e7dc79473b942b06030f09e977ca7d65b9909 @@ -0,0 +1,202 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M1" + } + members { + function { + name { + name: "F1" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M3" + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M2" + } + members { + function { + name { + name: "F2" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + mix { + mixin { + identifier { + name: "M1" + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + mixin { + name { + name: "M3" + } + members { + mix { + mixin { + identifier { + name: "M2" + } + } + } + } + members { + function { + name { + name: "F3" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + mix { + mixin { + identifier { + name: "M2" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/bb1d40f46f5a1b10ad1c4fe3f4dbe58c2490cd6d b/explorer/fuzzing/fuzzer_corpus/bb1d40f46f5a1b10ad1c4fe3f4dbe58c2490cd6d new file mode 100644 index 000000000000..6f667a4e938b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/bb1d40f46f5a1b10ad1c4fe3f4dbe58c2490cd6d @@ -0,0 +1,121 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "X" + } + } + } + declarations { + interface { + name { + name: "Y" + } + members { + let { + pattern { + generic_binding { + name: "M" + type { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "Z" + } + members { + let { + pattern { + generic_binding { + name: "N" + type { + where { + base { + call { + function { + identifier { + name: "Y" + } + } + argument { + tuple_literal { + fields { + designator { + name: "Self" + } + } + } + } + } + } + clauses { + rewrite { + member_name: "M" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/bb99a69c513faaa42a4d69c083f11fd5c0bfc2b6 b/explorer/fuzzing/fuzzer_corpus/bb99a69c513faaa42a4d69c083f11fd5c0bfc2b6 new file mode 100644 index 000000000000..d43b0977c4d1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/bb99a69c513faaa42a4d69c083f11fd5c0bfc2b6 @@ -0,0 +1,350 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "DivWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Div + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 19 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + operator { + op: Div + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 2 + } + } + op: Div + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Div + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/212b776b9eac4e8195374bb267efc816e57ca249 b/explorer/fuzzing/fuzzer_corpus/bbabf13bb9fd0c2a5c1b23eaaf572dce295176a8 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/212b776b9eac4e8195374bb267efc816e57ca249 rename to explorer/fuzzing/fuzzer_corpus/bbabf13bb9fd0c2a5c1b23eaaf572dce295176a8 index 05984b2a3bfc..5dc0bcb449d9 100644 --- a/explorer/fuzzing/fuzzer_corpus/212b776b9eac4e8195374bb267efc816e57ca249 +++ b/explorer/fuzzing/fuzzer_corpus/bbabf13bb9fd0c2a5c1b23eaaf572dce295176a8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -88,6 +90,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -116,6 +119,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -130,6 +134,7 @@ compilation_unit { name: "x" } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/e3a2048ccc04d8ca8a047947a88dbfc45c48c9ba b/explorer/fuzzing/fuzzer_corpus/bcbbdac8be36d57d05bad59f42097f30f4791482 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/e3a2048ccc04d8ca8a047947a88dbfc45c48c9ba rename to explorer/fuzzing/fuzzer_corpus/bcbbdac8be36d57d05bad59f42097f30f4791482 index 259c04a97541..70cbde063b29 100644 --- a/explorer/fuzzing/fuzzer_corpus/e3a2048ccc04d8ca8a047947a88dbfc45c48c9ba +++ b/explorer/fuzzing/fuzzer_corpus/bcbbdac8be36d57d05bad59f42097f30f4791482 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -106,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -163,7 +166,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -204,7 +209,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -313,7 +320,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -415,7 +424,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -525,7 +536,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/bcc2dd95b1484870236d97145082f091d04420e8 b/explorer/fuzzing/fuzzer_corpus/bcc2dd95b1484870236d97145082f091d04420e8 new file mode 100644 index 000000000000..6d0b6fb90dee --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/bcc2dd95b1484870236d97145082f091d04420e8 @@ -0,0 +1,209 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Iface" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + fields { + generic_binding { + name: "T" + type { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + equals { + lhs { + designator { + name: "T" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + class_declaration { + name { + name: "Good" + } + } + } + declarations { + class_declaration { + name { + name: "Bad" + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Good" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Bad" + } + } + interface { + where { + base { + identifier { + name: "Iface" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + identifier { + name: "Bad" + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Good" + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Bad" + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1ae261160fce034414718a326ad74b9b73ad5c85 b/explorer/fuzzing/fuzzer_corpus/bd47802ae44cb178d49ce02e9da23114b99ca251 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1ae261160fce034414718a326ad74b9b73ad5c85 rename to explorer/fuzzing/fuzzer_corpus/bd47802ae44cb178d49ce02e9da23114b99ca251 index 3a328bf4883a..52b2cd24bf14 100644 --- a/explorer/fuzzing/fuzzer_corpus/1ae261160fce034414718a326ad74b9b73ad5c85 +++ b/explorer/fuzzing/fuzzer_corpus/bd47802ae44cb178d49ce02e9da23114b99ca251 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -131,6 +133,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -174,6 +177,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b33c89bfe75ea47d454e793734581f89d699acd3 b/explorer/fuzzing/fuzzer_corpus/bd5f1f538a69fe0749266a9dee58769dfcf466f6 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/b33c89bfe75ea47d454e793734581f89d699acd3 rename to explorer/fuzzing/fuzzer_corpus/bd5f1f538a69fe0749266a9dee58769dfcf466f6 index 2a4b0a36bc87..a6b16145b424 100644 --- a/explorer/fuzzing/fuzzer_corpus/b33c89bfe75ea47d454e793734581f89d699acd3 +++ b/explorer/fuzzing/fuzzer_corpus/bd5f1f538a69fe0749266a9dee58769dfcf466f6 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/307da4f675a3da88878f66b7ad5f5546c1bff202 b/explorer/fuzzing/fuzzer_corpus/bd773479ed6f502a082574ee2628f87093ef738c similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/307da4f675a3da88878f66b7ad5f5546c1bff202 rename to explorer/fuzzing/fuzzer_corpus/bd773479ed6f502a082574ee2628f87093ef738c index bd9941cc4161..37f878c76062 100644 --- a/explorer/fuzzing/fuzzer_corpus/307da4f675a3da88878f66b7ad5f5546c1bff202 +++ b/explorer/fuzzing/fuzzer_corpus/bd773479ed6f502a082574ee2628f87093ef738c @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -53,7 +55,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e6dcb8e47146481516205ac56a95ba7c196672d1 b/explorer/fuzzing/fuzzer_corpus/bdacd3ee8bd272bb8e010a36fdcf4a088e4aec58 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/e6dcb8e47146481516205ac56a95ba7c196672d1 rename to explorer/fuzzing/fuzzer_corpus/bdacd3ee8bd272bb8e010a36fdcf4a088e4aec58 index fa3073d4a41e..64f73d60c76e 100644 --- a/explorer/fuzzing/fuzzer_corpus/e6dcb8e47146481516205ac56a95ba7c196672d1 +++ b/explorer/fuzzing/fuzzer_corpus/bdacd3ee8bd272bb8e010a36fdcf4a088e4aec58 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/53ca8c76d3cb30196eeff9b8117a5bf5ecd5ffea b/explorer/fuzzing/fuzzer_corpus/bdc54a47f8ca73c471d86a7f88a172bd50b1225d similarity index 57% rename from explorer/fuzzing/fuzzer_corpus/53ca8c76d3cb30196eeff9b8117a5bf5ecd5ffea rename to explorer/fuzzing/fuzzer_corpus/bdc54a47f8ca73c471d86a7f88a172bd50b1225d index dc61764cb003..4bc6175326bc 100644 --- a/explorer/fuzzing/fuzzer_corpus/53ca8c76d3cb30196eeff9b8117a5bf5ecd5ffea +++ b/explorer/fuzzing/fuzzer_corpus/bdc54a47f8ca73c471d86a7f88a172bd50b1225d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -178,7 +180,7 @@ compilation_unit { name: "n" expression { int_literal { - value: 5 + value: 15 } } } @@ -204,7 +206,129 @@ compilation_unit { } arguments { int_literal { - value: 2 + value: 8 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 4 + } + } + op: Mod + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Mod + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + } + } } } } @@ -214,13 +338,8 @@ compilation_unit { statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/8b9fb73bee15e37f888c96b80236cbf5e8561da6 b/explorer/fuzzing/fuzzer_corpus/bfe98852a578baf4355b38a92b6a7e926c406a98 similarity index 86% rename from explorer/fuzzing/fuzzer_corpus/8b9fb73bee15e37f888c96b80236cbf5e8561da6 rename to explorer/fuzzing/fuzzer_corpus/bfe98852a578baf4355b38a92b6a7e926c406a98 index 3613f82a0ba2..76f9c84decd4 100644 --- a/explorer/fuzzing/fuzzer_corpus/8b9fb73bee15e37f888c96b80236cbf5e8561da6 +++ b/explorer/fuzzing/fuzzer_corpus/bfe98852a578baf4355b38a92b6a7e926c406a98 @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { alias { - name: "B" + name { + name: "B" + } target { where { base { @@ -44,7 +41,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c041849cb339ca45ab62dce7c33a4ba05379987d b/explorer/fuzzing/fuzzer_corpus/c041849cb339ca45ab62dce7c33a4ba05379987d deleted file mode 100644 index 45cf821985d8..000000000000 --- a/explorer/fuzzing/fuzzer_corpus/c041849cb339ca45ab62dce7c33a4ba05379987d +++ /dev/null @@ -1,152 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - function { - name: "DoSub" - deduced_parameters { - name: "T" - type { - where { - base { - call { - function { - identifier { - name: "SubWith" - } - } - argument { - tuple_literal { - fields { - designator { - name: "Self" - } - } - } - } - } - } - clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { - designator { - name: "Self" - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_expression_statement { - expression { - operator { - op: Sub - arguments { - identifier { - name: "x" - } - } - arguments { - identifier { - name: "y" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_expression_statement { - expression { - call { - function { - identifier { - name: "DoSub" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 3 - } - } - fields { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/f3e5997d2f73e65eae87b2e56accd07f4c54cbec b/explorer/fuzzing/fuzzer_corpus/c0ed5a9d140f0566bbd198e0664af222757c02f2 similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/f3e5997d2f73e65eae87b2e56accd07f4c54cbec rename to explorer/fuzzing/fuzzer_corpus/c0ed5a9d140f0566bbd198e0664af222757c02f2 index b488cfdf5584..c870ce004447 100644 --- a/explorer/fuzzing/fuzzer_corpus/f3e5997d2f73e65eae87b2e56accd07f4c54cbec +++ b/explorer/fuzzing/fuzzer_corpus/c0ed5a9d140f0566bbd198e0664af222757c02f2 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -32,7 +36,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "H" + name { + name: "H" + } param_pattern { } return_term { @@ -100,7 +108,9 @@ compilation_unit { } members { function { - name: "I" + name { + name: "I" + } param_pattern { } return_term { @@ -126,7 +136,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/04aca9d1fb78b349504f75dc82c5707eb66e7358 b/explorer/fuzzing/fuzzer_corpus/c149c4c29671c2acf61e2e869975aa39006097e1 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/04aca9d1fb78b349504f75dc82c5707eb66e7358 rename to explorer/fuzzing/fuzzer_corpus/c149c4c29671c2acf61e2e869975aa39006097e1 index 4e4c8d732ac0..fe246b7531e6 100644 --- a/explorer/fuzzing/fuzzer_corpus/04aca9d1fb78b349504f75dc82c5707eb66e7358 +++ b/explorer/fuzzing/fuzzer_corpus/c149c4c29671c2acf61e2e869975aa39006097e1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "fst" + name { + name: "fst" + } deduced_parameters { name: "T" type { @@ -66,7 +68,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f13b349ee6c248dc093c942152311b575fcc4896 b/explorer/fuzzing/fuzzer_corpus/c17ad69dffba927b155231a8149a72505bf1bed4 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/f13b349ee6c248dc093c942152311b575fcc4896 rename to explorer/fuzzing/fuzzer_corpus/c17ad69dffba927b155231a8149a72505bf1bed4 index af9e69bb7b5b..46b6c415aa56 100644 --- a/explorer/fuzzing/fuzzer_corpus/f13b349ee6c248dc093c942152311b575fcc4896 +++ b/explorer/fuzzing/fuzzer_corpus/c17ad69dffba927b155231a8149a72505bf1bed4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/99dd1c9126d29e00ebc4cd0e654d731778c17ec0 b/explorer/fuzzing/fuzzer_corpus/c1897b534a0b24174082b7de0e6afebe203f5020 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/99dd1c9126d29e00ebc4cd0e654d731778c17ec0 rename to explorer/fuzzing/fuzzer_corpus/c1897b534a0b24174082b7de0e6afebe203f5020 index 2312cff60c7d..c212c60c3e48 100644 --- a/explorer/fuzzing/fuzzer_corpus/99dd1c9126d29e00ebc4cd0e654d731778c17ec0 +++ b/explorer/fuzzing/fuzzer_corpus/c1897b534a0b24174082b7de0e6afebe203f5020 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -17,7 +19,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9d75ba5391f79aac733cc4129010928b3684c9c9 b/explorer/fuzzing/fuzzer_corpus/c2147917fd04da894c2b5dfa60a832ec96cfd4cc similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/9d75ba5391f79aac733cc4129010928b3684c9c9 rename to explorer/fuzzing/fuzzer_corpus/c2147917fd04da894c2b5dfa60a832ec96cfd4cc index b9120e30a888..258300ac6f63 100644 --- a/explorer/fuzzing/fuzzer_corpus/9d75ba5391f79aac733cc4129010928b3684c9c9 +++ b/explorer/fuzzing/fuzzer_corpus/c2147917fd04da894c2b5dfa60a832ec96cfd4cc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Frob" + name { + name: "Frob" + } members { let { pattern { @@ -21,7 +23,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -48,18 +52,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Use" + name { + name: "Use" + } deduced_parameters { name: "T" type { @@ -70,13 +69,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { designator { name: "Self" } @@ -175,13 +170,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { int_type_literal { } } @@ -191,7 +182,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -242,7 +235,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f55167ace03cf68649500ba89f15f80d59180169 b/explorer/fuzzing/fuzzer_corpus/c2f1538ac726bb759417984a05803182969950d2 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/f55167ace03cf68649500ba89f15f80d59180169 rename to explorer/fuzzing/fuzzer_corpus/c2f1538ac726bb759417984a05803182969950d2 index 914740182584..4ebfd7920246 100644 --- a/explorer/fuzzing/fuzzer_corpus/f55167ace03cf68649500ba89f15f80d59180169 +++ b/explorer/fuzzing/fuzzer_corpus/c2f1538ac726bb759417984a05803182969950d2 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,18 +24,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -47,7 +46,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -76,7 +77,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -145,7 +148,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -173,7 +178,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/c33b33a69a00ad7377d23a792435fa4b777964d4 b/explorer/fuzzing/fuzzer_corpus/c33b33a69a00ad7377d23a792435fa4b777964d4 new file mode 100644 index 000000000000..0e220810c520 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c33b33a69a00ad7377d23a792435fa4b777964d4 @@ -0,0 +1,265 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasAssoc" + } + members { + let { + pattern { + generic_binding { + name: "Assoc" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "X" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithoutRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + equals { + lhs { + designator { + name: "Assoc" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + alias { + name { + name: "WithRewrite" + } + target { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "WithoutRewrite" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + compound_member_access { + object { + identifier { + name: "T" + } + } + path { + simple_member_access { + field: "Assoc" + object { + identifier { + name: "WithRewrite" + } + } + } + } + } + } + } + } + } + } + init { + int_literal { + value: 2 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/c38b996f7ea337af3f99bc53f015707d0f1658c4 b/explorer/fuzzing/fuzzer_corpus/c38b996f7ea337af3f99bc53f015707d0f1658c4 new file mode 100644 index 000000000000..3d377b5bbcb1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c38b996f7ea337af3f99bc53f015707d0f1658c4 @@ -0,0 +1,609 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + members { + function { + name { + name: "Square" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "DistanceSquare" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "self" + } + } + } + } + argument { + tuple_literal { + fields { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "self" + } + } + } + } + argument { + tuple_literal { + fields { + operator { + op: Sub + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Complex" + } + members { + variable { + binding { + name: "r" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + members { + function { + name { + name: "AbsSquare" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "self" + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "r" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "Square" + object { + identifier { + name: "self" + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "i" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p1" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p2" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "Complex" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "r" + expression { + int_literal { + value: 5 + } + } + } + fields { + name: "i" + expression { + int_literal { + value: 6 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + call { + function { + simple_member_access { + field: "AbsSquare" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "DistanceSquare" + object { + identifier { + name: "p1" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p2" + } + } + } + } + } + } + } + } + arguments { + int_literal { + value: 51 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e3b3875d566a3be2195fff07eefc034f359c6163 b/explorer/fuzzing/fuzzer_corpus/c3c3a8aee0abfdd263b57f387db0ef47be0c1fc1 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/e3b3875d566a3be2195fff07eefc034f359c6163 rename to explorer/fuzzing/fuzzer_corpus/c3c3a8aee0abfdd263b57f387db0ef47be0c1fc1 index 4089a8f15a59..803f9c907878 100644 --- a/explorer/fuzzing/fuzzer_corpus/e3b3875d566a3be2195fff07eefc034f359c6163 +++ b/explorer/fuzzing/fuzzer_corpus/c3c3a8aee0abfdd263b57f387db0ef47be0c1fc1 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "flipFlag" + name { + name: "flipFlag" + } param_pattern { } return_term { @@ -44,6 +46,7 @@ compilation_unit { value: 0 } } + op: Plain } } } @@ -51,7 +54,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/901fab0dee5845b936de41afaef3a37202227e09 b/explorer/fuzzing/fuzzer_corpus/c449990049ecfeb94ab46604585847db44f97d1b similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/901fab0dee5845b936de41afaef3a37202227e09 rename to explorer/fuzzing/fuzzer_corpus/c449990049ecfeb94ab46604585847db44f97d1b index c4a99690a951..b3179394e2f3 100644 --- a/explorer/fuzzing/fuzzer_corpus/901fab0dee5845b936de41afaef3a37202227e09 +++ b/explorer/fuzzing/fuzzer_corpus/c449990049ecfeb94ab46604585847db44f97d1b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -51,6 +53,7 @@ compilation_unit { value: 10 } } + op: Plain } } statements { @@ -103,6 +106,7 @@ compilation_unit { value: 7 } } + op: Plain } } statements { @@ -160,6 +164,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/548312593165d1b8bfa24117a94ab5dce977df4d b/explorer/fuzzing/fuzzer_corpus/c488c3e1283e14e163f81c7155f5f3deb99ec993 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/548312593165d1b8bfa24117a94ab5dce977df4d rename to explorer/fuzzing/fuzzer_corpus/c488c3e1283e14e163f81c7155f5f3deb99ec993 index 5ffc10b29ed3..0a3d441bf608 100644 --- a/explorer/fuzzing/fuzzer_corpus/548312593165d1b8bfa24117a94ab5dce977df4d +++ b/explorer/fuzzing/fuzzer_corpus/c488c3e1283e14e163f81c7155f5f3deb99ec993 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "HasValueParam" + name { + name: "HasValueParam" + } members { function { - name: "Go" + name { + name: "Go" + } self_pattern { binding_pattern { name: "self" @@ -35,13 +39,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -75,7 +72,9 @@ compilation_unit { } members { function { - name: "Go" + name { + name: "Go" + } self_pattern { binding_pattern { name: "self" @@ -116,7 +115,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e11373b9810392a281ac5392bb3e8b287ae48b8f b/explorer/fuzzing/fuzzer_corpus/c4bd597847d498e86c6430431f022c93b4f1fac3 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/e11373b9810392a281ac5392bb3e8b287ae48b8f rename to explorer/fuzzing/fuzzer_corpus/c4bd597847d498e86c6430431f022c93b4f1fac3 index a05e1fcc1958..b81c2de64ace 100644 --- a/explorer/fuzzing/fuzzer_corpus/e11373b9810392a281ac5392bb3e8b287ae48b8f +++ b/explorer/fuzzing/fuzzer_corpus/c4bd597847d498e86c6430431f022c93b4f1fac3 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -51,7 +55,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -91,18 +97,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -137,7 +138,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -248,7 +251,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c51668b2002919bcd2e72177c64741e6077ef8cd b/explorer/fuzzing/fuzzer_corpus/c51668b2002919bcd2e72177c64741e6077ef8cd new file mode 100644 index 000000000000..e725c9f16b21 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c51668b2002919bcd2e72177c64741e6077ef8cd @@ -0,0 +1,181 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasTypeAndValue" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "V" + type { + identifier { + name: "T" + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + fields { + generic_binding { + name: "X" + type { + where { + base { + identifier { + name: "HasTypeAndValue" + } + } + clauses { + rewrite { + member_name: "V" + replacement { + int_literal { + value: 5 + } + } + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "V" + object { + identifier { + name: "X" + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + identifier { + name: "HasTypeAndValue" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "V" + replacement { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/037ed4792467ecaf7f145c6a005c433b4f3c806f b/explorer/fuzzing/fuzzer_corpus/c5d1191a26e60b5d7346dfe077dc864d1d0f140b similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/037ed4792467ecaf7f145c6a005c433b4f3c806f rename to explorer/fuzzing/fuzzer_corpus/c5d1191a26e60b5d7346dfe077dc864d1d0f140b index aa39f30c3204..51d43a10b8c8 100644 --- a/explorer/fuzzing/fuzzer_corpus/037ed4792467ecaf7f145c6a005c433b4f3c806f +++ b/explorer/fuzzing/fuzzer_corpus/c5d1191a26e60b5d7346dfe077dc864d1d0f140b @@ -5,22 +5,21 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -32,18 +31,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "C" + name { + name: "C" + } type_params { fields { generic_binding { @@ -108,7 +102,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -135,7 +131,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -175,7 +173,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/c5e12b066cbb6a6381f51a01431346fa332edba3 b/explorer/fuzzing/fuzzer_corpus/c5e12b066cbb6a6381f51a01431346fa332edba3 new file mode 100644 index 000000000000..503b45a0de77 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c5e12b066cbb6a6381f51a01431346fa332edba3 @@ -0,0 +1,588 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "B" + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "B" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "b" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "a" + object { + identifier { + name: "self" + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "B" + } + } + interface { + call { + function { + identifier { + name: "As" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "C" + } + } + } + } + } + } + members { + function { + name { + name: "Convert" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "C" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "c" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "b" + object { + identifier { + name: "self" + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + tuple_literal { + fields { + identifier { + name: "A" + } + } + fields { + identifier { + name: "A" + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + fields { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + tuple_literal { + fields { + identifier { + name: "B" + } + } + fields { + identifier { + name: "B" + } + } + } + } + } + } + } + } + init { + identifier { + name: "a" + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "b" + object { + index { + object { + identifier { + name: "b" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "b" + object { + index { + object { + identifier { + name: "b" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + tuple_literal { + fields { + identifier { + name: "C" + } + } + fields { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: As + arguments { + identifier { + name: "b" + } + } + arguments { + tuple_literal { + fields { + identifier { + name: "C" + } + } + fields { + identifier { + name: "C" + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "c" + object { + index { + object { + identifier { + name: "c" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "c" + object { + index { + object { + identifier { + name: "c" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f60600b7084679149329733b3d150860b3b0ea41 b/explorer/fuzzing/fuzzer_corpus/c686b589661a7deb008e286c6b5596b22c017615 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/f60600b7084679149329733b3d150860b3b0ea41 rename to explorer/fuzzing/fuzzer_corpus/c686b589661a7deb008e286c6b5596b22c017615 index d5965cfca8f7..93431e09c225 100644 --- a/explorer/fuzzing/fuzzer_corpus/f60600b7084679149329733b3d150860b3b0ea41 +++ b/explorer/fuzzing/fuzzer_corpus/c686b589661a7deb008e286c6b5596b22c017615 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "C" + name { + name: "C" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,7 +24,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -48,7 +54,9 @@ compilation_unit { } declarations { function { - name: "H" + name { + name: "H" + } deduced_parameters { name: "T" type { @@ -81,7 +89,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c6f657ee803166d7091f0a59cce11feba0319c39 b/explorer/fuzzing/fuzzer_corpus/c6f657ee803166d7091f0a59cce11feba0319c39 new file mode 100644 index 000000000000..def3b54803e3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c6f657ee803166d7091f0a59cce11feba0319c39 @@ -0,0 +1,487 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR B {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "Create" + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "B" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "x" + } + } + } + fields { + name: "a1" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 4 + } + } + } + } + } + } + } + fields { + name: "a2" + expression { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a1" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "a2" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 5 + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "B" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Create" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/c75f1f6324f2ebc6cdf2c0e8b96752c14e6f9fb6 b/explorer/fuzzing/fuzzer_corpus/c75f1f6324f2ebc6cdf2c0e8b96752c14e6f9fb6 new file mode 100644 index 000000000000..be7c5da433ba --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c75f1f6324f2ebc6cdf2c0e8b96752c14e6f9fb6 @@ -0,0 +1,45 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value" + object { + identifier { + name: "N" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ed2705d44f843843a320e1d1460401883d1c5fa3 b/explorer/fuzzing/fuzzer_corpus/c8751055cd8a1d14a9d8ef7dea2ad215574c0f95 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/ed2705d44f843843a320e1d1460401883d1c5fa3 rename to explorer/fuzzing/fuzzer_corpus/c8751055cd8a1d14a9d8ef7dea2ad215574c0f95 index be481f85b751..1ff75e4fb48b 100644 --- a/explorer/fuzzing/fuzzer_corpus/ed2705d44f843843a320e1d1460401883d1c5fa3 +++ b/explorer/fuzzing/fuzzer_corpus/c8751055cd8a1d14a9d8ef7dea2ad215574c0f95 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "AddInt" + name { + name: "AddInt" + } param_pattern { fields { binding_pattern { @@ -74,7 +76,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/af25c1403b2f590b2f02aca103b3d3aaf754c21f b/explorer/fuzzing/fuzzer_corpus/c939e8058be1e7249a4b189e9e676abf41b9af36 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/af25c1403b2f590b2f02aca103b3d3aaf754c21f rename to explorer/fuzzing/fuzzer_corpus/c939e8058be1e7249a4b189e9e676abf41b9af36 index 7c57d6dbccc1..a9a4c7d8eb02 100644 --- a/explorer/fuzzing/fuzzer_corpus/af25c1403b2f590b2f02aca103b3d3aaf754c21f +++ b/explorer/fuzzing/fuzzer_corpus/c939e8058be1e7249a4b189e9e676abf41b9af36 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -78,7 +82,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { } return_term { @@ -103,7 +109,9 @@ compilation_unit { } members { function { - name: "H" + name { + name: "H" + } self_pattern { binding_pattern { name: "self" @@ -144,7 +152,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -172,7 +182,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/0853ff183c254e06433129992812989b0a83c6d1 b/explorer/fuzzing/fuzzer_corpus/ca2009748b6a855a646c2ea92b74c0391780f2ea similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/0853ff183c254e06433129992812989b0a83c6d1 rename to explorer/fuzzing/fuzzer_corpus/ca2009748b6a855a646c2ea92b74c0391780f2ea index 6780a9c6c0b8..53345f335793 100644 --- a/explorer/fuzzing/fuzzer_corpus/0853ff183c254e06433129992812989b0a83c6d1 +++ b/explorer/fuzzing/fuzzer_corpus/ca2009748b6a855a646c2ea92b74c0391780f2ea @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -21,7 +23,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/83fe5e68f200c54bdbe2bef8b6368e81f3bf9544 b/explorer/fuzzing/fuzzer_corpus/ca9dec79282193d860160dd2f4bef7cdfcfd6369 similarity index 68% rename from explorer/fuzzing/fuzzer_corpus/83fe5e68f200c54bdbe2bef8b6368e81f3bf9544 rename to explorer/fuzzing/fuzzer_corpus/ca9dec79282193d860160dd2f4bef7cdfcfd6369 index b931985c71fe..abdf42fdc43c 100644 --- a/explorer/fuzzing/fuzzer_corpus/83fe5e68f200c54bdbe2bef8b6368e81f3bf9544 +++ b/explorer/fuzzing/fuzzer_corpus/ca9dec79282193d860160dd2f4bef7cdfcfd6369 @@ -7,7 +7,7 @@ compilation_unit { impl { kind: ExternalImpl impl_type { - struct_type_literal { + struct_literal { } } interface { @@ -20,7 +20,7 @@ compilation_unit { argument { tuple_literal { fields { - struct_type_literal { + struct_literal { } } } @@ -29,7 +29,9 @@ compilation_unit { } members { function { - name: "Equal" + name { + name: "Equal" + } self_pattern { binding_pattern { name: "self" @@ -80,11 +82,68 @@ compilation_unit { } } } + members { + function { + name { + name: "NotEqual" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + bool_literal { + value: false + } + } + } + } + } + } + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -107,7 +166,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false @@ -124,7 +183,7 @@ compilation_unit { } } arguments { - struct_type_literal { + struct_literal { } } } diff --git a/explorer/fuzzing/fuzzer_corpus/cab6a41e14e973615829654a236d7b115bbc7a4a b/explorer/fuzzing/fuzzer_corpus/cab6a41e14e973615829654a236d7b115bbc7a4a new file mode 100644 index 000000000000..8e1793fa9ac4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/cab6a41e14e973615829654a236d7b115bbc7a4a @@ -0,0 +1,57 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "Vector" + } + members { + function { + name { + qualifiers: "Vector" + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d9f90563333fd20c5d7b8e1467cee4176e497431 b/explorer/fuzzing/fuzzer_corpus/cb50321f6358690282c733b3e81bfb99352763bd similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/d9f90563333fd20c5d7b8e1467cee4176e497431 rename to explorer/fuzzing/fuzzer_corpus/cb50321f6358690282c733b3e81bfb99352763bd index d702f6e2ac40..cd258ac21016 100644 --- a/explorer/fuzzing/fuzzer_corpus/d9f90563333fd20c5d7b8e1467cee4176e497431 +++ b/explorer/fuzzing/fuzzer_corpus/cb50321f6358690282c733b3e81bfb99352763bd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "MakePoint" + name { + name: "MakePoint" + } param_pattern { } return_term { @@ -81,7 +85,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/499eaf1fd88f90950ead3ef1275b0de6868edc41 b/explorer/fuzzing/fuzzer_corpus/cbe6ee626f17131b0f169142698988362cd416a4 similarity index 91% rename from explorer/fuzzing/fuzzer_corpus/499eaf1fd88f90950ead3ef1275b0de6868edc41 rename to explorer/fuzzing/fuzzer_corpus/cbe6ee626f17131b0f169142698988362cd416a4 index 70cf469affba..e35d599432b2 100644 --- a/explorer/fuzzing/fuzzer_corpus/499eaf1fd88f90950ead3ef1275b0de6868edc41 +++ b/explorer/fuzzing/fuzzer_corpus/cbe6ee626f17131b0f169142698988362cd416a4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -33,7 +35,7 @@ compilation_unit { } init { string_literal { - value: "A block string literal\n\"\"\"\n" + value: "A block string literal\n\'\'\'\n" } } is_returned: false @@ -51,7 +53,7 @@ compilation_unit { } arguments { string_literal { - value: "A block string literal\n\"\"\"\n" + value: "A block string literal\n\'\'\'\n" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/5f389a1d3c3af21d9487af896073bf8231a93543 b/explorer/fuzzing/fuzzer_corpus/cc12041efe79d6fdd71233d01abdfc2fa9b1e145 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5f389a1d3c3af21d9487af896073bf8231a93543 rename to explorer/fuzzing/fuzzer_corpus/cc12041efe79d6fdd71233d01abdfc2fa9b1e145 index 8c11d53e8c96..8809824991ab 100644 --- a/explorer/fuzzing/fuzzer_corpus/5f389a1d3c3af21d9487af896073bf8231a93543 +++ b/explorer/fuzzing/fuzzer_corpus/cc12041efe79d6fdd71233d01abdfc2fa9b1e145 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/40db19330f5238fc82719e45fa0e8297974ed182 b/explorer/fuzzing/fuzzer_corpus/cc16e3023923b2a08ccc12474484922b3877cb7d similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/40db19330f5238fc82719e45fa0e8297974ed182 rename to explorer/fuzzing/fuzzer_corpus/cc16e3023923b2a08ccc12474484922b3877cb7d index e20865444f11..527cdb125c7e 100644 --- a/explorer/fuzzing/fuzzer_corpus/40db19330f5238fc82719e45fa0e8297974ed182 +++ b/explorer/fuzzing/fuzzer_corpus/cc16e3023923b2a08ccc12474484922b3877cb7d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -50,7 +52,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -96,7 +100,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/66ebec331ac305442c9fecdbc852080d09861c6e b/explorer/fuzzing/fuzzer_corpus/ccde77cc350813aca7fb8f9ddba7c15cf19aa753 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/66ebec331ac305442c9fecdbc852080d09861c6e rename to explorer/fuzzing/fuzzer_corpus/ccde77cc350813aca7fb8f9ddba7c15cf19aa753 index f0e1b10b3239..3185a60ed293 100644 --- a/explorer/fuzzing/fuzzer_corpus/66ebec331ac305442c9fecdbc852080d09861c6e +++ b/explorer/fuzzing/fuzzer_corpus/ccde77cc350813aca7fb8f9ddba7c15cf19aa753 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "C" + name { + name: "C" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,7 +24,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } self_pattern { binding_pattern { name: "self" @@ -48,7 +54,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/caa4948c390a3de12f9be23dfca5ae137d55af02 b/explorer/fuzzing/fuzzer_corpus/cd62089d4819abbb9bc53c6f05b9346a6e4da9d9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/caa4948c390a3de12f9be23dfca5ae137d55af02 rename to explorer/fuzzing/fuzzer_corpus/cd62089d4819abbb9bc53c6f05b9346a6e4da9d9 index ddbc501762c1..67ba1b32b329 100644 --- a/explorer/fuzzing/fuzzer_corpus/caa4948c390a3de12f9be23dfca5ae137d55af02 +++ b/explorer/fuzzing/fuzzer_corpus/cd62089d4819abbb9bc53c6f05b9346a6e4da9d9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -86,6 +88,7 @@ compilation_unit { value: 3 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/4344ecff7bd13588721f852fe3edf521a0d32710 b/explorer/fuzzing/fuzzer_corpus/cd7abde20f670fdcd4f1dc6c46514391a210b633 similarity index 90% rename from explorer/fuzzing/fuzzer_corpus/4344ecff7bd13588721f852fe3edf521a0d32710 rename to explorer/fuzzing/fuzzer_corpus/cd7abde20f670fdcd4f1dc6c46514391a210b633 index 4f574ee26ab9..031681b10759 100644 --- a/explorer/fuzzing/fuzzer_corpus/4344ecff7bd13588721f852fe3edf521a0d32710 +++ b/explorer/fuzzing/fuzzer_corpus/cd7abde20f670fdcd4f1dc6c46514391a210b633 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -25,7 +27,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7bcf903ad4f9783eb5473ca5604c83590093bcc0 b/explorer/fuzzing/fuzzer_corpus/cd81b4e344fc340d010b8eb5257e41bd1de259eb similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7bcf903ad4f9783eb5473ca5604c83590093bcc0 rename to explorer/fuzzing/fuzzer_corpus/cd81b4e344fc340d010b8eb5257e41bd1de259eb index 50d50b0453f6..0e2bb3cbd375 100644 --- a/explorer/fuzzing/fuzzer_corpus/7bcf903ad4f9783eb5473ca5604c83590093bcc0 +++ b/explorer/fuzzing/fuzzer_corpus/cd81b4e344fc340d010b8eb5257e41bd1de259eb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5751f95809ae96f25cc7a80764bf204a5ab173e6 b/explorer/fuzzing/fuzzer_corpus/ce21c01f50fa918dde114d98533c177667957b44 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/5751f95809ae96f25cc7a80764bf204a5ab173e6 rename to explorer/fuzzing/fuzzer_corpus/ce21c01f50fa918dde114d98533c177667957b44 index 094bffc850d5..1da3841262f3 100644 --- a/explorer/fuzzing/fuzzer_corpus/5751f95809ae96f25cc7a80764bf204a5ab173e6 +++ b/explorer/fuzzing/fuzzer_corpus/ce21c01f50fa918dde114d98533c177667957b44 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Frob" + name { + name: "Frob" + } members { let { pattern { @@ -21,7 +23,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -48,18 +52,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Use" + name { + name: "Use" + } deduced_parameters { name: "T" type { @@ -154,7 +153,9 @@ compilation_unit { } declarations { class_declaration { - name: "AlmostI32" + name { + name: "AlmostI32" + } members { variable { binding { @@ -197,7 +198,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -258,13 +261,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "AlmostI32" } @@ -275,7 +274,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -324,7 +325,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2b11b096a3168af04786e118860bff9e01e035da b/explorer/fuzzing/fuzzer_corpus/ce4a5dca5b77ec62e460a5603a9ad3240cabeebc similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/2b11b096a3168af04786e118860bff9e01e035da rename to explorer/fuzzing/fuzzer_corpus/ce4a5dca5b77ec62e460a5603a9ad3240cabeebc index de320aa20c75..4e60cfbf5ad7 100644 --- a/explorer/fuzzing/fuzzer_corpus/2b11b096a3168af04786e118860bff9e01e035da +++ b/explorer/fuzzing/fuzzer_corpus/ce4a5dca5b77ec62e460a5603a9ad3240cabeebc @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/5d7083fb0dbd25b344e850a1452ae65d15d0a46b b/explorer/fuzzing/fuzzer_corpus/cfb7c4c944abce79527a792be8edeab8a105bbee similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5d7083fb0dbd25b344e850a1452ae65d15d0a46b rename to explorer/fuzzing/fuzzer_corpus/cfb7c4c944abce79527a792be8edeab8a105bbee index 27c62eca589e..c3d4d66de395 100644 --- a/explorer/fuzzing/fuzzer_corpus/5d7083fb0dbd25b344e850a1452ae65d15d0a46b +++ b/explorer/fuzzing/fuzzer_corpus/cfb7c4c944abce79527a792be8edeab8a105bbee @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d005a63d70a3265665c19c84e7148a6b8f37586d b/explorer/fuzzing/fuzzer_corpus/d005a63d70a3265665c19c84e7148a6b8f37586d new file mode 100644 index 000000000000..4f80cc8e2fd5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d005a63d70a3265665c19c84e7148a6b8f37586d @@ -0,0 +1,207 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Destructor A {0}" + } + } + fields { + simple_member_access { + field: "i" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a0" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "a1" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "i" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "a2" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "a3" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "i" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7ece44c02f6c0cbf21c8ebae53aa18d345a3e75b b/explorer/fuzzing/fuzzer_corpus/d19c4ff26d2c5050306f61471db7b2056316ddfa similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/7ece44c02f6c0cbf21c8ebae53aa18d345a3e75b rename to explorer/fuzzing/fuzzer_corpus/d19c4ff26d2c5050306f61471db7b2056316ddfa index 11d47868ccdd..beded8a0ed01 100644 --- a/explorer/fuzzing/fuzzer_corpus/7ece44c02f6c0cbf21c8ebae53aa18d345a3e75b +++ b/explorer/fuzzing/fuzzer_corpus/d19c4ff26d2c5050306f61471db7b2056316ddfa @@ -20,7 +20,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d3107f901f2b6cfae8bfcbe1c1bea5a9342a7bfe b/explorer/fuzzing/fuzzer_corpus/d1ca518b60ba67635582c9e1f7dca5cf228a8eda similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d3107f901f2b6cfae8bfcbe1c1bea5a9342a7bfe rename to explorer/fuzzing/fuzzer_corpus/d1ca518b60ba67635582c9e1f7dca5cf228a8eda index 55e459f3373c..d42d875dba49 100644 --- a/explorer/fuzzing/fuzzer_corpus/d3107f901f2b6cfae8bfcbe1c1bea5a9342a7bfe +++ b/explorer/fuzzing/fuzzer_corpus/d1ca518b60ba67635582c9e1f7dca5cf228a8eda @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,18 +70,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -136,7 +137,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -161,7 +164,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -250,7 +255,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -330,7 +337,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -496,7 +505,9 @@ compilation_unit { } declarations { function { - name: "Sum" + name { + name: "Sum" + } deduced_parameters { name: "E" type { @@ -611,6 +622,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -643,6 +655,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -659,7 +672,9 @@ compilation_unit { } declarations { function { - name: "SumPoints" + name { + name: "SumPoints" + } deduced_parameters { name: "E" type { @@ -778,7 +793,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/92f27ae1f9dc8f65516df2900e3acc9aba0a5497 b/explorer/fuzzing/fuzzer_corpus/d1e9bf10ba663a79370c09ca3f2f7163f1f73bde similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/92f27ae1f9dc8f65516df2900e3acc9aba0a5497 rename to explorer/fuzzing/fuzzer_corpus/d1e9bf10ba663a79370c09ca3f2f7163f1f73bde index 744ab2f0b8b9..bc4262086ec4 100644 --- a/explorer/fuzzing/fuzzer_corpus/92f27ae1f9dc8f65516df2900e3acc9aba0a5497 +++ b/explorer/fuzzing/fuzzer_corpus/d1e9bf10ba663a79370c09ca3f2f7163f1f73bde @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -26,7 +28,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7347272007413592185657f9d0c6a8f4b41cd382 b/explorer/fuzzing/fuzzer_corpus/d1f2737124dc5d58887ec7f9058631d3d0b161fd similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/7347272007413592185657f9d0c6a8f4b41cd382 rename to explorer/fuzzing/fuzzer_corpus/d1f2737124dc5d58887ec7f9058631d3d0b161fd index acabeda5e9bc..8a076bcdb4fc 100644 --- a/explorer/fuzzing/fuzzer_corpus/7347272007413592185657f9d0c6a8f4b41cd382 +++ b/explorer/fuzzing/fuzzer_corpus/d1f2737124dc5d58887ec7f9058631d3d0b161fd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d22d12eb1a14d96b87311cb90c6413a41d777fc1 b/explorer/fuzzing/fuzzer_corpus/d22d12eb1a14d96b87311cb90c6413a41d777fc1 new file mode 100644 index 000000000000..ef80e6348ddd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d22d12eb1a14d96b87311cb90c6413a41d777fc1 @@ -0,0 +1,111 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d9481fb56b4ac76c69267230e38127b1b3cb83fb b/explorer/fuzzing/fuzzer_corpus/d2591834746c559d4b267154ed3541cf52319bfd similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/d9481fb56b4ac76c69267230e38127b1b3cb83fb rename to explorer/fuzzing/fuzzer_corpus/d2591834746c559d4b267154ed3541cf52319bfd index 3164b2629666..d297ebec3a0a 100644 --- a/explorer/fuzzing/fuzzer_corpus/d9481fb56b4ac76c69267230e38127b1b3cb83fb +++ b/explorer/fuzzing/fuzzer_corpus/d2591834746c559d4b267154ed3541cf52319bfd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/80ae33f62c2894be85c8cce043f3656fa3cb80f8 b/explorer/fuzzing/fuzzer_corpus/d3212565f73f5993018e380e910682e30215bb13 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/80ae33f62c2894be85c8cce043f3656fa3cb80f8 rename to explorer/fuzzing/fuzzer_corpus/d3212565f73f5993018e380e910682e30215bb13 index d4ac2181a58c..e264abd8bc08 100644 --- a/explorer/fuzzing/fuzzer_corpus/80ae33f62c2894be85c8cce043f3656fa3cb80f8 +++ b/explorer/fuzzing/fuzzer_corpus/d3212565f73f5993018e380e910682e30215bb13 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "id" + name { + name: "id" + } deduced_parameters { name: "T" type { @@ -52,7 +54,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d3a897a559f329f737df929fe871aab5da3805ab b/explorer/fuzzing/fuzzer_corpus/d3a897a559f329f737df929fe871aab5da3805ab new file mode 100644 index 000000000000..701b1ac62c8e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d3a897a559f329f737df929fe871aab5da3805ab @@ -0,0 +1,80 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + match { + expression { + identifier { + name: "n" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/117921e41437507de0b91e32012a76cdb9ba0c9a b/explorer/fuzzing/fuzzer_corpus/d3bdea629fba4740d1ce04e94e66ffa528796f7d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/117921e41437507de0b91e32012a76cdb9ba0c9a rename to explorer/fuzzing/fuzzer_corpus/d3bdea629fba4740d1ce04e94e66ffa528796f7d index 30779f61a647..9536fa1d03b2 100644 --- a/explorer/fuzzing/fuzzer_corpus/117921e41437507de0b91e32012a76cdb9ba0c9a +++ b/explorer/fuzzing/fuzzer_corpus/d3bdea629fba4740d1ce04e94e66ffa528796f7d @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Number" + name { + name: "Number" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -64,21 +70,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -158,7 +161,9 @@ compilation_unit { } members { function { - name: "SumXY" + name { + name: "SumXY" + } param_pattern { fields { binding_pattern { @@ -239,7 +244,9 @@ compilation_unit { } members { function { - name: "SumFn" + name { + name: "SumFn" + } param_pattern { } return_term { @@ -365,7 +372,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -390,7 +399,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -453,7 +464,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d3e875bb57012d16109ee38af1b3c63ad1c0119b b/explorer/fuzzing/fuzzer_corpus/d3e875bb57012d16109ee38af1b3c63ad1c0119b new file mode 100644 index 000000000000..4fc7ace02c8b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d3e875bb57012d16109ee38af1b3c63ad1c0119b @@ -0,0 +1,73 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name { + name: "C" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "C" + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_type_literal { + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7c554d8769584c371a2d7936c8cdfeb88684bcfd b/explorer/fuzzing/fuzzer_corpus/d40f0eece13f11308ad1f7a965180857fb1972cd similarity index 90% rename from explorer/fuzzing/fuzzer_corpus/7c554d8769584c371a2d7936c8cdfeb88684bcfd rename to explorer/fuzzing/fuzzer_corpus/d40f0eece13f11308ad1f7a965180857fb1972cd index 3c5d0fc1d77d..bc2e8b4640f8 100644 --- a/explorer/fuzzing/fuzzer_corpus/7c554d8769584c371a2d7936c8cdfeb88684bcfd +++ b/explorer/fuzzing/fuzzer_corpus/d40f0eece13f11308ad1f7a965180857fb1972cd @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -24,7 +26,7 @@ compilation_unit { type { expression_pattern { expression { - struct_type_literal { + struct_literal { } } } @@ -32,7 +34,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false @@ -46,9 +48,10 @@ compilation_unit { } } rhs { - struct_type_literal { + struct_literal { } } + op: Plain } } statements { @@ -62,7 +65,7 @@ compilation_unit { pattern { expression_pattern { expression { - struct_type_literal { + struct_literal { } } } diff --git a/explorer/fuzzing/fuzzer_corpus/cb60914941865d53d4b71370076caf9aba457e3c b/explorer/fuzzing/fuzzer_corpus/d415acd8c86e6475fe8d0c8a1d5de351a99ea967 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/cb60914941865d53d4b71370076caf9aba457e3c rename to explorer/fuzzing/fuzzer_corpus/d415acd8c86e6475fe8d0c8a1d5de351a99ea967 index 6821bfefe595..69abd9fedd1e 100644 --- a/explorer/fuzzing/fuzzer_corpus/cb60914941865d53d4b71370076caf9aba457e3c +++ b/explorer/fuzzing/fuzzer_corpus/d415acd8c86e6475fe8d0c8a1d5de351a99ea967 @@ -18,7 +18,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/bb252e69bd03a67ee093549a0ee832342de45fff b/explorer/fuzzing/fuzzer_corpus/d461c6f24473e9f2bbc61bedf75fe8e87ee5ac15 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/bb252e69bd03a67ee093549a0ee832342de45fff rename to explorer/fuzzing/fuzzer_corpus/d461c6f24473e9f2bbc61bedf75fe8e87ee5ac15 index b2526761867d..8827670d9745 100644 --- a/explorer/fuzzing/fuzzer_corpus/bb252e69bd03a67ee093549a0ee832342de45fff +++ b/explorer/fuzzing/fuzzer_corpus/d461c6f24473e9f2bbc61bedf75fe8e87ee5ac15 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } type_params { fields { generic_binding { @@ -34,7 +36,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1ef8120770659fe409e559e724c2b0c2459b018e b/explorer/fuzzing/fuzzer_corpus/d47bc23011a4973b678586a56ebae479f4dd39ec similarity index 86% rename from explorer/fuzzing/fuzzer_corpus/1ef8120770659fe409e559e724c2b0c2459b018e rename to explorer/fuzzing/fuzzer_corpus/d47bc23011a4973b678586a56ebae479f4dd39ec index ffac5ddc919f..00a3922714ac 100644 --- a/explorer/fuzzing/fuzzer_corpus/1ef8120770659fe409e559e724c2b0c2459b018e +++ b/explorer/fuzzing/fuzzer_corpus/d47bc23011a4973b678586a56ebae479f4dd39ec @@ -5,19 +5,16 @@ compilation_unit { is_api: true declarations { interface { - name: "A" - self { - name: "Self" - type { - type_type_literal { - } - } + name { + name: "A" } } } declarations { alias { - name: "B" + name { + name: "B" + } target { where { base { @@ -44,7 +41,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d494ba5ee115dd8fb0ab0df4d885fba5f66205ae b/explorer/fuzzing/fuzzer_corpus/d494ba5ee115dd8fb0ab0df4d885fba5f66205ae new file mode 100644 index 000000000000..8152ae078463 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d494ba5ee115dd8fb0ab0df4d885fba5f66205ae @@ -0,0 +1,90 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "I" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + auto_pattern { + } + } + } + } + init { + where { + base { + identifier { + name: "I" + } + } + clauses { + equals { + lhs { + designator { + name: "Self" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_type_literal { + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/37152a1f5e181bd2c1fd48c3548547efa925c5a4 b/explorer/fuzzing/fuzzer_corpus/d5307d189b74cf05f358cb224cef368a67854c6b similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/37152a1f5e181bd2c1fd48c3548547efa925c5a4 rename to explorer/fuzzing/fuzzer_corpus/d5307d189b74cf05f358cb224cef368a67854c6b index 5ed75583ade6..5b0bb54fac05 100644 --- a/explorer/fuzzing/fuzzer_corpus/37152a1f5e181bd2c1fd48c3548547efa925c5a4 +++ b/explorer/fuzzing/fuzzer_corpus/d5307d189b74cf05f358cb224cef368a67854c6b @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -106,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -163,7 +166,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -204,7 +209,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -313,7 +320,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -415,7 +424,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -525,7 +536,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ac9da237068d2aed5061fef22dae673ac6741fad b/explorer/fuzzing/fuzzer_corpus/d5815e9c43a87a98252b04dfef6cbd8bf422bf11 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/ac9da237068d2aed5061fef22dae673ac6741fad rename to explorer/fuzzing/fuzzer_corpus/d5815e9c43a87a98252b04dfef6cbd8bf422bf11 index 6d8f62a166be..f82fb983f48c 100644 --- a/explorer/fuzzing/fuzzer_corpus/ac9da237068d2aed5061fef22dae673ac6741fad +++ b/explorer/fuzzing/fuzzer_corpus/d5815e9c43a87a98252b04dfef6cbd8bf422bf11 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d59a7e060c3b84f4c824a1eb73e6e8251e4d85e5 b/explorer/fuzzing/fuzzer_corpus/d59a7e060c3b84f4c824a1eb73e6e8251e4d85e5 new file mode 100644 index 000000000000..ebcda05cf425 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d59a7e060c3b84f4c824a1eb73e6e8251e4d85e5 @@ -0,0 +1,87 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + int_literal { + value: 0 + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + then_block { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 0 + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f86c44cb0614ba586e2b9e88e2ddb2e96c0dd498 b/explorer/fuzzing/fuzzer_corpus/d5ac7153cc6a2962aec5efa8d6e29766f02a14b0 similarity index 58% rename from explorer/fuzzing/fuzzer_corpus/f86c44cb0614ba586e2b9e88e2ddb2e96c0dd498 rename to explorer/fuzzing/fuzzer_corpus/d5ac7153cc6a2962aec5efa8d6e29766f02a14b0 index 019e9bfdaf2c..d98e7a34a8c9 100644 --- a/explorer/fuzzing/fuzzer_corpus/f86c44cb0614ba586e2b9e88e2ddb2e96c0dd498 +++ b/explorer/fuzzing/fuzzer_corpus/d5ac7153cc6a2962aec5efa8d6e29766f02a14b0 @@ -6,7 +6,7 @@ compilation_unit { declarations { variable { binding { - name: "x" + name: "n" type { expression_pattern { expression { @@ -18,33 +18,72 @@ compilation_unit { } initializer { int_literal { - value: 1 + value: 0 } } } } declarations { function { - name: "identity" + name { + name: "F" + } param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + assign { + lhs { + identifier { + name: "n" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_type_literal { } } } } } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } return_term { kind: Expression type { - int_type_literal { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + } + } } } } @@ -53,45 +92,7 @@ compilation_unit { return_expression_statement { expression { identifier { - name: "x" - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_expression_statement { - expression { - call { - function { - identifier { - name: "identity" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } + name: "n" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3f7bb85bd8057570d53cd4c3fe81bfd439acdd0a b/explorer/fuzzing/fuzzer_corpus/d5c05ce4b7120635d9b0ff8f66429daa96a48f3e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/3f7bb85bd8057570d53cd4c3fe81bfd439acdd0a rename to explorer/fuzzing/fuzzer_corpus/d5c05ce4b7120635d9b0ff8f66429daa96a48f3e index 2f8ad5bfeb92..6d1a44cf0f53 100644 --- a/explorer/fuzzing/fuzzer_corpus/3f7bb85bd8057570d53cd4c3fe81bfd439acdd0a +++ b/explorer/fuzzing/fuzzer_corpus/d5c05ce4b7120635d9b0ff8f66429daa96a48f3e @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "GetSetX" + name { + name: "GetSetX" + } self_pattern { addr_pattern { binding_pattern { @@ -145,6 +151,7 @@ compilation_unit { name: "x" } } + op: Plain } } statements { @@ -193,7 +200,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/8d916d744d8b0e5c6c44fde7b8f07242661756c8 b/explorer/fuzzing/fuzzer_corpus/d62514440c749d819c68b215647113bedb26deee similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/8d916d744d8b0e5c6c44fde7b8f07242661756c8 rename to explorer/fuzzing/fuzzer_corpus/d62514440c749d819c68b215647113bedb26deee index d3c3f60deadd..8133f8732f3e 100644 --- a/explorer/fuzzing/fuzzer_corpus/8d916d744d8b0e5c6c44fde7b8f07242661756c8 +++ b/explorer/fuzzing/fuzzer_corpus/d62514440c749d819c68b215647113bedb26deee @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -40,7 +42,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -126,6 +130,7 @@ compilation_unit { value: 3 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/252c00e39fd07e5f7c1d52a8a85f05fc08a2b3e3 b/explorer/fuzzing/fuzzer_corpus/d6d4e4d8991d7ed953b06bbf4f7f79332fc55262 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/252c00e39fd07e5f7c1d52a8a85f05fc08a2b3e3 rename to explorer/fuzzing/fuzzer_corpus/d6d4e4d8991d7ed953b06bbf4f7f79332fc55262 index 7361c8736350..29dec6e62258 100644 --- a/explorer/fuzzing/fuzzer_corpus/252c00e39fd07e5f7c1d52a8a85f05fc08a2b3e3 +++ b/explorer/fuzzing/fuzzer_corpus/d6d4e4d8991d7ed953b06bbf4f7f79332fc55262 @@ -6,7 +6,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/96fbcd0f93fd8fcca384eddcf91e9809bfca1798 b/explorer/fuzzing/fuzzer_corpus/d727a802b44490abfb3ce1c3794a16f0e6d763b4 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/96fbcd0f93fd8fcca384eddcf91e9809bfca1798 rename to explorer/fuzzing/fuzzer_corpus/d727a802b44490abfb3ce1c3794a16f0e6d763b4 index 4b5840f9d300..ec4abdc916c6 100644 --- a/explorer/fuzzing/fuzzer_corpus/96fbcd0f93fd8fcca384eddcf91e9809bfca1798 +++ b/explorer/fuzzing/fuzzer_corpus/d727a802b44490abfb3ce1c3794a16f0e6d763b4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d97d5c6d41a20f6716584b394e931abb9c102db7 b/explorer/fuzzing/fuzzer_corpus/d75851c53afd66d3635ec3d3fe600e5a0cff6289 similarity index 81% rename from explorer/fuzzing/fuzzer_corpus/d97d5c6d41a20f6716584b394e931abb9c102db7 rename to explorer/fuzzing/fuzzer_corpus/d75851c53afd66d3635ec3d3fe600e5a0cff6289 index 23897105ee0c..a392813cd6d3 100644 --- a/explorer/fuzzing/fuzzer_corpus/d97d5c6d41a20f6716584b394e931abb9c102db7 +++ b/explorer/fuzzing/fuzzer_corpus/d75851c53afd66d3635ec3d3fe600e5a0cff6289 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "C" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -22,10 +26,14 @@ compilation_unit { } declarations { class_declaration { - name: "B" + name { + name: "D" + } members { function { - name: "F" + name { + name: "G" + } param_pattern { } return_term { @@ -39,7 +47,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/eca8f1e67629684c432ea6c65d7d67c8d885e1ef b/explorer/fuzzing/fuzzer_corpus/d788c11b524a4b9e0ba8eff32a342f38f8fd452d similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/eca8f1e67629684c432ea6c65d7d67c8d885e1ef rename to explorer/fuzzing/fuzzer_corpus/d788c11b524a4b9e0ba8eff32a342f38f8fd452d index b464d9db9cf5..4732d9ad00e3 100644 --- a/explorer/fuzzing/fuzzer_corpus/eca8f1e67629684c432ea6c65d7d67c8d885e1ef +++ b/explorer/fuzzing/fuzzer_corpus/d788c11b524a4b9e0ba8eff32a342f38f8fd452d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "C" + name { + name: "C" + } alternatives { name: "X" signature { @@ -20,7 +22,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d796ffaed084b3712e41d12d011d75fa05747b4d b/explorer/fuzzing/fuzzer_corpus/d796ffaed084b3712e41d12d011d75fa05747b4d new file mode 100644 index 000000000000..19d660621545 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d796ffaed084b3712e41d12d011d75fa05747b4d @@ -0,0 +1,182 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "lhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 8 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "lhs" + } + } + path { + simple_member_access { + field: "Op" + object { + call { + function { + identifier { + name: "DivWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + operator { + op: Div + arguments { + identifier { + name: "lhs" + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/96fba84df7af5f15b9b893854390d1c5948f69b6 b/explorer/fuzzing/fuzzer_corpus/d80a07a449e27a4ad393b26c15db6669670d1454 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/96fba84df7af5f15b9b893854390d1c5948f69b6 rename to explorer/fuzzing/fuzzer_corpus/d80a07a449e27a4ad393b26c15db6669670d1454 index d5fc92aa3554..37272b0dff14 100644 --- a/explorer/fuzzing/fuzzer_corpus/96fba84df7af5f15b9b893854390d1c5948f69b6 +++ b/explorer/fuzzing/fuzzer_corpus/d80a07a449e27a4ad393b26c15db6669670d1454 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "HasThreeTypes" + name { + name: "HasThreeTypes" + } members { let { pattern { @@ -47,7 +49,9 @@ compilation_unit { } members { function { - name: "Make" + name { + name: "Make" + } self_pattern { binding_pattern { name: "self" @@ -88,18 +92,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -144,7 +143,9 @@ compilation_unit { } declarations { function { - name: "G" + name { + name: "G" + } deduced_parameters { name: "X" type { @@ -259,7 +260,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d8b510587401004831ef4bdef4e4c71f87366aff b/explorer/fuzzing/fuzzer_corpus/d8b510587401004831ef4bdef4e4c71f87366aff new file mode 100644 index 000000000000..659921a961ed --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d8b510587401004831ef4bdef4e4c71f87366aff @@ -0,0 +1,73 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "I" + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + auto_pattern { + } + } + } + } + init { + identifier { + name: "I" + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_type_literal { + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2728279e53d9502d0660d640ba26c615dd8ebe13 b/explorer/fuzzing/fuzzer_corpus/d921aec562270acfaa51de02327d430d5f83c90b similarity index 58% rename from explorer/fuzzing/fuzzer_corpus/2728279e53d9502d0660d640ba26c615dd8ebe13 rename to explorer/fuzzing/fuzzer_corpus/d921aec562270acfaa51de02327d430d5f83c90b index 35cbfbc21508..adf5d2edc2d2 100644 --- a/explorer/fuzzing/fuzzer_corpus/2728279e53d9502d0660d640ba26c615dd8ebe13 +++ b/explorer/fuzzing/fuzzer_corpus/d921aec562270acfaa51de02327d430d5f83c90b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -51,13 +53,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Result" - } - } - rhs { + rewrite { + member_name: "Result" + replacement { identifier { name: "A" } @@ -68,7 +66,9 @@ compilation_unit { } members { function { - name: "Op" + name { + name: "Op" + } self_pattern { binding_pattern { name: "self" @@ -145,7 +145,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -209,18 +211,135 @@ compilation_unit { } } } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 3 + } + } + op: Mul + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Mul + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 7 + } + } + } + } + } + } + } + } + } + } } } statements { return_expression_statement { expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/d9e9c12831efda83ebde3f030908faee27a4ec66 b/explorer/fuzzing/fuzzer_corpus/d9e9c12831efda83ebde3f030908faee27a4ec66 new file mode 100644 index 000000000000..ca1acd07999c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d9e9c12831efda83ebde3f030908faee27a4ec66 @@ -0,0 +1,86 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/11375e4c6780c9c8358d57a814a7100203686f0c b/explorer/fuzzing/fuzzer_corpus/da4cda66ebb9c6633a08995da35a4ee374166704 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/11375e4c6780c9c8358d57a814a7100203686f0c rename to explorer/fuzzing/fuzzer_corpus/da4cda66ebb9c6633a08995da35a4ee374166704 index b37f6cefbb91..7740a952ca1f 100644 --- a/explorer/fuzzing/fuzzer_corpus/11375e4c6780c9c8358d57a814a7100203686f0c +++ b/explorer/fuzzing/fuzzer_corpus/da4cda66ebb9c6633a08995da35a4ee374166704 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ints" + name { + name: "Ints" + } alternatives { name: "None" signature { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -146,6 +150,7 @@ compilation_unit { value: 2 } } + op: Plain } } } @@ -198,6 +203,7 @@ compilation_unit { } } } + op: Plain } } } @@ -248,6 +254,7 @@ compilation_unit { value: 0 } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/db160c03d69c93b692d6f4e2ef1c15f0bcdb7f8f b/explorer/fuzzing/fuzzer_corpus/db160c03d69c93b692d6f4e2ef1c15f0bcdb7f8f new file mode 100644 index 000000000000..3e73b33a485c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/db160c03d69c93b692d6f4e2ef1c15f0bcdb7f8f @@ -0,0 +1,852 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "A" + } + members { + function { + name { + name: "Which" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + interface { + name { + name: "X" + } + } + } + declarations { + interface { + name { + name: "Y" + } + } + } + declarations { + interface { + name { + name: "Z" + } + } + } + declarations { + match_first { + impls { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "T" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name { + name: "Which" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + impls { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "T" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name { + name: "Which" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + impls { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "T" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name { + name: "Which" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + } + impls { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "T" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name { + name: "Which" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "XYZ" + } + } + } + declarations { + class_declaration { + name { + name: "XY" + } + } + } + declarations { + class_declaration { + name { + name: "XZ" + } + } + } + declarations { + class_declaration { + name { + name: "YZ" + } + } + } + declarations { + class_declaration { + name { + name: "JustX" + } + } + } + declarations { + class_declaration { + name { + name: "JustY" + } + } + } + declarations { + class_declaration { + name { + name: "JustZ" + } + } + } + declarations { + class_declaration { + name { + name: "None" + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "XYZ" + } + } + interface { + operator { + op: BitwiseAnd + arguments { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "X" + } + } + arguments { + identifier { + name: "Y" + } + } + } + } + arguments { + identifier { + name: "Z" + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "XY" + } + } + interface { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "X" + } + } + arguments { + identifier { + name: "Y" + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "XZ" + } + } + interface { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "X" + } + } + arguments { + identifier { + name: "Z" + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "YZ" + } + } + interface { + operator { + op: BitwiseAnd + arguments { + identifier { + name: "Y" + } + } + arguments { + identifier { + name: "Z" + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "JustX" + } + } + interface { + identifier { + name: "X" + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "JustY" + } + } + interface { + identifier { + name: "Y" + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "JustZ" + } + } + interface { + identifier { + name: "Z" + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "XYZ: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "XYZ" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "XY: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "XY" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "XZ: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "XZ" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "YZ: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "YZ" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "JustX: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "JustX" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "JustY: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "JustY" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "JustZ: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "JustZ" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "None: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "None" + } + } + path { + simple_member_access { + field: "Which" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6071588463bc9095fc53d98c259915927ea9166a b/explorer/fuzzing/fuzzer_corpus/db8f1269569934ae031d1118e83408d71bb48456 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/6071588463bc9095fc53d98c259915927ea9166a rename to explorer/fuzzing/fuzzer_corpus/db8f1269569934ae031d1118e83408d71bb48456 index 0996f32a3a5c..e983f1a83802 100644 --- a/explorer/fuzzing/fuzzer_corpus/6071588463bc9095fc53d98c259915927ea9166a +++ b/explorer/fuzzing/fuzzer_corpus/db8f1269569934ae031d1118e83408d71bb48456 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -46,6 +48,7 @@ compilation_unit { value: 1 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/8056155c9fe5b6307756c0f99153233517aab8eb b/explorer/fuzzing/fuzzer_corpus/dbbeeace76678d1edfee6d889ec2c8b62ee540df similarity index 88% rename from explorer/fuzzing/fuzzer_corpus/8056155c9fe5b6307756c0f99153233517aab8eb rename to explorer/fuzzing/fuzzer_corpus/dbbeeace76678d1edfee6d889ec2c8b62ee540df index 73f8330291bc..ca7442d7b4d1 100644 --- a/explorer/fuzzing/fuzzer_corpus/8056155c9fe5b6307756c0f99153233517aab8eb +++ b/explorer/fuzzing/fuzzer_corpus/dbbeeace76678d1edfee6d889ec2c8b62ee540df @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Iface" + name { + name: "Iface" + } members { let { pattern { @@ -32,18 +34,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1655ed04f10c07abc524dfca4bbfc2f38122a665 b/explorer/fuzzing/fuzzer_corpus/dbdfda02dd7254b8f91ac01ded027ae583b1b6c9 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/1655ed04f10c07abc524dfca4bbfc2f38122a665 rename to explorer/fuzzing/fuzzer_corpus/dbdfda02dd7254b8f91ac01ded027ae583b1b6c9 index 04564d93a739..745582f8421d 100644 --- a/explorer/fuzzing/fuzzer_corpus/1655ed04f10c07abc524dfca4bbfc2f38122a665 +++ b/explorer/fuzzing/fuzzer_corpus/dbdfda02dd7254b8f91ac01ded027ae583b1b6c9 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/64c0a5d87c7b7197769a4dccd6e66beb8452b66f b/explorer/fuzzing/fuzzer_corpus/dc2bac7f337d98ff2fa2d34a46b4a7189b808004 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/64c0a5d87c7b7197769a4dccd6e66beb8452b66f rename to explorer/fuzzing/fuzzer_corpus/dc2bac7f337d98ff2fa2d34a46b4a7189b808004 index 7b3dc4d54f10..75b64acf47f9 100644 --- a/explorer/fuzzing/fuzzer_corpus/64c0a5d87c7b7197769a4dccd6e66beb8452b66f +++ b/explorer/fuzzing/fuzzer_corpus/dc2bac7f337d98ff2fa2d34a46b4a7189b808004 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -48,6 +50,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/5ac08127aa9085ff8a3891204a44030a66399644 b/explorer/fuzzing/fuzzer_corpus/dce8888e7cd22ca49874c3a06980ae13c0db0a56 similarity index 82% rename from explorer/fuzzing/fuzzer_corpus/5ac08127aa9085ff8a3891204a44030a66399644 rename to explorer/fuzzing/fuzzer_corpus/dce8888e7cd22ca49874c3a06980ae13c0db0a56 index c50e1cce397f..dcba85857182 100644 --- a/explorer/fuzzing/fuzzer_corpus/5ac08127aa9085ff8a3891204a44030a66399644 +++ b/explorer/fuzzing/fuzzer_corpus/dce8888e7cd22ca49874c3a06980ae13c0db0a56 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -39,20 +41,15 @@ compilation_unit { while_statement { condition { operator { - op: Not + op: NotEq arguments { - operator { - op: Eq - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 0 - } - } + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 0 } } } @@ -80,6 +77,7 @@ compilation_unit { } } } + op: Plain } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3a20fc1c6b51cce8138ebe64a908efb25b1af754 b/explorer/fuzzing/fuzzer_corpus/dcf3bcfe2b837b1da0c48ba297e83a091fa31056 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/3a20fc1c6b51cce8138ebe64a908efb25b1af754 rename to explorer/fuzzing/fuzzer_corpus/dcf3bcfe2b837b1da0c48ba297e83a091fa31056 index aed7512c773b..b37916f3447a 100644 --- a/explorer/fuzzing/fuzzer_corpus/3a20fc1c6b51cce8138ebe64a908efb25b1af754 +++ b/explorer/fuzzing/fuzzer_corpus/dcf3bcfe2b837b1da0c48ba297e83a091fa31056 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,21 +24,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -46,18 +47,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "Get" + name { + name: "Get" + } deduced_parameters { name: "T" type { @@ -139,7 +135,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -178,7 +176,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -205,7 +205,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/2d212c330ab39e4ad5cffeed456bae14a8385c09 b/explorer/fuzzing/fuzzer_corpus/dd85eb7cbd01eacce9f8904bb7d1894f2aa7d3b5 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/2d212c330ab39e4ad5cffeed456bae14a8385c09 rename to explorer/fuzzing/fuzzer_corpus/dd85eb7cbd01eacce9f8904bb7d1894f2aa7d3b5 index 5330b61b05c2..5f4eb1e72ea1 100644 --- a/explorer/fuzzing/fuzzer_corpus/2d212c330ab39e4ad5cffeed456bae14a8385c09 +++ b/explorer/fuzzing/fuzzer_corpus/dd85eb7cbd01eacce9f8904bb7d1894f2aa7d3b5 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -125,7 +131,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/de53043af63bcefa34668c2616de2a4bb376c7d8 b/explorer/fuzzing/fuzzer_corpus/de53043af63bcefa34668c2616de2a4bb376c7d8 new file mode 100644 index 000000000000..c0f8533d1bc5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/de53043af63bcefa34668c2616de2a4bb376c7d8 @@ -0,0 +1,220 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + type_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + operator { + op: As + arguments { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + arguments { + type_type_literal { + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 3 + } + } + fields { + int_literal { + value: 4 + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "v" + } + } + rhs { + identifier { + name: "w" + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + index { + object { + identifier { + name: "v" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b6373f76cc92fb1fe208dc91648cf91401135f24 b/explorer/fuzzing/fuzzer_corpus/debffbef624f8600943aa77137b53dde725a98a3 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b6373f76cc92fb1fe208dc91648cf91401135f24 rename to explorer/fuzzing/fuzzer_corpus/debffbef624f8600943aa77137b53dde725a98a3 index cbbe35b01a12..9017a91b689a 100644 --- a/explorer/fuzzing/fuzzer_corpus/b6373f76cc92fb1fe208dc91648cf91401135f24 +++ b/explorer/fuzzing/fuzzer_corpus/debffbef624f8600943aa77137b53dde725a98a3 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -49,18 +53,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -76,7 +75,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -176,7 +177,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -274,7 +277,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/df0ece360136f1fdd9ac662839342edbe8355ff6 b/explorer/fuzzing/fuzzer_corpus/df0ece360136f1fdd9ac662839342edbe8355ff6 new file mode 100644 index 000000000000..93451117975a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/df0ece360136f1fdd9ac662839342edbe8355ff6 @@ -0,0 +1,66 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 1 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/df174278898488f5f9baa6d603e16c74d2ba0402 b/explorer/fuzzing/fuzzer_corpus/df174278898488f5f9baa6d603e16c74d2ba0402 new file mode 100644 index 000000000000..fd4be5edc9ae --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/df174278898488f5f9baa6d603e16c74d2ba0402 @@ -0,0 +1,66 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Operations" + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/87cd7e1e68c1767a8da449686e90b23595b1718e b/explorer/fuzzing/fuzzer_corpus/df3c512238132d3e0131469f7e1026499b241ee0 similarity index 89% rename from explorer/fuzzing/fuzzer_corpus/87cd7e1e68c1767a8da449686e90b23595b1718e rename to explorer/fuzzing/fuzzer_corpus/df3c512238132d3e0131469f7e1026499b241ee0 index 5dda4ebe82c3..d50dabd0d664 100644 --- a/explorer/fuzzing/fuzzer_corpus/87cd7e1e68c1767a8da449686e90b23595b1718e +++ b/explorer/fuzzing/fuzzer_corpus/df3c512238132d3e0131469f7e1026499b241ee0 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { choice { - name: "Ints" + name { + name: "Ints" + } alternatives { name: "None" signature { @@ -20,7 +22,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f41fee5bdabd69bfb3a854d0a11040c6303d6390 b/explorer/fuzzing/fuzzer_corpus/dfa98dcc49016ec99cb77ab6dc61ea74e7a781f4 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/f41fee5bdabd69bfb3a854d0a11040c6303d6390 rename to explorer/fuzzing/fuzzer_corpus/dfa98dcc49016ec99cb77ab6dc61ea74e7a781f4 index d94a533ee9c9..c5c07a37fd1b 100644 --- a/explorer/fuzzing/fuzzer_corpus/f41fee5bdabd69bfb3a854d0a11040c6303d6390 +++ b/explorer/fuzzing/fuzzer_corpus/dfa98dcc49016ec99cb77ab6dc61ea74e7a781f4 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/3453c49a9e56c74c0a4f27ab89d926019282f8d4 b/explorer/fuzzing/fuzzer_corpus/dfd63d5f0d06c8b1c4342b746666eca91e029e33 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/3453c49a9e56c74c0a4f27ab89d926019282f8d4 rename to explorer/fuzzing/fuzzer_corpus/dfd63d5f0d06c8b1c4342b746666eca91e029e33 index 078dbb36daca..29233460e094 100644 --- a/explorer/fuzzing/fuzzer_corpus/3453c49a9e56c74c0a4f27ab89d926019282f8d4 +++ b/explorer/fuzzing/fuzzer_corpus/dfd63d5f0d06c8b1c4342b746666eca91e029e33 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Origin" + name { + name: "Origin" + } param_pattern { } return_term { @@ -49,7 +53,9 @@ compilation_unit { } members { function { - name: "GetX" + name { + name: "GetX" + } self_pattern { binding_pattern { name: "self" @@ -125,7 +131,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e272e11bff55666087eff3499d0284bbe951ec76 b/explorer/fuzzing/fuzzer_corpus/e272e11bff55666087eff3499d0284bbe951ec76 new file mode 100644 index 000000000000..880ff689114d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e272e11bff55666087eff3499d0284bbe951ec76 @@ -0,0 +1,105 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Foo" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + is_returned: false + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 0 + } + } + } + } + then_block { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e2ebf55cbc076357576ce9c6d9901ded3df34748 b/explorer/fuzzing/fuzzer_corpus/e2ebf55cbc076357576ce9c6d9901ded3df34748 new file mode 100644 index 000000000000..be29a6d17251 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e2ebf55cbc076357576ce9c6d9901ded3df34748 @@ -0,0 +1,157 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + interface { + name { + qualifiers: "N" + name: "Interface" + } + } + } + declarations { + class_declaration { + name { + qualifiers: "N" + name: "A" + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Interface" + } + } + } + } + } + } + } + declarations { + interface { + name { + qualifiers: "N" + name: "B" + } + } + } + declarations { + constraint { + name { + qualifiers: "N" + name: "C" + } + } + } + declarations { + mixin { + name { + qualifiers: "N" + name: "D" + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + choice { + name { + qualifiers: "N" + name: "E" + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "F" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Interface" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "A" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f90c2ddd0d3fd69d9b4300cd9165c33e5d948566 b/explorer/fuzzing/fuzzer_corpus/e347085328903bbd4f362337d32f45315dc3bf18 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/f90c2ddd0d3fd69d9b4300cd9165c33e5d948566 rename to explorer/fuzzing/fuzzer_corpus/e347085328903bbd4f362337d32f45315dc3bf18 index 0b23574bb03f..e0928f965203 100644 --- a/explorer/fuzzing/fuzzer_corpus/f90c2ddd0d3fd69d9b4300cd9165c33e5d948566 +++ b/explorer/fuzzing/fuzzer_corpus/e347085328903bbd4f362337d32f45315dc3bf18 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Wrap" + name { + name: "Wrap" + } members { variable { binding { @@ -37,7 +39,9 @@ compilation_unit { } declarations { function { - name: "MakeWrap" + name { + name: "MakeWrap" + } deduced_parameters { name: "T" type { @@ -143,7 +147,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -190,7 +196,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -250,6 +258,7 @@ compilation_unit { } } } + op: Plain } } } @@ -267,6 +276,7 @@ compilation_unit { value: 2 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/3852c46698bc370c1d570425b5ec4173db293008 b/explorer/fuzzing/fuzzer_corpus/e38f21d3adb5fb5eb8138b5175401a9ccfe1163d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/3852c46698bc370c1d570425b5ec4173db293008 rename to explorer/fuzzing/fuzzer_corpus/e38f21d3adb5fb5eb8138b5175401a9ccfe1163d index 53249c7e4b85..c555a187c923 100644 --- a/explorer/fuzzing/fuzzer_corpus/3852c46698bc370c1d570425b5ec4173db293008 +++ b/explorer/fuzzing/fuzzer_corpus/e38f21d3adb5fb5eb8138b5175401a9ccfe1163d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -65,6 +67,7 @@ compilation_unit { } } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/e3aac38bc36851ee5535a2bfe5bad50c6c8010cc b/explorer/fuzzing/fuzzer_corpus/e3aac38bc36851ee5535a2bfe5bad50c6c8010cc new file mode 100644 index 000000000000..a9859e182743 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e3aac38bc36851ee5535a2bfe5bad50c6c8010cc @@ -0,0 +1,111 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "F" + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + match { + expression { + identifier { + name: "n" + } + } + clauses { + pattern { + expression_pattern { + expression { + int_literal { + value: 1 + } + } + } + } + statement { + block { + statements { + return_expression_statement { + is_omitted_expression: true + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e44c7ad3b9b7415573705116168872fedd852901 b/explorer/fuzzing/fuzzer_corpus/e44c7ad3b9b7415573705116168872fedd852901 new file mode 100644 index 000000000000..bf77509a023a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e44c7ad3b9b7415573705116168872fedd852901 @@ -0,0 +1,120 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + if_expression { + condition { + operator { + op: Not + arguments { + call { + function { + simple_member_access { + field: "WrapInStruct" + object { + identifier { + name: "C" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + then_expression { + int_type_literal { + } + } + else_expression { + struct_type_literal { + fields { + name: "n" + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name { + name: "WrapInStruct" + } + param_pattern { + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + bool_literal { + value: true + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/48f9d3769404e19f8a70776360bade0822e2082c b/explorer/fuzzing/fuzzer_corpus/e53d906d2cbcf9f5093788833c5d5407a6c880de similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/48f9d3769404e19f8a70776360bade0822e2082c rename to explorer/fuzzing/fuzzer_corpus/e53d906d2cbcf9f5093788833c5d5407a6c880de index feda93d607e8..5599ae5f076b 100644 --- a/explorer/fuzzing/fuzzer_corpus/48f9d3769404e19f8a70776360bade0822e2082c +++ b/explorer/fuzzing/fuzzer_corpus/e53d906d2cbcf9f5093788833c5d5407a6c880de @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { impl { kind: InternalImpl @@ -33,7 +35,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -96,7 +100,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/d7eab37c6ce0b2262ff48564c2884b288f840248 b/explorer/fuzzing/fuzzer_corpus/e581bd5064e962288e5e78d9938def1e40feb12b similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/d7eab37c6ce0b2262ff48564c2884b288f840248 rename to explorer/fuzzing/fuzzer_corpus/e581bd5064e962288e5e78d9938def1e40feb12b index 805c9b7c366a..bf9b9a4b47c7 100644 --- a/explorer/fuzzing/fuzzer_corpus/d7eab37c6ce0b2262ff48564c2884b288f840248 +++ b/explorer/fuzzing/fuzzer_corpus/e581bd5064e962288e5e78d9938def1e40feb12b @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "Get" + name { + name: "Get" + } param_pattern { } return_term { @@ -21,13 +25,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -44,7 +41,9 @@ compilation_unit { } members { function { - name: "Get" + name { + name: "Get" + } param_pattern { } return_term { @@ -72,7 +71,9 @@ compilation_unit { } declarations { alias { - name: "AlsoA" + name { + name: "AlsoA" + } target { where { base { @@ -113,7 +114,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -174,7 +177,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/c280beb344021dafdd4023aaf841f5123d32affe b/explorer/fuzzing/fuzzer_corpus/e65523d2761eec4d8f5c67e5fcbd9115c6b09f30 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/c280beb344021dafdd4023aaf841f5123d32affe rename to explorer/fuzzing/fuzzer_corpus/e65523d2761eec4d8f5c67e5fcbd9115c6b09f30 index 346a9b72db43..de67e6c8a085 100644 --- a/explorer/fuzzing/fuzzer_corpus/c280beb344021dafdd4023aaf841f5123d32affe +++ b/explorer/fuzzing/fuzzer_corpus/e65523d2761eec4d8f5c67e5fcbd9115c6b09f30 @@ -20,7 +20,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/7ee7c9d8dfe22b4d1131fb33951f5e8ddc9edbae b/explorer/fuzzing/fuzzer_corpus/e66bff6e3838e7aa55b6061496c25d641d3da0fa similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/7ee7c9d8dfe22b4d1131fb33951f5e8ddc9edbae rename to explorer/fuzzing/fuzzer_corpus/e66bff6e3838e7aa55b6061496c25d641d3da0fa index 7ff90daa353d..77def6207fed 100644 --- a/explorer/fuzzing/fuzzer_corpus/7ee7c9d8dfe22b4d1131fb33951f5e8ddc9edbae +++ b/explorer/fuzzing/fuzzer_corpus/e66bff6e3838e7aa55b6061496c25d641d3da0fa @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/dcd78edaee92cc54a860e0c5987289c094115dce b/explorer/fuzzing/fuzzer_corpus/e6df7945d323407e61102a35e1aa2c1306f1b18a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/dcd78edaee92cc54a860e0c5987289c094115dce rename to explorer/fuzzing/fuzzer_corpus/e6df7945d323407e61102a35e1aa2c1306f1b18a index 5ea9a4a2ad11..38eed25f8f4d 100644 --- a/explorer/fuzzing/fuzzer_corpus/dcd78edaee92cc54a860e0c5987289c094115dce +++ b/explorer/fuzzing/fuzzer_corpus/e6df7945d323407e61102a35e1aa2c1306f1b18a @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -49,18 +53,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -76,7 +75,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -176,7 +177,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -265,7 +268,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f1689dd1bfb24bb68773069cd9807c7fb3e4b16e b/explorer/fuzzing/fuzzer_corpus/e6e7b6a3139f1d90ba1a04738348922221a3cca1 similarity index 93% rename from explorer/fuzzing/fuzzer_corpus/f1689dd1bfb24bb68773069cd9807c7fb3e4b16e rename to explorer/fuzzing/fuzzer_corpus/e6e7b6a3139f1d90ba1a04738348922221a3cca1 index d4bcdb9c8290..45ca787f9d1a 100644 --- a/explorer/fuzzing/fuzzer_corpus/f1689dd1bfb24bb68773069cd9807c7fb3e4b16e +++ b/explorer/fuzzing/fuzzer_corpus/e6e7b6a3139f1d90ba1a04738348922221a3cca1 @@ -5,12 +5,16 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "X" + name { + name: "X" + } } } declarations { function { - name: "Get" + name { + name: "Get" + } deduced_parameters { name: "T" type { @@ -56,7 +60,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -84,7 +90,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/5a9de2490dacb1b49e9777d71aa9f790f5b0fa6d b/explorer/fuzzing/fuzzer_corpus/e7c022b29b97c80fd7a44ffd30e554b1485e1a1b similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/5a9de2490dacb1b49e9777d71aa9f790f5b0fa6d rename to explorer/fuzzing/fuzzer_corpus/e7c022b29b97c80fd7a44ffd30e554b1485e1a1b index 759d54779549..ebc1bb5ee16d 100644 --- a/explorer/fuzzing/fuzzer_corpus/5a9de2490dacb1b49e9777d71aa9f790f5b0fa6d +++ b/explorer/fuzzing/fuzzer_corpus/e7c022b29b97c80fd7a44ffd30e554b1485e1a1b @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "BadSimpleMemberAccess" + name { + name: "BadSimpleMemberAccess" + } deduced_parameters { name: "T" type { @@ -57,7 +59,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/e82081de43e68d0d9f165e5cfb5393428d8b0418 b/explorer/fuzzing/fuzzer_corpus/e82081de43e68d0d9f165e5cfb5393428d8b0418 new file mode 100644 index 000000000000..841ebab65130 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e82081de43e68d0d9f165e5cfb5393428d8b0418 @@ -0,0 +1,76 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "A" + } + } + } + declarations { + namespace { + name { + qualifiers: "A" + name: "B" + } + } + } + declarations { + namespace { + name { + qualifiers: "A" + qualifiers: "B" + name: "C" + } + } + } + declarations { + function { + name { + qualifiers: "A" + qualifiers: "B" + qualifiers: "C" + qualifiers: "D" + qualifiers: "E" + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e856c5a9c99e1334a24dffc16142e13ed7654c1f b/explorer/fuzzing/fuzzer_corpus/e856c5a9c99e1334a24dffc16142e13ed7654c1f new file mode 100644 index 000000000000..8d909538b281 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e856c5a9c99e1334a24dffc16142e13ed7654c1f @@ -0,0 +1,304 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasAssoc" + } + members { + let { + pattern { + generic_binding { + name: "Assoc" + type { + type_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "X" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "H" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + deduced_parameters { + name: "U" + type { + where { + base { + type_type_literal { + } + } + clauses { + equals { + lhs { + designator { + name: "Self" + } + } + rhs { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + compound_member_access { + object { + identifier { + name: "T" + } + } + path { + simple_member_access { + field: "Assoc" + object { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + fields { + identifier { + name: "y" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0f507908b0596f095a37412bbaa5064665453720 b/explorer/fuzzing/fuzzer_corpus/e9196781615970e8ab047157e4e8a29c1d8a3398 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/0f507908b0596f095a37412bbaa5064665453720 rename to explorer/fuzzing/fuzzer_corpus/e9196781615970e8ab047157e4e8a29c1d8a3398 index 711cf0253382..053a1feafc02 100644 --- a/explorer/fuzzing/fuzzer_corpus/0f507908b0596f095a37412bbaa5064665453720 +++ b/explorer/fuzzing/fuzzer_corpus/e9196781615970e8ab047157e4e8a29c1d8a3398 @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "ReturnTrue" + name { + name: "ReturnTrue" + } param_pattern { } return_term { @@ -58,6 +60,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -74,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/563bee2ef50a868465e6161ebe820288f905cbb7 b/explorer/fuzzing/fuzzer_corpus/e941969dc816f1f93915ba635bb925abb88f4780 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/563bee2ef50a868465e6161ebe820288f905cbb7 rename to explorer/fuzzing/fuzzer_corpus/e941969dc816f1f93915ba635bb925abb88f4780 index cfe577cfbf46..1ba00d0bfe3a 100644 --- a/explorer/fuzzing/fuzzer_corpus/563bee2ef50a868465e6161ebe820288f905cbb7 +++ b/explorer/fuzzing/fuzzer_corpus/e941969dc816f1f93915ba635bb925abb88f4780 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Get" + name { + name: "Get" + } self_pattern { binding_pattern { name: "self" @@ -71,7 +75,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } param_pattern { fields { binding_pattern { @@ -140,7 +146,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -185,7 +193,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/e97c6a39ea33c93381c166c96e33b29658320b75 b/explorer/fuzzing/fuzzer_corpus/e97c6a39ea33c93381c166c96e33b29658320b75 new file mode 100644 index 000000000000..164dff60cda3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e97c6a39ea33c93381c166c96e33b29658320b75 @@ -0,0 +1,233 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + function { + name { + name: "OuterI32" + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "One" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "I32" + } + param_pattern { + } + return_term { + kind: Expression + type { + type_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "Five" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "I32" + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "Six" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "OuterI32" + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + call { + function { + identifier { + name: "Five" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + call { + function { + identifier { + name: "One" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + simple_member_access { + field: "Six" + object { + identifier { + name: "N" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ea58e94df8f76630fc2f841df7e3ca830751a901 b/explorer/fuzzing/fuzzer_corpus/ea58e94df8f76630fc2f841df7e3ca830751a901 new file mode 100644 index 000000000000..c54aff38f89c --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ea58e94df8f76630fc2f841df7e3ca830751a901 @@ -0,0 +1,339 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasAssoc" + } + members { + let { + pattern { + generic_binding { + name: "Assoc" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "AssocVal" + type { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "X" + } + members { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "AssocVal" + replacement { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "Assoc" + replacement { + int_type_literal { + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + simple_member_access { + field: "Assoc" + object { + identifier { + name: "T" + } + } + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } + declarations { + function { + name { + name: "G" + } + deduced_parameters { + name: "T" + type { + where { + base { + identifier { + name: "HasAssoc" + } + } + clauses { + rewrite { + member_name: "AssocVal" + replacement { + int_literal { + value: 2 + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "AssocVal" + object { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Mul + arguments { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + arguments { + call { + function { + identifier { + name: "G" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ea7caa99b1e4c98d3fdb9b2df61548bffe7127c1 b/explorer/fuzzing/fuzzer_corpus/ea7caa99b1e4c98d3fdb9b2df61548bffe7127c1 new file mode 100644 index 000000000000..f12e3d2def48 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ea7caa99b1e4c98d3fdb9b2df61548bffe7127c1 @@ -0,0 +1,269 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 0 + } + } + is_returned: false + } + } + statements { + while_statement { + condition { + operator { + op: Less + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "i" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "i" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + op: Plain + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/eaf1655f413b07c8a2e853ae104947b25ef82f10 b/explorer/fuzzing/fuzzer_corpus/eaf1655f413b07c8a2e853ae104947b25ef82f10 new file mode 100644 index 000000000000..db2ccb7ef50b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/eaf1655f413b07c8a2e853ae104947b25ef82f10 @@ -0,0 +1,405 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "value" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + members { + variable { + binding { + name: "value" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name { + name: "Foo" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "value" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "value" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "c.Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "value" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "base" + expression { + struct_literal { + fields { + name: "value" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "d.Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "cp" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*cp).Foo(): {0}" + } + } + fields { + call { + function { + simple_member_access { + field: "Foo" + object { + operator { + op: Deref + arguments { + identifier { + name: "cp" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0b574f5827b34d81e951ea5477244a2ec1d23b8c b/explorer/fuzzing/fuzzer_corpus/eb743ff30c319bedea7cf7a9f9918a24f8c17f1d similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/0b574f5827b34d81e951ea5477244a2ec1d23b8c rename to explorer/fuzzing/fuzzer_corpus/eb743ff30c319bedea7cf7a9f9918a24f8c17f1d index 87d663798b66..eda5a52ba141 100644 --- a/explorer/fuzzing/fuzzer_corpus/0b574f5827b34d81e951ea5477244a2ec1d23b8c +++ b/explorer/fuzzing/fuzzer_corpus/eb743ff30c319bedea7cf7a9f9918a24f8c17f1d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "A" + name { + name: "A" + } members { variable { binding { @@ -50,7 +52,9 @@ compilation_unit { } members { function { - name: "Convert" + name { + name: "Convert" + } self_pattern { binding_pattern { name: "self" @@ -99,7 +103,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -153,6 +159,7 @@ compilation_unit { value: 1 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/a86ec704505342465f35e215e39e69e7a4323ecd b/explorer/fuzzing/fuzzer_corpus/eb89ccf2783e67c7e981beca75ba8cea4e5d0af5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a86ec704505342465f35e215e39e69e7a4323ecd rename to explorer/fuzzing/fuzzer_corpus/eb89ccf2783e67c7e981beca75ba8cea4e5d0af5 index ff8f8322743f..752973f85645 100644 --- a/explorer/fuzzing/fuzzer_corpus/a86ec704505342465f35e215e39e69e7a4323ecd +++ b/explorer/fuzzing/fuzzer_corpus/eb89ccf2783e67c7e981beca75ba8cea4e5d0af5 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/360d030d3ed81fd7cb6b56888b0deaf8a8196773 b/explorer/fuzzing/fuzzer_corpus/eb9859dd8a2ab2a66b93655aeb5f01090a55978d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/360d030d3ed81fd7cb6b56888b0deaf8a8196773 rename to explorer/fuzzing/fuzzer_corpus/eb9859dd8a2ab2a66b93655aeb5f01090a55978d index 2950aa9891d0..c84f0d508f31 100644 --- a/explorer/fuzzing/fuzzer_corpus/360d030d3ed81fd7cb6b56888b0deaf8a8196773 +++ b/explorer/fuzzing/fuzzer_corpus/eb9859dd8a2ab2a66b93655aeb5f01090a55978d @@ -25,7 +25,9 @@ compilation_unit { } declarations { function { - name: "Foo" + name { + name: "Foo" + } param_pattern { } return_term { @@ -54,6 +56,7 @@ compilation_unit { } } } + op: Plain } } statements { @@ -82,6 +85,7 @@ compilation_unit { } } } + op: Plain } } } @@ -89,7 +93,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f3f2ce5f3ef7d5b033427003ec082ed78391df42 b/explorer/fuzzing/fuzzer_corpus/ec5312210b747b89c9dee82b8cb4e97ffd464270 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/f3f2ce5f3ef7d5b033427003ec082ed78391df42 rename to explorer/fuzzing/fuzzer_corpus/ec5312210b747b89c9dee82b8cb4e97ffd464270 index 3d93a5b4d345..d817dd85054d 100644 --- a/explorer/fuzzing/fuzzer_corpus/f3f2ce5f3ef7d5b033427003ec082ed78391df42 +++ b/explorer/fuzzing/fuzzer_corpus/ec5312210b747b89c9dee82b8cb4e97ffd464270 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -106,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -163,7 +166,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -204,7 +209,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -313,7 +320,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -415,7 +424,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -525,7 +536,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0d4c01e620d71b76277d1e1f20d4238766eb6932 b/explorer/fuzzing/fuzzer_corpus/ec5d47c039afde5b6a6fd3b293959ea2d25d4192 similarity index 72% rename from explorer/fuzzing/fuzzer_corpus/0d4c01e620d71b76277d1e1f20d4238766eb6932 rename to explorer/fuzzing/fuzzer_corpus/ec5d47c039afde5b6a6fd3b293959ea2d25d4192 index a2cd00cc9671..3a25ae5f0625 100644 --- a/explorer/fuzzing/fuzzer_corpus/0d4c01e620d71b76277d1e1f20d4238766eb6932 +++ b/explorer/fuzzing/fuzzer_corpus/ec5d47c039afde5b6a6fd3b293959ea2d25d4192 @@ -44,7 +44,9 @@ compilation_unit { } members { function { - name: "Equal" + name { + name: "Equal" + } self_pattern { binding_pattern { name: "self" @@ -145,11 +147,118 @@ compilation_unit { } } } + members { + function { + name { + name: "NotEqual" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: Or + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + arguments { + operator { + op: NotEq + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } } } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -228,13 +337,6 @@ compilation_unit { } } } - fields { - name: "y" - expression { - int_type_literal { - } - } - } } } } @@ -251,14 +353,6 @@ compilation_unit { } } } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } } } is_returned: false @@ -286,7 +380,7 @@ compilation_unit { return_expression_statement { expression { int_literal { - value: 0 + value: 1 } } } @@ -297,7 +391,7 @@ compilation_unit { return_expression_statement { expression { int_literal { - value: 1 + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/ecdf063b10b4bdc553fef70d25dea4017bd7e895 b/explorer/fuzzing/fuzzer_corpus/ecdf063b10b4bdc553fef70d25dea4017bd7e895 new file mode 100644 index 000000000000..da4e7b357779 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ecdf063b10b4bdc553fef70d25dea4017bd7e895 @@ -0,0 +1,181 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name { + name: "HasTypeAndValue" + } + members { + let { + pattern { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + members { + let { + pattern { + generic_binding { + name: "V" + type { + identifier { + name: "T" + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "F" + } + param_pattern { + fields { + generic_binding { + name: "X" + type { + where { + base { + identifier { + name: "HasTypeAndValue" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "V" + replacement { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "V" + object { + identifier { + name: "X" + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + where { + base { + identifier { + name: "HasTypeAndValue" + } + } + clauses { + rewrite { + member_name: "T" + replacement { + int_type_literal { + } + } + } + } + clauses { + rewrite { + member_name: "V" + replacement { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/7977aec11e14dce2eb0855aaaacaaded58f13cf8 b/explorer/fuzzing/fuzzer_corpus/ed5e0b7088b06b6fe1b48ecdfb94d0538e3bd0cb similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/7977aec11e14dce2eb0855aaaacaaded58f13cf8 rename to explorer/fuzzing/fuzzer_corpus/ed5e0b7088b06b6fe1b48ecdfb94d0538e3bd0cb index cd2df4e033cd..c389a0c04fa6 100644 --- a/explorer/fuzzing/fuzzer_corpus/7977aec11e14dce2eb0855aaaacaaded58f13cf8 +++ b/explorer/fuzzing/fuzzer_corpus/ed5e0b7088b06b6fe1b48ecdfb94d0538e3bd0cb @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9c7ce6b1c5f871c13530acdcf1974f63afdb2b39 b/explorer/fuzzing/fuzzer_corpus/ed78839715d8d84e515792b114f227bc6d46029f similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/9c7ce6b1c5f871c13530acdcf1974f63afdb2b39 rename to explorer/fuzzing/fuzzer_corpus/ed78839715d8d84e515792b114f227bc6d46029f index a13e5f838ac4..e3b200a14858 100644 --- a/explorer/fuzzing/fuzzer_corpus/9c7ce6b1c5f871c13530acdcf1974f63afdb2b39 +++ b/explorer/fuzzing/fuzzer_corpus/ed78839715d8d84e515792b114f227bc6d46029f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Iface" + name { + name: "Iface" + } members { let { pattern { @@ -19,18 +21,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { function { - name: "PickType" + name { + name: "PickType" + } param_pattern { fields { binding_pattern { @@ -67,7 +64,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "T" type { @@ -206,7 +205,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/46a6c270cabe7e7cc0304f28ce14e5d5e167a124 b/explorer/fuzzing/fuzzer_corpus/ee427228e0af7ff6d3f2934ea7b305d1db78add0 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/46a6c270cabe7e7cc0304f28ce14e5d5e167a124 rename to explorer/fuzzing/fuzzer_corpus/ee427228e0af7ff6d3f2934ea7b305d1db78add0 index dfeebb6a30f6..9053d3b72175 100644 --- a/explorer/fuzzing/fuzzer_corpus/46a6c270cabe7e7cc0304f28ce14e5d5e167a124 +++ b/explorer/fuzzing/fuzzer_corpus/ee427228e0af7ff6d3f2934ea7b305d1db78add0 @@ -45,7 +45,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/0423184dc010280baaf7390c4017a20f2a743102 b/explorer/fuzzing/fuzzer_corpus/eefa6e59ce3e48fb9ae9b863dc1bc41a6f387802 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/0423184dc010280baaf7390c4017a20f2a743102 rename to explorer/fuzzing/fuzzer_corpus/eefa6e59ce3e48fb9ae9b863dc1bc41a6f387802 index ba76258c1dd6..e1ac3023b6e4 100644 --- a/explorer/fuzzing/fuzzer_corpus/0423184dc010280baaf7390c4017a20f2a743102 +++ b/explorer/fuzzing/fuzzer_corpus/eefa6e59ce3e48fb9ae9b863dc1bc41a6f387802 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/ef16a6363d8fea90465cad2ae210fe5d6e60bc04 b/explorer/fuzzing/fuzzer_corpus/ef16a6363d8fea90465cad2ae210fe5d6e60bc04 new file mode 100644 index 000000000000..45250d7c814e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ef16a6363d8fea90465cad2ae210fe5d6e60bc04 @@ -0,0 +1,68 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "T" + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "T" + } + } + argument { + tuple_literal { + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/936b986e4f645072f14480f77998e983b11e920a b/explorer/fuzzing/fuzzer_corpus/ef8c4aac22a87b29cf3c77d951dcdc7be67d9f40 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/936b986e4f645072f14480f77998e983b11e920a rename to explorer/fuzzing/fuzzer_corpus/ef8c4aac22a87b29cf3c77d951dcdc7be67d9f40 index c724b42a758a..785ddecfb859 100644 --- a/explorer/fuzzing/fuzzer_corpus/936b986e4f645072f14480f77998e983b11e920a +++ b/explorer/fuzzing/fuzzer_corpus/ef8c4aac22a87b29cf3c77d951dcdc7be67d9f40 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/65e0813fa4672070f55a1031ee04056e1720eb9f b/explorer/fuzzing/fuzzer_corpus/f0301956e0abeecc69b9af9697e4edf94513011f similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/65e0813fa4672070f55a1031ee04056e1720eb9f rename to explorer/fuzzing/fuzzer_corpus/f0301956e0abeecc69b9af9697e4edf94513011f index c8d32fa44ee5..f6fc8bc41b81 100644 --- a/explorer/fuzzing/fuzzer_corpus/65e0813fa4672070f55a1031ee04056e1720eb9f +++ b/explorer/fuzzing/fuzzer_corpus/f0301956e0abeecc69b9af9697e4edf94513011f @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Id" + name { + name: "Id" + } param_pattern { fields { binding_pattern { @@ -39,7 +41,9 @@ compilation_unit { } declarations { function { - name: "f" + name { + name: "f" + } param_pattern { fields { binding_pattern { @@ -90,7 +94,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a569c5652cead3aa5c1530d56f9092645a10df89 b/explorer/fuzzing/fuzzer_corpus/f0cefd1478c7fcbc69318e8afb126d12afbed53d similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/a569c5652cead3aa5c1530d56f9092645a10df89 rename to explorer/fuzzing/fuzzer_corpus/f0cefd1478c7fcbc69318e8afb126d12afbed53d index fa829badbdfd..33e089677b3a 100644 --- a/explorer/fuzzing/fuzzer_corpus/a569c5652cead3aa5c1530d56f9092645a10df89 +++ b/explorer/fuzzing/fuzzer_corpus/f0cefd1478c7fcbc69318e8afb126d12afbed53d @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "CompareStr" + name { + name: "CompareStr" + } param_pattern { fields { binding_pattern { @@ -73,7 +75,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f13ff8011c90eaa1acd4acda1f60aab67e8a0cb3 b/explorer/fuzzing/fuzzer_corpus/f13ff8011c90eaa1acd4acda1f60aab67e8a0cb3 new file mode 100644 index 000000000000..6c29ed8de432 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f13ff8011c90eaa1acd4acda1f60aab67e8a0cb3 @@ -0,0 +1,405 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "Operations" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Point" + } + members { + function { + name { + name: "Origin" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + mix { + mixin { + identifier { + name: "Operations" + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "Complex" + } + members { + function { + name { + name: "Zero" + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Complex" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "r" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "i" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "r" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "i" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "Complex" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "r" + expression { + int_literal { + value: 42 + } + } + } + fields { + name: "i" + expression { + int_literal { + value: 1 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p1" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "c" + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p1" + } + } + } + } + arguments { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/543b04fd629b911a34fdaefbe3f7957bb2f33ee8 b/explorer/fuzzing/fuzzer_corpus/f1a704a2a6b6f6e9c6c0443beab1351d38140d29 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/543b04fd629b911a34fdaefbe3f7957bb2f33ee8 rename to explorer/fuzzing/fuzzer_corpus/f1a704a2a6b6f6e9c6c0443beab1351d38140d29 index bbb8f17fc5d0..71e9f661ce55 100644 --- a/explorer/fuzzing/fuzzer_corpus/543b04fd629b911a34fdaefbe3f7957bb2f33ee8 +++ b/explorer/fuzzing/fuzzer_corpus/f1a704a2a6b6f6e9c6c0443beab1351d38140d29 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f22caf1f5f9e7b1be271192804fcff103b6df437 b/explorer/fuzzing/fuzzer_corpus/f22caf1f5f9e7b1be271192804fcff103b6df437 new file mode 100644 index 000000000000..8fd1ee46b858 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f22caf1f5f9e7b1be271192804fcff103b6df437 @@ -0,0 +1,355 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + where { + base { + call { + function { + identifier { + name: "BitXorWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + clauses { + rewrite { + member_name: "Result" + replacement { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: BitwiseXor + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + operator { + op: BitwiseXor + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 6 + } + } + op: Xor + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: BitwiseXor + arguments { + identifier { + name: "a" + } + } + arguments { + operator { + op: Neg + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f291191731f808d4a0af70817f2790fd73a856d3 b/explorer/fuzzing/fuzzer_corpus/f291191731f808d4a0af70817f2790fd73a856d3 new file mode 100644 index 000000000000..7860ab9fc701 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f291191731f808d4a0af70817f2790fd73a856d3 @@ -0,0 +1,139 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + mixin { + name { + name: "M" + } + members { + function { + name { + name: "F" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_expression_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "F" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + initializer { + int_literal { + value: 0 + } + } + } + } + members { + mix { + mixin { + identifier { + name: "M" + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f2adb5ffa5089a7f0e1aedc0c86ca5e5dc599bd9 b/explorer/fuzzing/fuzzer_corpus/f2adb5ffa5089a7f0e1aedc0c86ca5e5dc599bd9 new file mode 100644 index 000000000000..b45c3a198794 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f2adb5ffa5089a7f0e1aedc0c86ca5e5dc599bd9 @@ -0,0 +1,361 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + identifier { + name: "Add" + } + } + members { + function { + name { + name: "Op" + } + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_expression_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 5 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 7 + } + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + op: Plain + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + identifier { + name: "b" + } + } + op: Add + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "n" + object { + operator { + op: Add + arguments { + identifier { + name: "a" + } + } + arguments { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f3454063d1455382b7560e4919d46ff7d4e8edc1 b/explorer/fuzzing/fuzzer_corpus/f3454063d1455382b7560e4919d46ff7d4e8edc1 new file mode 100644 index 000000000000..639411effecd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f3454063d1455382b7560e4919d46ff7d4e8edc1 @@ -0,0 +1,182 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "lhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 3 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "rhs" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 2 + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Interface: {0}" + } + } + fields { + call { + function { + compound_member_access { + object { + identifier { + name: "lhs" + } + } + path { + simple_member_access { + field: "Op" + object { + call { + function { + identifier { + name: "MulWith" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Op: {0}" + } + } + fields { + operator { + op: Mul + arguments { + identifier { + name: "lhs" + } + } + arguments { + identifier { + name: "rhs" + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f36e26a77634cca16475bd639220ed9f3c10bbbd b/explorer/fuzzing/fuzzer_corpus/f36e26a77634cca16475bd639220ed9f3c10bbbd new file mode 100644 index 000000000000..1b9096469e43 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f36e26a77634cca16475bd639220ed9f3c10bbbd @@ -0,0 +1,158 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "t2" + type { + expression_pattern { + expression { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + int_literal { + value: 5 + } + } + fields { + int_literal { + value: 2 + } + } + } + } + is_returned: false + } + } + statements { + assign { + lhs { + index { + object { + identifier { + name: "t2" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + rhs { + int_literal { + value: 3 + } + } + op: Plain + } + } + statements { + return_expression_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + index { + object { + identifier { + name: "t2" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + arguments { + index { + object { + identifier { + name: "t2" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + arguments { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f4442e613969488b64b568701f015baa552df409 b/explorer/fuzzing/fuzzer_corpus/f4442e613969488b64b568701f015baa552df409 new file mode 100644 index 000000000000..5cdb3a777c42 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f4442e613969488b64b568701f015baa552df409 @@ -0,0 +1,329 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + mixin { + name { + qualifiers: "N" + name: "Mixin" + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name { + qualifiers: "N" + name: "BaseClass" + } + members { + mix { + mixin { + identifier { + name: "Mixin" + } + } + } + } + } + } + declarations { + class_declaration { + name { + qualifiers: "N" + name: "DerivedClass" + } + } + } + declarations { + namespace { + name { + qualifiers: "N" + name: "Inner" + } + } + } + declarations { + alias { + name { + qualifiers: "N" + qualifiers: "Inner" + name: "InnerClass" + } + target { + identifier { + name: "DerivedClass" + } + } + } + } + declarations { + choice { + name { + qualifiers: "N" + name: "Choice" + } + alternatives { + name: "A" + signature { + } + } + alternatives { + name: "B" + signature { + } + } + alternatives { + name: "C" + signature { + fields { + identifier { + name: "DerivedClass" + } + } + } + } + } + } + declarations { + interface { + name { + qualifiers: "N" + name: "Iface" + } + members { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + operator { + op: Ptr + arguments { + identifier { + name: "DerivedClass" + } + } + } + } + } + } + } + } + } + declarations { + constraint { + name { + qualifiers: "N" + name: "Constraint" + } + members { + interface_extends { + base { + identifier { + name: "Iface" + } + } + } + } + } + } + declarations { + variable { + binding { + name: "v" + type { + expression_pattern { + expression { + simple_member_access { + field: "DerivedClass" + object { + identifier { + name: "N" + } + } + } + } + } + } + } + initializer { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + } + } + } + } + } + } + } + declarations { + function { + name { + qualifiers: "N" + name: "F" + } + deduced_parameters { + name: "T" + type { + identifier { + name: "Constraint" + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + simple_member_access { + field: "InnerClass" + object { + identifier { + name: "Inner" + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + } + } + } + } + } + is_returned: false + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + simple_member_access { + field: "Constraint" + object { + identifier { + name: "N" + } + } + } + } + members { + function { + name { + name: "F" + } + param_pattern { + } + return_term { + kind: Expression + type { + operator { + op: Ptr + arguments { + simple_member_access { + field: "DerivedClass" + object { + identifier { + name: "N" + } + } + } + } + } + } + } + body { + statements { + return_expression_statement { + expression { + operator { + op: AddressOf + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5269bae96f6771c6ae4ba67e36b7f66fda42daea b/explorer/fuzzing/fuzzer_corpus/f58bb0ee703a6ef927e40ef61ae26be39faf1110 similarity index 94% rename from explorer/fuzzing/fuzzer_corpus/5269bae96f6771c6ae4ba67e36b7f66fda42daea rename to explorer/fuzzing/fuzzer_corpus/f58bb0ee703a6ef927e40ef61ae26be39faf1110 index ee620aea603f..3d2e24a8bb2b 100644 --- a/explorer/fuzzing/fuzzer_corpus/5269bae96f6771c6ae4ba67e36b7f66fda42daea +++ b/explorer/fuzzing/fuzzer_corpus/f58bb0ee703a6ef927e40ef61ae26be39faf1110 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -30,7 +32,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f70134eee684858470cf431f3a004f847726b93d b/explorer/fuzzing/fuzzer_corpus/f70134eee684858470cf431f3a004f847726b93d new file mode 100644 index 000000000000..89697f008b57 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f70134eee684858470cf431f3a004f847726b93d @@ -0,0 +1,371 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "B" + } + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "C" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + fields { + name: "b" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + fields { + name: "c" + expression { + int_literal { + value: 3 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "pa" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "A" + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "pb" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "B" + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "pc" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "c" + } + } + } + } + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "c" + } + } + } + } + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "c" + } + } + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "a" + object { + operator { + op: Deref + arguments { + identifier { + name: "pa" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "b" + object { + operator { + op: Deref + arguments { + identifier { + name: "pb" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "{0}" + } + } + fields { + simple_member_access { + field: "c" + object { + operator { + op: Deref + arguments { + identifier { + name: "pc" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5e9b52a2890c2eb7345ebc47cbb8b893fa00123b b/explorer/fuzzing/fuzzer_corpus/f814186f2592800967681e54f9d8e5da4eda4a98 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5e9b52a2890c2eb7345ebc47cbb8b893fa00123b rename to explorer/fuzzing/fuzzer_corpus/f814186f2592800967681e54f9d8e5da4eda4a98 index 669b586afc22..d849372391bc 100644 --- a/explorer/fuzzing/fuzzer_corpus/5e9b52a2890c2eb7345ebc47cbb8b893fa00123b +++ b/explorer/fuzzing/fuzzer_corpus/f814186f2592800967681e54f9d8e5da4eda4a98 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { function { - name: "Create" + name { + name: "Create" + } param_pattern { fields { binding_pattern { @@ -122,7 +126,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1a3c5c7768ee6278315fda324c11bea9bf899b60 b/explorer/fuzzing/fuzzer_corpus/f8cec197859ce23e82507f1650cf7baadc414472 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/1a3c5c7768ee6278315fda324c11bea9bf899b60 rename to explorer/fuzzing/fuzzer_corpus/f8cec197859ce23e82507f1650cf7baadc414472 index 24b40059e627..6967c9efcf63 100644 --- a/explorer/fuzzing/fuzzer_corpus/1a3c5c7768ee6278315fda324c11bea9bf899b60 +++ b/explorer/fuzzing/fuzzer_corpus/f8cec197859ce23e82507f1650cf7baadc414472 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/9f30c25aa9b6303e94e12c457c2e126c95bbbf91 b/explorer/fuzzing/fuzzer_corpus/f8ecddd975e9df85304ed892fc3467bf3450d1a0 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/9f30c25aa9b6303e94e12c457c2e126c95bbbf91 rename to explorer/fuzzing/fuzzer_corpus/f8ecddd975e9df85304ed892fc3467bf3450d1a0 index 10a445d1d5be..cc715bbc2d1a 100644 --- a/explorer/fuzzing/fuzzer_corpus/9f30c25aa9b6303e94e12c457c2e126c95bbbf91 +++ b/explorer/fuzzing/fuzzer_corpus/f8ecddd975e9df85304ed892fc3467bf3450d1a0 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -34,21 +38,18 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { interface { - name: "B" + name { + name: "B" + } members { function { - name: "G" + name { + name: "G" + } param_pattern { fields { binding_pattern { @@ -74,18 +75,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { alias { - name: "C" + name { + name: "C" + } target { operator { op: BitwiseAnd @@ -105,7 +101,9 @@ compilation_unit { } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -121,7 +119,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } self_pattern { binding_pattern { name: "self" @@ -190,7 +190,9 @@ compilation_unit { } members { function { - name: "G" + name { + name: "G" + } param_pattern { fields { binding_pattern { @@ -253,7 +255,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f8f7da248667d0f6322e9fae98af78f87b071598 b/explorer/fuzzing/fuzzer_corpus/f8f7da248667d0f6322e9fae98af78f87b071598 new file mode 100644 index 000000000000..1359b45efea0 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f8f7da248667d0f6322e9fae98af78f87b071598 @@ -0,0 +1,272 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "C" + } + members { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name { + name: "D" + } + } + } + declarations { + function { + name { + name: "Foo" + } + param_pattern { + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_expression_statement { + expression { + simple_member_access { + field: "a" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + identifier { + name: "D" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "base" + expression { + struct_literal { + fields { + name: "a" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "C" + } + } + } + } + } + } + } + } + init { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + is_returned: false + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "(*c).a: {0}" + } + } + fields { + simple_member_access { + field: "a" + object { + operator { + op: Deref + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "Foo(&d): {0}" + } + } + fields { + call { + function { + identifier { + name: "Foo" + } + } + argument { + tuple_literal { + fields { + operator { + op: AddressOf + arguments { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4772cebda4b62425fb6127d49d3f7a980671cb69 b/explorer/fuzzing/fuzzer_corpus/f9ad0401636c2e754eeeaee44af4b89a17dd97c8 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/4772cebda4b62425fb6127d49d3f7a980671cb69 rename to explorer/fuzzing/fuzzer_corpus/f9ad0401636c2e754eeeaee44af4b89a17dd97c8 index 46ebd97957ff..ee13883a395a 100644 --- a/explorer/fuzzing/fuzzer_corpus/4772cebda4b62425fb6127d49d3f7a980671cb69 +++ b/explorer/fuzzing/fuzzer_corpus/f9ad0401636c2e754eeeaee44af4b89a17dd97c8 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/a259463d1805998765e3da5a692fdce91fdfe003 b/explorer/fuzzing/fuzzer_corpus/faea007214fb062f0b65f0b222cefaf2e56c6af5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a259463d1805998765e3da5a692fdce91fdfe003 rename to explorer/fuzzing/fuzzer_corpus/faea007214fb062f0b65f0b222cefaf2e56c6af5 index be7b6dcea59e..97caa57f34a0 100644 --- a/explorer/fuzzing/fuzzer_corpus/a259463d1805998765e3da5a692fdce91fdfe003 +++ b/explorer/fuzzing/fuzzer_corpus/faea007214fb062f0b65f0b222cefaf2e56c6af5 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -23,7 +27,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -66,7 +72,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -106,18 +114,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } members { variable { binding { @@ -190,7 +193,9 @@ compilation_unit { } members { function { - name: "Zero" + name { + name: "Zero" + } param_pattern { } return_term { @@ -231,7 +236,9 @@ compilation_unit { } members { function { - name: "Add" + name { + name: "Add" + } self_pattern { binding_pattern { name: "self" @@ -340,7 +347,9 @@ compilation_unit { } members { function { - name: "Scale" + name { + name: "Scale" + } self_pattern { binding_pattern { name: "self" @@ -440,7 +449,9 @@ compilation_unit { } declarations { function { - name: "AddAndScaleGeneric" + name { + name: "AddAndScaleGeneric" + } deduced_parameters { name: "T" type { @@ -550,7 +561,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/f47a46cc0e8b20ad71dd484d16ad295212bee057 b/explorer/fuzzing/fuzzer_corpus/fbcb1c13d98039a3f2e72bd269829405a5b5ebd2 similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/f47a46cc0e8b20ad71dd484d16ad295212bee057 rename to explorer/fuzzing/fuzzer_corpus/fbcb1c13d98039a3f2e72bd269829405a5b5ebd2 index 39751aa8efed..5cac352aff3a 100644 --- a/explorer/fuzzing/fuzzer_corpus/f47a46cc0e8b20ad71dd484d16ad295212bee057 +++ b/explorer/fuzzing/fuzzer_corpus/fbcb1c13d98039a3f2e72bd269829405a5b5ebd2 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "ReturnSecond" + name { + name: "ReturnSecond" + } param_pattern { fields { binding_pattern { @@ -56,7 +58,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/24e679a28f8b2f9b596ec21a3e963cc2a08eab17 b/explorer/fuzzing/fuzzer_corpus/fc24f01a1850c3f6c052da65c37eb3121ce3f9b1 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/24e679a28f8b2f9b596ec21a3e963cc2a08eab17 rename to explorer/fuzzing/fuzzer_corpus/fc24f01a1850c3f6c052da65c37eb3121ce3f9b1 index 041a066bc1ab..ac75082ae4c4 100644 --- a/explorer/fuzzing/fuzzer_corpus/24e679a28f8b2f9b596ec21a3e963cc2a08eab17 +++ b/explorer/fuzzing/fuzzer_corpus/fc24f01a1850c3f6c052da65c37eb3121ce3f9b1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -85,6 +87,7 @@ compilation_unit { value: 3 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/bbcd3d15193b2752f0a446bf86ac2d06dfe809f3 b/explorer/fuzzing/fuzzer_corpus/fd4bb5bb72e1b859a74ec8b7bf80141c6bfa162e similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/bbcd3d15193b2752f0a446bf86ac2d06dfe809f3 rename to explorer/fuzzing/fuzzer_corpus/fd4bb5bb72e1b859a74ec8b7bf80141c6bfa162e index 7b261fa38709..e3a91f111526 100644 --- a/explorer/fuzzing/fuzzer_corpus/bbcd3d15193b2752f0a446bf86ac2d06dfe809f3 +++ b/explorer/fuzzing/fuzzer_corpus/fd4bb5bb72e1b859a74ec8b7bf80141c6bfa162e @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/96b63cdfb911035a683add91ec945d6d8b19873e b/explorer/fuzzing/fuzzer_corpus/fe2d8dd69f81861333652f711d68b91c57e3cfaa similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/96b63cdfb911035a683add91ec945d6d8b19873e rename to explorer/fuzzing/fuzzer_corpus/fe2d8dd69f81861333652f711d68b91c57e3cfaa index cef8f903c5b1..60b215fb4bb1 100644 --- a/explorer/fuzzing/fuzzer_corpus/96b63cdfb911035a683add91ec945d6d8b19873e +++ b/explorer/fuzzing/fuzzer_corpus/fe2d8dd69f81861333652f711d68b91c57e3cfaa @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { diff --git a/explorer/fuzzing/fuzzer_corpus/1cc5cb983b344e8b6c13ccdb2f4e3d908818392a b/explorer/fuzzing/fuzzer_corpus/fe6b80415dd5bcc39d4ae70e86907dfab51f47db similarity index 70% rename from explorer/fuzzing/fuzzer_corpus/1cc5cb983b344e8b6c13ccdb2f4e3d908818392a rename to explorer/fuzzing/fuzzer_corpus/fe6b80415dd5bcc39d4ae70e86907dfab51f47db index 16eb37d98abf..b340ca3a066f 100644 --- a/explorer/fuzzing/fuzzer_corpus/1cc5cb983b344e8b6c13ccdb2f4e3d908818392a +++ b/explorer/fuzzing/fuzzer_corpus/fe6b80415dd5bcc39d4ae70e86907dfab51f47db @@ -5,19 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "DoNothing" - param_pattern { + name { + name: "Main" } - return_term { - kind: Omitted - } - body { - } - } - } - declarations { - function { - name: "Main" param_pattern { } return_term { @@ -43,36 +33,40 @@ compilation_unit { } } } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + auto_pattern { + } + } + } + } init { - int_literal { - value: 0 + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "x" + } + } + } } } is_returned: false } } - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "DoNothing" - } - } - argument { - tuple_literal { - } - } - } - } - } - } statements { return_expression_statement { expression { - identifier { - name: "x" + int_literal { + value: 0 } } } diff --git a/explorer/fuzzing/fuzzer_corpus/fe809bc6dc76afca1a64ecb2b7ec9c2656b64901 b/explorer/fuzzing/fuzzer_corpus/fe809bc6dc76afca1a64ecb2b7ec9c2656b64901 new file mode 100644 index 000000000000..b9eedeec43bd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/fe809bc6dc76afca1a64ecb2b7ec9c2656b64901 @@ -0,0 +1,194 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name { + name: "A" + } + members { + destructor { + self_pattern { + binding_pattern { + name: "self" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "Print" + } + } + argument { + tuple_literal { + fields { + string_literal { + value: "DESTRUCTOR A {0}" + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "self" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a1" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + is_returned: false + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + array_type_literal { + element_type { + identifier { + name: "A" + } + } + size { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + is_returned: false + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1b9a00fdda2a0ad1e7fa522f8910a77a9e639622 b/explorer/fuzzing/fuzzer_corpus/feeda94dab9210897b2b8179722714388c1affb1 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/1b9a00fdda2a0ad1e7fa522f8910a77a9e639622 rename to explorer/fuzzing/fuzzer_corpus/feeda94dab9210897b2b8179722714388c1affb1 index 9a28d64a8504..8f248ea6add9 100644 --- a/explorer/fuzzing/fuzzer_corpus/1b9a00fdda2a0ad1e7fa522f8910a77a9e639622 +++ b/explorer/fuzzing/fuzzer_corpus/feeda94dab9210897b2b8179722714388c1affb1 @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { interface { - name: "Vector" + name { + name: "Vector" + } members { let { pattern { @@ -19,13 +21,6 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { @@ -55,13 +50,9 @@ compilation_unit { } } clauses { - equals { - lhs { - designator { - name: "Dim" - } - } - rhs { + rewrite { + member_name: "Dim" + replacement { int_literal { value: 3 } @@ -74,7 +65,9 @@ compilation_unit { } declarations { class_declaration { - name: "Point" + name { + name: "Point" + } type_params { fields { generic_binding { @@ -99,7 +92,9 @@ compilation_unit { } declarations { function { - name: "F" + name { + name: "F" + } deduced_parameters { name: "Scalar" type { @@ -195,7 +190,9 @@ compilation_unit { } declarations { function { - name: "G" + name { + name: "G" + } deduced_parameters { name: "Scalar" type { @@ -246,7 +243,9 @@ compilation_unit { } declarations { function { - name: "H" + name { + name: "H" + } deduced_parameters { name: "V" type { @@ -332,7 +331,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false @@ -365,7 +364,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -410,7 +411,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_corpus/ff47496b2b3ab3be74aa5d310783eb4e07d8061f b/explorer/fuzzing/fuzzer_corpus/ff47496b2b3ab3be74aa5d310783eb4e07d8061f new file mode 100644 index 000000000000..c145a513f51d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ff47496b2b3ab3be74aa5d310783eb4e07d8061f @@ -0,0 +1,89 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + namespace { + name { + name: "N" + } + } + } + declarations { + alias { + name { + name: "M" + } + target { + identifier { + name: "N" + } + } + } + } + declarations { + function { + name { + qualifiers: "M" + name: "F" + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name { + name: "Main" + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "N" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_expression_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/6388555f68c7556e0200edcbf188369b18c54633 b/explorer/fuzzing/fuzzer_corpus/ff7d45f3301643f90226cfe6fe84d5df2cee7a7a similarity index 95% rename from explorer/fuzzing/fuzzer_corpus/6388555f68c7556e0200edcbf188369b18c54633 rename to explorer/fuzzing/fuzzer_corpus/ff7d45f3301643f90226cfe6fe84d5df2cee7a7a index 2f23439fb529..fb7d9fbac9ff 100644 --- a/explorer/fuzzing/fuzzer_corpus/6388555f68c7556e0200edcbf188369b18c54633 +++ b/explorer/fuzzing/fuzzer_corpus/ff7d45f3301643f90226cfe6fe84d5df2cee7a7a @@ -5,7 +5,9 @@ compilation_unit { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -28,6 +30,7 @@ compilation_unit { value: 0 } } + op: Plain } } statements { diff --git a/explorer/fuzzing/fuzzer_corpus/c32022b708f2cff85e8ab8561024ab87de026ea7 b/explorer/fuzzing/fuzzer_corpus/ff875f9fc0fdd10e6dfc1c221c7c423eba8f0e95 similarity index 92% rename from explorer/fuzzing/fuzzer_corpus/c32022b708f2cff85e8ab8561024ab87de026ea7 rename to explorer/fuzzing/fuzzer_corpus/ff875f9fc0fdd10e6dfc1c221c7c423eba8f0e95 index 14f6f8f7ca4c..92b4950b7235 100644 --- a/explorer/fuzzing/fuzzer_corpus/c32022b708f2cff85e8ab8561024ab87de026ea7 +++ b/explorer/fuzzing/fuzzer_corpus/ff875f9fc0fdd10e6dfc1c221c7c423eba8f0e95 @@ -5,10 +5,14 @@ compilation_unit { is_api: true declarations { interface { - name: "A" + name { + name: "A" + } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -20,18 +24,13 @@ compilation_unit { } } } - self { - name: "Self" - type { - type_type_literal { - } - } - } } } declarations { class_declaration { - name: "X" + name { + name: "X" + } members { impl { kind: InternalImpl @@ -47,7 +46,9 @@ compilation_unit { } members { function { - name: "F" + name { + name: "F" + } param_pattern { } return_term { @@ -76,7 +77,9 @@ compilation_unit { } declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern { } return_term { @@ -104,7 +107,7 @@ compilation_unit { } } init { - struct_type_literal { + struct_literal { } } is_returned: false diff --git a/explorer/fuzzing/fuzzer_util.cpp b/explorer/fuzzing/fuzzer_util.cpp index 0fb85c7f6bf4..e35720eb6fdb 100644 --- a/explorer/fuzzing/fuzzer_util.cpp +++ b/explorer/fuzzing/fuzzer_util.cpp @@ -64,7 +64,7 @@ auto ProtoToCarbonWithMain(const Fuzzing::CompilationUnit& compilation_unit) compilation_unit.declarations().end(), [](const Fuzzing::Declaration& decl) { return decl.kind_case() == Fuzzing::Declaration::kFunction && - decl.function().name() == "Main"; + decl.function().name().name() == "Main"; }); return Carbon::ProtoToCarbon(compilation_unit) + (has_main ? "" : EmptyMain); } diff --git a/explorer/fuzzing/fuzzer_util_test.cpp b/explorer/fuzzing/fuzzer_util_test.cpp index 1e4b40ee2fa5..8ce7d179b388 100644 --- a/explorer/fuzzing/fuzzer_util_test.cpp +++ b/explorer/fuzzing/fuzzer_util_test.cpp @@ -22,7 +22,9 @@ TEST(FuzzerUtilTest, ParseAndExecute) { is_api: true declarations { function { - name: "Main" + name { + name: "Main" + } param_pattern {} return_term { kind: Expression @@ -58,15 +60,18 @@ TEST(FuzzerUtilTest, ParseCarbonTextProtoWithUnknownField) { garbage: "value" declarations { choice { - name: "Ch" + name { + name: "Ch" + } } } })", /*allow_unknown=*/true); ASSERT_TRUE(carbon_proto.ok()); // No EqualsProto in gmock - https://github.com/google/googletest/issues/1761. - EXPECT_EQ(carbon_proto->compilation_unit().declarations(0).choice().name(), - "Ch"); + EXPECT_EQ( + carbon_proto->compilation_unit().declarations(0).choice().name().name(), + "Ch"); } } // namespace diff --git a/explorer/interpreter/builtins.cpp b/explorer/interpreter/builtins.cpp index 50e8ee7509b1..421dccb14319 100644 --- a/explorer/interpreter/builtins.cpp +++ b/explorer/interpreter/builtins.cpp @@ -12,15 +12,19 @@ namespace Carbon { void Builtins::Register(Nonnull decl) { if (const auto* interface = dyn_cast(decl)) { - static std::map* builtin_indexes = [] { - std::map builtin_indexes; + if (interface->name().is_qualified()) { + return; + } + + static std::map>* builtin_indexes = [] { + std::map> builtin_indexes; for (int index = 0; index <= static_cast(Builtin::Last); ++index) { builtin_indexes.emplace(BuiltinNames[index], index); } return new auto(std::move(builtin_indexes)); }(); - auto it = builtin_indexes->find(interface->name()); + auto it = builtin_indexes->find(interface->name().inner_name()); if (it != builtin_indexes->end()) { builtins_[it->second] = interface; } diff --git a/explorer/interpreter/resolve_names.cpp b/explorer/interpreter/resolve_names.cpp index e5a3ed07b67b..15e5407ab3f7 100644 --- a/explorer/interpreter/resolve_names.cpp +++ b/explorer/interpreter/resolve_names.cpp @@ -56,10 +56,11 @@ class NameResolver { bool allow_undeclared = false) -> ErrorOr>; - // Add the given name to enclosing_scope. + // Add the given name to enclosing_scope. Returns the scope in which the name + // was declared. auto AddExposedName(DeclaredName name, ValueNodeView value, StaticScope& enclosing_scope, bool allow_qualified_names) - -> ErrorOr; + -> ErrorOr>; // Add the names exposed by the given AST node to enclosing_scope. auto AddExposedNames(const Declaration& declaration, @@ -137,7 +138,7 @@ auto NameResolver::ResolveQualifier(DeclaredName name, auto NameResolver::AddExposedName(DeclaredName name, ValueNodeView value, StaticScope& enclosing_scope, bool allow_qualified_names) - -> ErrorOr { + -> ErrorOr> { if (name.is_qualified() && !allow_qualified_names) { return ProgramError(name.source_loc()) << "qualified declaration names are not permitted in this context"; @@ -149,8 +150,9 @@ auto NameResolver::AddExposedName(DeclaredName name, ValueNodeView value, CARBON_ASSIGN_OR_RETURN( Nonnull scope, ResolveQualifier(name, enclosing_scope, /*allow_undeclared=*/true)); - return scope->Add(name.inner_name(), value, - StaticScope::NameStatus::KnownButNotDeclared); + CARBON_RETURN_IF_ERROR(scope->Add( + name.inner_name(), value, StaticScope::NameStatus::KnownButNotDeclared)); + return scope; } auto NameResolver::AddExposedNames(const Declaration& declaration, @@ -160,18 +162,19 @@ auto NameResolver::AddExposedNames(const Declaration& declaration, switch (declaration.kind()) { case DeclarationKind::NamespaceDeclaration: { const auto& namespace_decl = cast(declaration); - CARBON_RETURN_IF_ERROR( - enclosing_scope.Add(namespace_decl.name(), &namespace_decl, - StaticScope::NameStatus::KnownButNotDeclared)); - namespace_scopes_.try_emplace(&namespace_decl, &enclosing_scope); + CARBON_ASSIGN_OR_RETURN( + Nonnull scope, + AddExposedName(namespace_decl.name(), &namespace_decl, + enclosing_scope, allow_qualified_names)); + namespace_scopes_.try_emplace(&namespace_decl, scope); break; } case DeclarationKind::InterfaceDeclaration: case DeclarationKind::ConstraintDeclaration: { const auto& iface_decl = cast(declaration); - CARBON_RETURN_IF_ERROR( - enclosing_scope.Add(iface_decl.name(), &iface_decl, - StaticScope::NameStatus::KnownButNotDeclared)); + CARBON_RETURN_IF_ERROR(AddExposedName(iface_decl.name(), &iface_decl, + enclosing_scope, + allow_qualified_names)); break; } case DeclarationKind::DestructorDeclaration: { @@ -194,23 +197,22 @@ auto NameResolver::AddExposedNames(const Declaration& declaration, } case DeclarationKind::ClassDeclaration: { const auto& class_decl = cast(declaration); - CARBON_RETURN_IF_ERROR( - enclosing_scope.Add(class_decl.name(), &class_decl, - StaticScope::NameStatus::KnownButNotDeclared)); + CARBON_RETURN_IF_ERROR(AddExposedName(class_decl.name(), &class_decl, + enclosing_scope, + allow_qualified_names)); break; } case DeclarationKind::MixinDeclaration: { const auto& mixin_decl = cast(declaration); - CARBON_RETURN_IF_ERROR( - enclosing_scope.Add(mixin_decl.name(), &mixin_decl, - StaticScope::NameStatus::KnownButNotDeclared)); + CARBON_RETURN_IF_ERROR(AddExposedName(mixin_decl.name(), &mixin_decl, + enclosing_scope, + allow_qualified_names)); break; } case DeclarationKind::ChoiceDeclaration: { const auto& choice = cast(declaration); - CARBON_RETURN_IF_ERROR( - enclosing_scope.Add(choice.name(), &choice, - StaticScope::NameStatus::KnownButNotDeclared)); + CARBON_RETURN_IF_ERROR(AddExposedName( + choice.name(), &choice, enclosing_scope, allow_qualified_names)); break; } case DeclarationKind::VariableDeclaration: { @@ -236,8 +238,8 @@ auto NameResolver::AddExposedNames(const Declaration& declaration, } case DeclarationKind::AliasDeclaration: { const auto& alias = cast(declaration); - CARBON_RETURN_IF_ERROR(enclosing_scope.Add( - alias.name(), &alias, StaticScope::NameStatus::KnownButNotDeclared)); + CARBON_RETURN_IF_ERROR(AddExposedName( + alias.name(), &alias, enclosing_scope, allow_qualified_names)); break; } case DeclarationKind::ImplDeclaration: @@ -648,18 +650,23 @@ auto NameResolver::ResolveNames(Declaration& declaration, switch (declaration.kind()) { case DeclarationKind::NamespaceDeclaration: { auto& namespace_decl = cast(declaration); - enclosing_scope.MarkUsable(namespace_decl.name()); + CARBON_ASSIGN_OR_RETURN( + Nonnull scope, + ResolveQualifier(namespace_decl.name(), enclosing_scope)); + scope->MarkUsable(namespace_decl.name().inner_name()); break; } case DeclarationKind::InterfaceDeclaration: case DeclarationKind::ConstraintDeclaration: { auto& iface = cast(declaration); - StaticScope iface_scope(&enclosing_scope); - enclosing_scope.MarkDeclared(iface.name()); + CARBON_ASSIGN_OR_RETURN(Nonnull scope, + ResolveQualifier(iface.name(), enclosing_scope)); + StaticScope iface_scope(scope); + scope->MarkDeclared(iface.name().inner_name()); if (iface.params().has_value()) { CARBON_RETURN_IF_ERROR(ResolveNames(**iface.params(), iface_scope)); } - enclosing_scope.MarkUsable(iface.name()); + scope->MarkUsable(iface.name().inner_name()); // Don't resolve names in the type of the self binding. The // ConstraintTypeDeclaration constructor already did that. CARBON_RETURN_IF_ERROR(iface_scope.Add("Self", iface.self())); @@ -729,8 +736,11 @@ auto NameResolver::ResolveNames(Declaration& declaration, } case DeclarationKind::ClassDeclaration: { auto& class_decl = cast(declaration); - StaticScope class_scope(&enclosing_scope); - enclosing_scope.MarkDeclared(class_decl.name()); + CARBON_ASSIGN_OR_RETURN( + Nonnull scope, + ResolveQualifier(class_decl.name(), enclosing_scope)); + StaticScope class_scope(scope); + scope->MarkDeclared(class_decl.name().inner_name()); if (class_decl.base_expr().has_value()) { CARBON_RETURN_IF_ERROR( ResolveNames(**class_decl.base_expr(), class_scope)); @@ -739,7 +749,7 @@ auto NameResolver::ResolveNames(Declaration& declaration, CARBON_RETURN_IF_ERROR( ResolveNames(**class_decl.type_params(), class_scope)); } - enclosing_scope.MarkUsable(class_decl.name()); + scope->MarkUsable(class_decl.name().inner_name()); CARBON_RETURN_IF_ERROR(AddExposedNames(*class_decl.self(), class_scope)); CARBON_RETURN_IF_ERROR( ResolveMemberNames(class_decl.members(), class_scope, bodies)); @@ -747,13 +757,16 @@ auto NameResolver::ResolveNames(Declaration& declaration, } case DeclarationKind::MixinDeclaration: { auto& mixin_decl = cast(declaration); - StaticScope mixin_scope(&enclosing_scope); - enclosing_scope.MarkDeclared(mixin_decl.name()); + CARBON_ASSIGN_OR_RETURN( + Nonnull scope, + ResolveQualifier(mixin_decl.name(), enclosing_scope)); + StaticScope mixin_scope(scope); + scope->MarkDeclared(mixin_decl.name().inner_name()); if (mixin_decl.params().has_value()) { CARBON_RETURN_IF_ERROR( ResolveNames(**mixin_decl.params(), mixin_scope)); } - enclosing_scope.MarkUsable(mixin_decl.name()); + scope->MarkUsable(mixin_decl.name().inner_name()); CARBON_RETURN_IF_ERROR(mixin_scope.Add("Self", mixin_decl.self())); CARBON_RETURN_IF_ERROR( ResolveMemberNames(mixin_decl.members(), mixin_scope, bodies)); @@ -766,8 +779,10 @@ auto NameResolver::ResolveNames(Declaration& declaration, } case DeclarationKind::ChoiceDeclaration: { auto& choice = cast(declaration); - StaticScope choice_scope(&enclosing_scope); - enclosing_scope.MarkDeclared(choice.name()); + CARBON_ASSIGN_OR_RETURN(Nonnull scope, + ResolveQualifier(choice.name(), enclosing_scope)); + StaticScope choice_scope(scope); + scope->MarkDeclared(choice.name().inner_name()); if (choice.type_params().has_value()) { CARBON_RETURN_IF_ERROR( ResolveNames(**choice.type_params(), choice_scope)); @@ -785,7 +800,7 @@ auto NameResolver::ResolveNames(Declaration& declaration, << "` in choice type"; } } - enclosing_scope.MarkUsable(choice.name()); + scope->MarkUsable(choice.name().inner_name()); break; } case DeclarationKind::VariableDeclaration: { @@ -821,9 +836,11 @@ auto NameResolver::ResolveNames(Declaration& declaration, case DeclarationKind::AliasDeclaration: { auto& alias = cast(declaration); - enclosing_scope.MarkDeclared(alias.name()); - CARBON_RETURN_IF_ERROR(ResolveNames(alias.target(), enclosing_scope)); - enclosing_scope.MarkUsable(alias.name()); + CARBON_ASSIGN_OR_RETURN(Nonnull scope, + ResolveQualifier(alias.name(), enclosing_scope)); + scope->MarkDeclared(alias.name().inner_name()); + CARBON_RETURN_IF_ERROR(ResolveNames(alias.target(), *scope)); + scope->MarkUsable(alias.name().inner_name()); break; } } diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index 8483364d435b..a245bb8c8eeb 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -1093,8 +1093,8 @@ auto TypeChecker::ArgumentDeduction::Deduce(Nonnull param, return handle_non_deduced_type(); } const auto& arg_class_type = cast(*arg); - if (param_class_type.declaration().name() != - arg_class_type.declaration().name()) { + if (!DeclaresSameEntity(param_class_type.declaration(), + arg_class_type.declaration())) { return handle_non_deduced_type(); } for (const auto& [ty, param_ty] : param_class_type.type_args()) { @@ -1110,8 +1110,8 @@ auto TypeChecker::ArgumentDeduction::Deduce(Nonnull param, return handle_non_deduced_type(); } const auto& arg_iface_type = cast(*arg); - if (param_iface_type.declaration().name() != - arg_iface_type.declaration().name()) { + if (!DeclaresSameEntity(param_iface_type.declaration(), + arg_iface_type.declaration())) { return handle_non_deduced_type(); } for (const auto& [ty, param_ty] : param_iface_type.args()) { @@ -1126,8 +1126,8 @@ auto TypeChecker::ArgumentDeduction::Deduce(Nonnull param, return handle_non_deduced_type(); } const auto& arg_constraint_type = cast(*arg); - if (param_constraint_type.declaration().name() != - arg_constraint_type.declaration().name()) { + if (!DeclaresSameEntity(param_constraint_type.declaration(), + arg_constraint_type.declaration())) { return handle_non_deduced_type(); } for (const auto& [ty, param_ty] : @@ -2098,7 +2098,7 @@ auto TypeChecker::MatchImpl(const InterfaceType& iface, // have worked. // TODO: Eventually, ImplScope should filter by type structure before calling // into here. - if (impl.interface->declaration().name() != iface.declaration().name()) { + if (!DeclaresSameEntity(impl.interface->declaration(), iface.declaration())) { return std::nullopt; } diff --git a/explorer/interpreter/value.cpp b/explorer/interpreter/value.cpp index 35f72b5e4f2a..686f186ca87c 100644 --- a/explorer/interpreter/value.cpp +++ b/explorer/interpreter/value.cpp @@ -810,22 +810,22 @@ auto TypeEqual(Nonnull t1, Nonnull t2, case Value::Kind::NominalClassType: { const auto& class1 = cast(*t1); const auto& class2 = cast(*t2); - return class1.declaration().name() == class2.declaration().name() && + return DeclaresSameEntity(class1.declaration(), class2.declaration()) && BindingMapEqual(class1.bindings().args(), class2.bindings().args(), equality_ctx); } case Value::Kind::InterfaceType: { const auto& iface1 = cast(*t1); const auto& iface2 = cast(*t2); - return iface1.declaration().name() == iface2.declaration().name() && + return DeclaresSameEntity(iface1.declaration(), iface2.declaration()) && BindingMapEqual(iface1.bindings().args(), iface2.bindings().args(), equality_ctx); } case Value::Kind::NamedConstraintType: { const auto& constraint1 = cast(*t1); const auto& constraint2 = cast(*t2); - return constraint1.declaration().name() == - constraint2.declaration().name() && + return DeclaresSameEntity(constraint1.declaration(), + constraint2.declaration()) && BindingMapEqual(constraint1.bindings().args(), constraint2.bindings().args(), equality_ctx); } @@ -873,8 +873,13 @@ auto TypeEqual(Nonnull t1, Nonnull t2, } return true; } - case Value::Kind::ChoiceType: - return cast(*t1).name() == cast(*t2).name(); + case Value::Kind::ChoiceType: { + const auto& choice1 = cast(*t1); + const auto& choice2 = cast(*t2); + return DeclaresSameEntity(choice1.declaration(), choice2.declaration()) && + BindingMapEqual(choice1.type_args(), choice2.type_args(), + equality_ctx); + } case Value::Kind::TupleType: case Value::Kind::TupleValue: { const auto& tup1 = cast(*t1); @@ -1023,7 +1028,7 @@ auto ValueStructurallyEqual( // The witness value is not part of determining value equality. const auto& assoc1 = cast(*v1); const auto& assoc2 = cast(*v2); - return &assoc1.constant() == &assoc2.constant() && + return DeclaresSameEntity(assoc1.constant(), assoc2.constant()) && TypeEqual(&assoc1.base(), &assoc2.base(), equality_ctx) && TypeEqual(&assoc1.interface(), &assoc2.interface(), equality_ctx); } diff --git a/explorer/interpreter/value.h b/explorer/interpreter/value.h index 7cc0c2e4b03f..662583aa0c39 100644 --- a/explorer/interpreter/value.h +++ b/explorer/interpreter/value.h @@ -380,6 +380,8 @@ class NominalClassValue : public Value { }; // An alternative constructor value. +// TODO: The representation here is inappropriate: at least the choice type +// should be identified symbolically rather than by name. class AlternativeConstructorValue : public Value { public: AlternativeConstructorValue(std::string_view alt_name, @@ -406,6 +408,8 @@ class AlternativeConstructorValue : public Value { }; // An alternative value. +// TODO: The representation here is inappropriate: at least the choice type +// should be identified symbolically rather than by name. class AlternativeValue : public Value { public: AlternativeValue(std::string_view alt_name, std::string_view choice_name, @@ -1250,7 +1254,10 @@ class ChoiceType : public Value { return f(declaration_, bindings_); } - auto name() const -> const std::string& { return declaration_->name(); } + // TODO: Remove this. + auto name() const -> std::string_view { + return declaration_->name().inner_name(); + } // Returns the parameter types of the alternative with the given name, // or nullopt if no such alternative is present. diff --git a/explorer/syntax/parser.ypp b/explorer/syntax/parser.ypp index 41bc82cc68b5..4fe77f8af2a0 100644 --- a/explorer/syntax/parser.ypp +++ b/explorer/syntax/parser.ypp @@ -1169,7 +1169,7 @@ variable_declaration: identifier COLON pattern std::nullopt); } ; -alias_declaration: ALIAS identifier EQUAL expression SEMICOLON +alias_declaration: ALIAS declared_name EQUAL expression SEMICOLON { $$ = arena->New(context.source_loc(), $2, $4); } ; // EXPERIMENTAL MIXIN FEATURE @@ -1235,25 +1235,29 @@ class_declaration_extends: { $$ = $2; } ; declaration: - NAMESPACE identifier SEMICOLON - { $$ = arena->New(context.source_loc(), $2); } + NAMESPACE declared_name SEMICOLON + { + $$ = + arena->New(context.source_loc(), std::move($2)); + } | function_declaration { $$ = $1; } | destructor_declaration { $$ = $1; } -| class_declaration_extensibility CLASS identifier type_params class_declaration_extends LEFT_CURLY_BRACE class_body RIGHT_CURLY_BRACE +| class_declaration_extensibility CLASS declared_name type_params class_declaration_extends LEFT_CURLY_BRACE class_body RIGHT_CURLY_BRACE { $$ = arena->New( - context.source_loc(), $3, + context.source_loc(), std::move($3), arena->New(context.source_loc()), $1, $4, $5, $7); } -| MIXIN identifier type_params mixin_import LEFT_CURLY_BRACE mixin_body RIGHT_CURLY_BRACE +| MIXIN declared_name type_params mixin_import LEFT_CURLY_BRACE mixin_body RIGHT_CURLY_BRACE { // EXPERIMENTAL MIXN FEATURE auto self = arena->New(context.source_loc(), "Self", $4); - $$ = arena->New(context.source_loc(), $2, $3, self, $6); + $$ = arena->New(context.source_loc(), std::move($2), $3, + self, $6); } -| CHOICE identifier type_params LEFT_CURLY_BRACE alternative_list RIGHT_CURLY_BRACE +| CHOICE declared_name type_params LEFT_CURLY_BRACE alternative_list RIGHT_CURLY_BRACE { $$ = arena->New(context.source_loc(), $2, $3, $5); } | VAR variable_declaration SEMICOLON { @@ -1270,15 +1274,15 @@ declaration: $$ = arena->New(context.source_loc(), $2, $4, ValueCategory::Let); } -| INTERFACE identifier type_params LEFT_CURLY_BRACE interface_body RIGHT_CURLY_BRACE +| INTERFACE declared_name type_params LEFT_CURLY_BRACE interface_body RIGHT_CURLY_BRACE { - $$ = arena->New(arena, context.source_loc(), $2, $3, - $5); + $$ = arena->New(arena, context.source_loc(), + std::move($2), $3, $5); } -| CONSTRAINT identifier type_params LEFT_CURLY_BRACE interface_body RIGHT_CURLY_BRACE +| CONSTRAINT declared_name type_params LEFT_CURLY_BRACE interface_body RIGHT_CURLY_BRACE { - $$ = arena->New(arena, context.source_loc(), $2, - $3, $5); + $$ = arena->New(arena, context.source_loc(), + std::move($2), $3, $5); } | impl_declaration { $$ = $1; } diff --git a/explorer/testdata/class/fail_class_named_self.carbon b/explorer/testdata/class/fail_class_named_self.carbon index 7db25800ff75..e7f5609cee90 100644 --- a/explorer/testdata/class/fail_class_named_self.carbon +++ b/explorer/testdata/class/fail_class_named_self.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; // Error: Can't use keyword `Self` as the name of a class. -// CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/class/fail_class_named_self.carbon:[[@LINE+1]]: syntax error, unexpected SELF, expecting identifier +// CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/class/fail_class_named_self.carbon:[[@LINE+1]]: syntax error, unexpected SELF, expecting identifier or LEFT_PARENTHESIS class Self { var x: i32; var y: i32; diff --git a/explorer/testdata/namespace/builtin_in_namespace.carbon b/explorer/testdata/namespace/builtin_in_namespace.carbon new file mode 100644 index 000000000000..c4fca316fb31 --- /dev/null +++ b/explorer/testdata/namespace/builtin_in_namespace.carbon @@ -0,0 +1,20 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// RUN: %{explorer-run} +// RUN: %{explorer-run-trace} +// CHECK:STDOUT: result: 2 + +package ExplorerTest api; + +namespace Namespace; + +// This does not interfere with the builtin `AddWith`, nor with the declaration +// of `F` below. +interface Namespace.AddWith {} + +fn F[T:! AddWith(i32) where .Result = i32](n: T) -> i32 { return n + 1; } + +fn Main() -> i32 { return F(1); } diff --git a/explorer/testdata/namespace/fail_missing_nested.carbon b/explorer/testdata/namespace/fail_missing_nested.carbon new file mode 100644 index 000000000000..8f590c7fd15c --- /dev/null +++ b/explorer/testdata/namespace/fail_missing_nested.carbon @@ -0,0 +1,23 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// RUN: %{not} %{explorer-run} +// RUN: %{not} %{explorer-run-trace} + +package ExplorerTest api; + +namespace A; +namespace A.B; +namespace A.B.C; +fn A.B.C. + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/namespace/fail_missing_nested.carbon:[[@LINE+1]]: name 'D' has not been declared in namespace A.B.C + D + // Don't combine with the previous line. This test is verifying that the + // diagnostic points at the right token. + .E.F() {} + +fn Main() -> i32 { + return 0; +} diff --git a/explorer/testdata/namespace/generic_parameter_scope.carbon b/explorer/testdata/namespace/generic_parameter_scope.carbon new file mode 100644 index 000000000000..ae755162a087 --- /dev/null +++ b/explorer/testdata/namespace/generic_parameter_scope.carbon @@ -0,0 +1,25 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// RUN: %{explorer-run} +// RUN: %{explorer-run-trace} +// CHECK:STDOUT: result: 0 + +package ExplorerTest api; + +// Check that even generic parameters are looked up in the namespace of an +// entity. +namespace N; + +interface N.Interface {} + +class N.A(T:! Interface) {} +interface N.B(T:! Interface) {} +constraint N.C(T:! Interface) {} +__mixin N.D(T:! Interface) {} +choice N.E(T:! Interface) {} +fn N.F[T:! Interface](a: A(T)) {} + +fn Main() -> i32 { return 0; } diff --git a/explorer/testdata/namespace/members.carbon b/explorer/testdata/namespace/members.carbon new file mode 100644 index 000000000000..1be25c2bf541 --- /dev/null +++ b/explorer/testdata/namespace/members.carbon @@ -0,0 +1,48 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// AUTOUPDATE +// RUN: %{explorer-run} +// RUN: %{explorer-run-trace} +// CHECK:STDOUT: result: 0 + +package ExplorerTest api; + +// Ensure that we can declare all different kinds of declarations as namespace +// members. +namespace N; + +__mixin N.Mixin {} + +base class N.BaseClass { + __mix Mixin; +} + +class N.DerivedClass extends BaseClass {} + +namespace N.Inner; + +alias N.Inner.InnerClass = DerivedClass; + +choice N.Choice { A, B, C(DerivedClass) } + +interface N.Iface { + fn F() -> DerivedClass*; +} + +constraint N.Constraint { + extends Iface; +} + +var v: N.DerivedClass = {.base = {}}; + +fn N.F[T:! Constraint]() { + var v: Inner.InnerClass = {.base = {}}; +} + +impl i32 as N.Constraint { + fn F() -> N.DerivedClass* { return &v; } +} + +fn Main() -> i32 { return 0; }