Просмотр исходного кода

Add support for most kinds of declarations to be declared and used as namespace members (#2575)

Support for global variables is still missing; they're a bit more tricky because they use a pattern to introduce their name.

Prior to this change, explorer heavily relied on name comparisons to determine whether two declarations declare the same entity. Some of those instances are fixed in this PR, but more remain to be fixed, and some TODOs are added for some harder-to-fix instances.
Richard Smith 3 лет назад
Родитель
Сommit
4fa71e32f5
100 измененных файлов с 15035 добавлено и 712 удалено
  1. 13 8
      common/fuzzing/carbon.proto
  2. 19 8
      common/fuzzing/proto_to_carbon.cpp
  3. 6 6
      explorer/ast/declaration.cpp
  4. 28 21
      explorer/ast/declaration.h
  5. 20 8
      explorer/fuzzing/ast_to_proto.cpp
  6. 3 1
      explorer/fuzzing/fuzzer_corpus/0058bf96eefe20ae6eaceee383c12d36907710f2
  7. 9 3
      explorer/fuzzing/fuzzer_corpus/015080d35638d6c7a6dce55192171f043955fe3e
  8. 24 22
      explorer/fuzzing/fuzzer_corpus/03527ef9005c1d05b8bf667521a324a622e81ba9
  9. 10 4
      explorer/fuzzing/fuzzer_corpus/03bc316209e9f44df5533e0b4c72641729b3f4f9
  10. 182 0
      explorer/fuzzing/fuzzer_corpus/03ca8fb6a63c2623870c2f28d0f7a64ffbfd5802
  11. 6 2
      explorer/fuzzing/fuzzer_corpus/041848ccba146125cb9038e818f54c3b495a6ad8
  12. 12 4
      explorer/fuzzing/fuzzer_corpus/0481d56f09c69f10476dc2498c39d6e7d4c24174
  13. 9 3
      explorer/fuzzing/fuzzer_corpus/049f14948dace26b462bbe7e8a8675fe701608cb
  14. 9 3
      explorer/fuzzing/fuzzer_corpus/04c215eb24bf843a80babc4e3dd313b95c4e571f
  15. 33 37
      explorer/fuzzing/fuzzer_corpus/0501aa4f45620235f062645d5ea731cb1927e39a
  16. 6 2
      explorer/fuzzing/fuzzer_corpus/0542a56192cecd529b82ed2081aa5459863f359e
  17. 3473 0
      explorer/fuzzing/fuzzer_corpus/05cc07bd9d1ef5b891c4f0df70a1463922009b5e
  18. 3 1
      explorer/fuzzing/fuzzer_corpus/05ec89686a7f7283373c8ba37135ccd9586c1881
  19. 191 0
      explorer/fuzzing/fuzzer_corpus/05f7f32cfd698141c460623934959dd1a82f7109
  20. 3 1
      explorer/fuzzing/fuzzer_corpus/075ffc3e7c80e173985255c88542930d8fed0613
  21. 18 19
      explorer/fuzzing/fuzzer_corpus/07fe6d4b29d465ce688b6dd86b0571d1dfea03dd
  22. 3 1
      explorer/fuzzing/fuzzer_corpus/081adaaf1729926b1089243ca595d1d8d2ab1fd5
  23. 148 0
      explorer/fuzzing/fuzzer_corpus/086eb5f16b73ed72781d5579cdf16dcdc4e94744
  24. 434 0
      explorer/fuzzing/fuzzer_corpus/0931a1fe829e600d14421a0fa4084d9c7176d01e
  25. 15 5
      explorer/fuzzing/fuzzer_corpus/09c98273d182befd2029eeb2d5913445abc23da3
  26. 16 13
      explorer/fuzzing/fuzzer_corpus/09ed6f05cf53cd5658b00434fbffeffff056d270
  27. 4 1
      explorer/fuzzing/fuzzer_corpus/0a8b7f9961d982a063eb5287fa1fbc7f51e881ff
  28. 6 2
      explorer/fuzzing/fuzzer_corpus/0ad8ac2a88b1144df515cc60cb824fdef6c712ef
  29. 211 0
      explorer/fuzzing/fuzzer_corpus/0b8c017e8d7d8b363cb3d80dbfa45a8f917748e9
  30. 7 2
      explorer/fuzzing/fuzzer_corpus/0c0ca21a65e25a0ed34b97458c4651e3e211fd7d
  31. 48 0
      explorer/fuzzing/fuzzer_corpus/0c1acfbf442273f3d4a3767b76a0ce511fb8e14f
  32. 3 1
      explorer/fuzzing/fuzzer_corpus/0c86ef65371750e4a8b9cee11c8e47746abbda44
  33. 30 17
      explorer/fuzzing/fuzzer_corpus/0cb069aeca3e33c5b431baf6a25016982d6f17c9
  34. 27 23
      explorer/fuzzing/fuzzer_corpus/0d35d72cddc3a6d315e59e166bde555410df6c23
  35. 32 17
      explorer/fuzzing/fuzzer_corpus/0e6b20961131825faf926e7c56b0a285dc200c45
  36. 18 19
      explorer/fuzzing/fuzzer_corpus/0e92e106654000c9dc5d0887df617586bbdf681f
  37. 13 10
      explorer/fuzzing/fuzzer_corpus/0ec693754f4cad2f847af64da34d95de62086651
  38. 142 0
      explorer/fuzzing/fuzzer_corpus/0f4a5a4583189e307590798fd6a8535df7b43481
  39. 9 3
      explorer/fuzzing/fuzzer_corpus/0f51fb075d9a0ec04bf29588ae89cbead328d51b
  40. 13 10
      explorer/fuzzing/fuzzer_corpus/0fa5dbb1cf634ded61edd83ac9aa1fb5435f2afb
  41. 70 95
      explorer/fuzzing/fuzzer_corpus/0ff1237b5ca488e8bcf62b899c96f2279dd8618a
  42. 4 1
      explorer/fuzzing/fuzzer_corpus/10b3ac55167965078be7c7e32a3b9ac35742ebab
  43. 6 2
      explorer/fuzzing/fuzzer_corpus/10bc53bafd07b8ea7cd8e5321d4720b0c46db012
  44. 24 15
      explorer/fuzzing/fuzzer_corpus/10bf4210ca99eb159f3e5e11b69ce67e4ec2e410
  45. 127 0
      explorer/fuzzing/fuzzer_corpus/1111b8be1131541ec8c3a7b9c8a2e5e2cc634ab0
  46. 3 1
      explorer/fuzzing/fuzzer_corpus/11129722dc448b2011c92f79dc750129eff3858b
  47. 512 0
      explorer/fuzzing/fuzzer_corpus/117ed6ced083ede3e318697fc56548fabe03039e
  48. 76 0
      explorer/fuzzing/fuzzer_corpus/1191f8daa134f3932d68bd24f270b2286a87560b
  49. 3 1
      explorer/fuzzing/fuzzer_corpus/119a0b3341f7032a48ccdded931a1c2fccdd6f52
  50. 6 2
      explorer/fuzzing/fuzzer_corpus/11e091578ab1fee7bb92cf00355ff51be89cf801
  51. 6 2
      explorer/fuzzing/fuzzer_corpus/123fb6fa380b035e905b35aab5af9e28b936470f
  52. 174 133
      explorer/fuzzing/fuzzer_corpus/13165465925de647ee3bd1d663a7e406b084a182
  53. 8 2
      explorer/fuzzing/fuzzer_corpus/13699d187869d480a856deeb58a9b72a42414510
  54. 92 0
      explorer/fuzzing/fuzzer_corpus/137763417c6bb89b2f19ce90364ed912e997a51e
  55. 18 13
      explorer/fuzzing/fuzzer_corpus/138b2d121b29802db4a2e37a2d563bc6ab8c5aef
  56. 6 2
      explorer/fuzzing/fuzzer_corpus/1390a7598274c8a07a7db037d164e7ba04fa084e
  57. 128 0
      explorer/fuzzing/fuzzer_corpus/13dcb5a00f09e0ec0a7fd03fb720bdad03c495f1
  58. 69 0
      explorer/fuzzing/fuzzer_corpus/15005ba56570844e2a9ab20299631f8ffedc38c6
  59. 151 0
      explorer/fuzzing/fuzzer_corpus/151b851709a6cb57bbee182c3220b59c87027ec4
  60. 26 10
      explorer/fuzzing/fuzzer_corpus/15bd86b0412443771aa00da617795aa0e5c64185
  61. 3 1
      explorer/fuzzing/fuzzer_corpus/15ce7e6d7d3131c20c8e85783a76e9405dc43ac5
  62. 27 23
      explorer/fuzzing/fuzzer_corpus/169f839edd28aed284d4b38125e1833f73edac02
  63. 414 0
      explorer/fuzzing/fuzzer_corpus/17310ae919b40b6ca070de923c138a8d75df0204
  64. 6 2
      explorer/fuzzing/fuzzer_corpus/17a00f823161d813cdcaa73fe8a860bfbfa1266c
  65. 265 0
      explorer/fuzzing/fuzzer_corpus/181b96bd90fda933ccc0f44032fc3e7ac753c091
  66. 184 0
      explorer/fuzzing/fuzzer_corpus/1820cf28f49d1ee771fc53c74743e545529b509c
  67. 12 4
      explorer/fuzzing/fuzzer_corpus/189f5602a95e12265aaf65183c1d552f0663b36c
  68. 9 3
      explorer/fuzzing/fuzzer_corpus/18e4b0c01d7c2527f3a3d682b114ec5afe7d539b
  69. 172 0
      explorer/fuzzing/fuzzer_corpus/1983eb50faba24986c9fefe94e372fb2eaa35445
  70. 361 0
      explorer/fuzzing/fuzzer_corpus/199d526c94d7b59769c7bea1306f67bdd4767fac
  71. 3955 0
      explorer/fuzzing/fuzzer_corpus/1aa8b45819d453372d67a450012c501fd74893ec
  72. 323 0
      explorer/fuzzing/fuzzer_corpus/1ac93b3166a73257d35daabe1224a4fa02b91438
  73. 3 1
      explorer/fuzzing/fuzzer_corpus/1bb31799f794a026275be18fd889f8917257b7a6
  74. 89 0
      explorer/fuzzing/fuzzer_corpus/1c15b9ff3704bb9603866c7a06a3070eb8aacc69
  75. 404 0
      explorer/fuzzing/fuzzer_corpus/1c2582d7495e080fa022962c6ed26fd62760e88e
  76. 190 0
      explorer/fuzzing/fuzzer_corpus/1c37ed06bf8776ee0d165e3ed3d8833a4cc9c760
  77. 10 4
      explorer/fuzzing/fuzzer_corpus/1c452ac633219d656ab5904d7638e5379e44a582
  78. 30 17
      explorer/fuzzing/fuzzer_corpus/1ceaf07b219a9004798ecc0856af9b0d10cce19c
  79. 18 13
      explorer/fuzzing/fuzzer_corpus/1cffd9bfbbba52a53c5f886563683d230d02ad80
  80. 16 13
      explorer/fuzzing/fuzzer_corpus/1d0d6abe9b8f6cf6eab4083ea51891c7b09b5653
  81. 62 0
      explorer/fuzzing/fuzzer_corpus/1d36375d17078164cf9329dbe7f4b539b5323f34
  82. 413 0
      explorer/fuzzing/fuzzer_corpus/1d5c57e26f96532fca3fab7cf9474049a8cd71b7
  83. 650 0
      explorer/fuzzing/fuzzer_corpus/1e15985570e0b52f0d40a19e90b53ab6c679729d
  84. 12 11
      explorer/fuzzing/fuzzer_corpus/1e43eb0a0f7b622f2ee5153aadeba3c2716c3b0a
  85. 16 13
      explorer/fuzzing/fuzzer_corpus/1e4fb57739ad776cee50880a79f29cdc6b532a58
  86. 27 8
      explorer/fuzzing/fuzzer_corpus/1ea21248974dcd55d90a60ca12e8149169a9b34c
  87. 132 0
      explorer/fuzzing/fuzzer_corpus/1eb37a662ac6fc2c01dc9b5b1317e9bdc7ce64ec
  88. 7 3
      explorer/fuzzing/fuzzer_corpus/1f137378f423a375a57448370eceee7aaac663ec
  89. 6 2
      explorer/fuzzing/fuzzer_corpus/1fb3cabbe7b1d1db38a57e533dd8047bf828a338
  90. 14 6
      explorer/fuzzing/fuzzer_corpus/1fcb05bd7ceeb20c92c134283274f611d58184be
  91. 3 1
      explorer/fuzzing/fuzzer_corpus/1ff7462970b50e872fa525ce63c82deb12e251ad
  92. 56 0
      explorer/fuzzing/fuzzer_corpus/2123f77e8516358c52163a4fa1627361f3513f30
  93. 199 0
      explorer/fuzzing/fuzzer_corpus/21df195c24c357e5a8f18f482090d95d2524e548
  94. 3 1
      explorer/fuzzing/fuzzer_corpus/226b4ae2606b0af76ab25c51d0d61f3fa3b04228
  95. 10 4
      explorer/fuzzing/fuzzer_corpus/230ea69eab009635a68f253a70e7f55d8af387bd
  96. 6 2
      explorer/fuzzing/fuzzer_corpus/2345f2c6add76c7aa04327e5aaa0840275740385
  97. 12 22
      explorer/fuzzing/fuzzer_corpus/2420c58342df0a0df9e67e3b0edaa7b45372195d
  98. 70 0
      explorer/fuzzing/fuzzer_corpus/24676dd9ecc105448196ca0eee7f8d2987ff44ab
  99. 6 2
      explorer/fuzzing/fuzzer_corpus/249efd63613bc0828f4e14afd7e607c5766554f7
  100. 75 0
      explorer/fuzzing/fuzzer_corpus/24d0079e1aa80afab58150f9dbb67c4c0e4c931b

+ 13 - 8
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 {

+ 19 - 8
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 << ";";

+ 6 - 6
explorer/ast/declaration.cpp

@@ -236,24 +236,24 @@ auto GetName(const Declaration& declaration)
     -> std::optional<std::string_view> {
   switch (declaration.kind()) {
     case DeclarationKind::NamespaceDeclaration:
-      return cast<NamespaceDeclaration>(declaration).name();
+      return cast<NamespaceDeclaration>(declaration).name().inner_name();
     case DeclarationKind::FunctionDeclaration:
       return cast<FunctionDeclaration>(declaration).name().inner_name();
     case DeclarationKind::DestructorDeclaration:
       return "destructor";
     case DeclarationKind::ClassDeclaration:
-      return cast<ClassDeclaration>(declaration).name();
+      return cast<ClassDeclaration>(declaration).name().inner_name();
     case DeclarationKind::MixinDeclaration: {
-      return cast<MixinDeclaration>(declaration).name();
+      return cast<MixinDeclaration>(declaration).name().inner_name();
     }
     case DeclarationKind::MixDeclaration: {
       return std::nullopt;
     }
     case DeclarationKind::ChoiceDeclaration:
-      return cast<ChoiceDeclaration>(declaration).name();
+      return cast<ChoiceDeclaration>(declaration).name().inner_name();
     case DeclarationKind::InterfaceDeclaration:
     case DeclarationKind::ConstraintDeclaration:
-      return cast<ConstraintTypeDeclaration>(declaration).name();
+      return cast<ConstraintTypeDeclaration>(declaration).name().inner_name();
     case DeclarationKind::VariableDeclaration:
       return cast<VariableDeclaration>(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<AliasDeclaration>(declaration).name();
+      return cast<AliasDeclaration>(declaration).name().inner_name();
     }
   }
 }

+ 28 - 21
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<SelfDeclaration*> self_decl,
                    ClassExtensibility extensibility,
                    std::optional<Nonnull<TuplePattern*>> 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<Nonnull<const TuplePattern*>> {
     return type_params_;
@@ -384,7 +390,7 @@ class ClassDeclaration : public Declaration {
   }
 
  private:
-  std::string name_;
+  DeclaredName name_;
   ClassExtensibility extensibility_;
   Nonnull<SelfDeclaration*> self_decl_;
   std::optional<Nonnull<TuplePattern*>> 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<Nonnull<TuplePattern*>> params,
                    Nonnull<GenericBinding*> self,
                    std::vector<Nonnull<Declaration*>> 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<Nonnull<const TuplePattern*>> {
     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<Nonnull<TuplePattern*>> params_;
   Nonnull<GenericBinding*> self_;
   std::vector<Nonnull<Declaration*>> 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<Nonnull<TuplePattern*>> type_params,
                     std::vector<Nonnull<AlternativeSignature*>> 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<Nonnull<const TuplePattern*>> {
     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<Nonnull<TuplePattern*>> type_params_;
   std::vector<Nonnull<AlternativeSignature*>> alternatives_;
   std::vector<NamedValue> members_;
@@ -577,7 +583,7 @@ class ConstraintTypeDeclaration : public Declaration {
   using ImplementsCarbonValueNode = void;
 
   ConstraintTypeDeclaration(AstNodeKind kind, Nonnull<Arena*> arena,
-                            SourceLocation source_loc, std::string name,
+                            SourceLocation source_loc, DeclaredName name,
                             std::optional<Nonnull<TuplePattern*>> params,
                             std::vector<Nonnull<Declaration*>> members)
       : Declaration(kind, source_loc),
@@ -586,7 +592,8 @@ class ConstraintTypeDeclaration : public Declaration {
         self_type_(arena->New<SelfDeclaration>(source_loc)),
         members_(std::move(members)) {
     // `interface X` has `Self:! X`.
-    auto* self_type_ref = arena->New<IdentifierExpression>(source_loc, name);
+    auto* self_type_ref = arena->New<IdentifierExpression>(
+        source_loc, std::string(name_.inner_name()));
     self_type_ref->set_value_node(self_type_);
     self_ = arena->New<GenericBinding>(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<Nonnull<const TuplePattern*>> {
     return params_;
   }
@@ -630,7 +637,7 @@ class ConstraintTypeDeclaration : public Declaration {
   }
 
  private:
-  std::string name_;
+  DeclaredName name_;
   std::optional<Nonnull<TuplePattern*>> params_;
   Nonnull<SelfDeclaration*> self_type_;
   Nonnull<GenericBinding*> self_;
@@ -644,7 +651,7 @@ class InterfaceDeclaration : public ConstraintTypeDeclaration {
   using ImplementsCarbonValueNode = void;
 
   InterfaceDeclaration(Nonnull<Arena*> arena, SourceLocation source_loc,
-                       std::string name,
+                       DeclaredName name,
                        std::optional<Nonnull<TuplePattern*>> params,
                        std::vector<Nonnull<Declaration*>> members)
       : ConstraintTypeDeclaration(AstNodeKind::InterfaceDeclaration, arena,
@@ -662,7 +669,7 @@ class ConstraintDeclaration : public ConstraintTypeDeclaration {
   using ImplementsCarbonValueNode = void;
 
   ConstraintDeclaration(Nonnull<Arena*> arena, SourceLocation source_loc,
-                        std::string name,
+                        DeclaredName name,
                         std::optional<Nonnull<TuplePattern*>> params,
                         std::vector<Nonnull<Declaration*>> 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<Expression*> 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<Expression*> target_;
 };
 

+ 20 - 8
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<NamespaceDeclaration>(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<FunctionDeclaration>(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<const GenericBinding*> 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<ClassDeclaration>(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<MixinDeclaration>(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<ChoiceDeclaration>(declaration);
       auto* choice_proto = declaration_proto.mutable_choice();
-      choice_proto->set_name(choice.name());
+      *choice_proto->mutable_name() = DeclaredNameToProto(choice.name());
       for (Nonnull<const AlternativeSignature*> 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<InterfaceDeclaration>(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<ConstraintDeclaration>(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<AliasDeclaration>(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;
     }

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/68023ea15a416337ba5d786883fe1ed41b65528c → 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 {

+ 9 - 3
explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7 → 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 {

+ 24 - 22
explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7 → 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 {

+ 10 - 4
explorer/fuzzing/fuzzer_corpus/7df6280ae4f28302e5e218fd59674f4df02fbf0a → 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

+ 182 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/ac6fa333cfb9a1c037b16c0e10518347826b8ff5 → 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 {

+ 12 - 4
explorer/fuzzing/fuzzer_corpus/61082aaaa73d240be4b52a732f1631e158927cc7 → 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 {

+ 9 - 3
explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7 → 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 {

+ 9 - 3
explorer/fuzzing/fuzzer_corpus/fe8dde805d96f873cd8516332298f12a6b2abe8d → 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 {

+ 33 - 37
explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2 → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/af68a57d6150cbea22c088ce53c3e3701d3e3ade → 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 {

+ 3473 - 0
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
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc → 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 {

+ 191 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec → 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 {

+ 18 - 19
explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864 → 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"
+                  }
+                }
               }
             }
           }

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764 → 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 {

+ 148 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 434 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 15 - 5
explorer/fuzzing/fuzzer_corpus/bfef4e635dfb263c727586a8beb90b3e1e7d45bc → 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 {

+ 16 - 13
explorer/fuzzing/fuzzer_corpus/a7d494461ef98c3ec480cfbe332b94c53123a2ca → 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 {

+ 4 - 1
explorer/fuzzing/fuzzer_corpus/697cc661baed8291222e8bba77abec0a4cce7c58 → 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
                     }
                   }
                 }

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/ed25edc40e183f561e6a974ca0872cdda2de08aa → 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 {

+ 211 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 7 - 2
explorer/fuzzing/fuzzer_corpus/de581b9f2fa7bb43a1c8a82607954dfe0bc7337b → 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 {

+ 48 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/9ff179586df6d1be54264c78bc0a9017463fb1cc → 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 {

+ 30 - 17
explorer/fuzzing/fuzzer_corpus/ea8c77a027e0cda36aebfc1a176ae95a1cb00186 → 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 {

+ 27 - 23
explorer/fuzzing/fuzzer_corpus/9cba43f25b464b5858b7c390a2579220e467624a → 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
                 }
               }
             }

+ 32 - 17
explorer/fuzzing/fuzzer_corpus/587f9e61674de6917f39a998a4f94e932fa3d028 → 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 {

+ 18 - 19
explorer/fuzzing/fuzzer_corpus/91e9c32f3c3bc1ea0693f919f098828ad7860e28 → 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 {

+ 13 - 10
explorer/fuzzing/fuzzer_corpus/9a788bace10906aa7b48858da3e4da9a0f25e82a → 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 {

+ 142 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 9 - 3
explorer/fuzzing/fuzzer_corpus/9a4ba2e3d195dc6c6227fe1601d3e060a6e7f6aa → 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 {

+ 13 - 10
explorer/fuzzing/fuzzer_corpus/6516cff3041ce9f5f0ae1ec62ab391c1eb83dec6 → 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 {

+ 70 - 95
explorer/fuzzing/fuzzer_corpus/6dbbed5f5a6d500b2982d7b03805df6a3e64cc17 → 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
-                    arguments {
-                      identifier {
-                        name: "x"
-                      }
-                    }
+                    op: Neg
                     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
-                    arguments {
-                      identifier {
-                        name: "x"
-                      }
-                    }
+                    op: Neg
                     arguments {
-                      operator {
-                        op: Neg
-                        arguments {
-                          int_literal {
-                            value: 1
-                          }
-                        }
+                      int_literal {
+                        value: 1
                       }
                     }
                   }

+ 4 - 1
explorer/fuzzing/fuzzer_corpus/4ab6821561a2f7b3d83236dc0248730b875b8f47 → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/f2b68d3ca95d9c203ee36b980ea1572ae843f68a → 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 {

+ 24 - 15
explorer/fuzzing/fuzzer_corpus/36a2d32d4f486e410ce1d93b17556a459902a8db → 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 {

+ 127 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332 → 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 {

+ 512 - 0
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"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 76 - 0
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 {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/8da277bd9d7da4ecca178ce131aa574384ca9dfa → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/70e3703c8486a55f2383b53c6f95a18de68228a2 → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53 → 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 {

+ 174 - 133
explorer/fuzzing/fuzzer_corpus/5e059c72b3fbba74b9c3cb7a21be19d36467f6f9 → 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,11 @@ compilation_unit {
       members {
         variable {
           binding {
-            name: "x"
+            name: "value"
             type {
               expression_pattern {
                 expression {
-                  identifier {
-                    name: "T"
+                  int_type_literal {
                   }
                 }
               }
@@ -158,15 +105,42 @@ compilation_unit {
           }
         }
       }
+    }
+  }
+  declarations {
+    class_declaration {
+      name {
+        name: "D"
+      }
       members {
-        variable {
-          binding {
-            name: "y"
-            type {
-              expression_pattern {
+        function {
+          name {
+            name: "Method1"
+          }
+          param_pattern {
+          }
+          return_term {
+            kind: Omitted
+          }
+          body {
+            statements {
+              expression_statement {
                 expression {
-                  identifier {
-                    name: "T"
+                  call {
+                    function {
+                      identifier {
+                        name: "Print"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          string_literal {
+                            value: "Class D"
+                          }
+                        }
+                      }
+                    }
                   }
                 }
               }
@@ -174,12 +148,16 @@ compilation_unit {
           }
         }
       }
-      type_params {
-        fields {
-          generic_binding {
-            name: "T"
+      members {
+        variable {
+          binding {
+            name: "value"
             type {
-              type_type_literal {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
               }
             }
           }
@@ -189,7 +167,9 @@ compilation_unit {
   }
   declarations {
     function {
-      name: "Main"
+      name {
+        name: "Main"
+      }
       param_pattern {
       }
       return_term {
@@ -204,22 +184,37 @@ 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"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            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
                           }
                         }
                       }
@@ -228,66 +223,112 @@ compilation_unit {
                 }
               }
             }
-            init {
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
               call {
                 function {
                   simple_member_access {
-                    field: "Origin"
+                    field: "Method1"
                     object {
-                      call {
-                        function {
-                          identifier {
-                            name: "Point"
-                          }
-                        }
-                        argument {
-                          tuple_literal {
-                            fields {
-                              int_type_literal {
-                              }
-                            }
-                          }
-                        }
+                      identifier {
+                        name: "d"
                       }
                     }
                   }
                 }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
                 argument {
                   tuple_literal {
                     fields {
-                      int_literal {
-                        value: 0
+                      string_literal {
+                        value: "d.value = {0}"
+                      }
+                    }
+                    fields {
+                      simple_member_access {
+                        field: "value"
+                        object {
+                          identifier {
+                            name: "d"
+                          }
+                        }
                       }
                     }
                   }
                 }
               }
             }
-            is_returned: false
           }
         }
         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: "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
+              }
+            }
+          }
+        }
       }
     }
   }

+ 8 - 2
explorer/fuzzing/fuzzer_corpus/ab0baca8dd917922d8731f935516469d456b25fc → 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 {

+ 92 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 18 - 13
explorer/fuzzing/fuzzer_corpus/ee4e747627dba6ffbd9fcb1a18a940fe04a784fb → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/65738fb410d8b27350b8ca930e01f41dad598b13 → 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 {

+ 128 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 69 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 151 - 0
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
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 26 - 10
explorer/fuzzing/fuzzer_corpus/0e4dd54cbc641eb28c41d49f2e94d185a83bb36f → 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

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/a3f77e6a8191077674a9544388f531cacefa13c2 → 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 {

+ 27 - 23
explorer/fuzzing/fuzzer_corpus/87cbb8f281ba103d85429b87dc7cfa4c131222a6 → 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 {

+ 414 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7 → 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 {

+ 265 - 0
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"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 184 - 0
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
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 12 - 4
explorer/fuzzing/fuzzer_corpus/aaa6ab93c6b3c8e212cd59f1d9fea90258723519 → 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 {

+ 9 - 3
explorer/fuzzing/fuzzer_corpus/9972e604e5e46a6ac6a5efee2be4b150116cc29c → 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 {

+ 172 - 0
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
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 361 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3955 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 323 - 0
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 {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/54f528637c5e83cd7af7cf4158eed6866dabcd8f → explorer/fuzzing/fuzzer_corpus/1bb31799f794a026275be18fd889f8917257b7a6

@@ -45,7 +45,9 @@ compilation_unit {
   }
   declarations {
     function {
-      name: "Main"
+      name {
+        name: "Main"
+      }
       param_pattern {
       }
       return_term {

+ 89 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 404 - 0
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"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 190 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 10 - 4
explorer/fuzzing/fuzzer_corpus/60cb95fa0986cc17e934a7014593f76fba70c461 → 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

+ 30 - 17
explorer/fuzzing/fuzzer_corpus/a758174457d5b22eb2a94c9cc72e4341dfa97ff0 → 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 {

+ 18 - 13
explorer/fuzzing/fuzzer_corpus/26db64985a757f7b85a8dec0687537da313e3ab9 → 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 {

+ 16 - 13
explorer/fuzzing/fuzzer_corpus/4fa346a44b96db2ad5cfe3c2ad505d893114843c → 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

+ 62 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 413 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 650 - 0
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 {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 12 - 11
explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650 → 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 {

+ 16 - 13
explorer/fuzzing/fuzzer_corpus/93a5d1b18c20f1cc6bf1a4148f2a81f5d445b945 → 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

+ 27 - 8
explorer/fuzzing/fuzzer_corpus/95a9c60ab5e4c36a851c95daf9f4ab05d231616e → 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 {

+ 132 - 0
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
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 7 - 3
explorer/fuzzing/fuzzer_corpus/63fbc98ddb2d220c7ee563f03ee6c7b32acfe59f → 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 {

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676 → 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 {

+ 14 - 6
explorer/fuzzing/fuzzer_corpus/c4f7cc23c6d83486f2901f99e48c65d815b3b919 → 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 {

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/f8e6cae2fb9e8181e18d0810a56d5b3ce20d90c3 → 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 {

+ 56 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 199 - 0
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 {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a → 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 {

+ 10 - 4
explorer/fuzzing/fuzzer_corpus/57d2c890c2c3bf9d7e028a46d7ddce6deee5c2aa → 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

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/f7610aa3d6683ac10b1072077b6b620841686e50 → 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 {

+ 12 - 22
explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811 → 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 {

+ 70 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 6 - 2
explorer/fuzzing/fuzzer_corpus/c32ff216c8c6cf3ae9ec6b42c0aac88e0f76e234 → 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 {

+ 75 - 0
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
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов