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

Regenerated fuzzer corpus with regen_corpus.py (#2008)

To pick up proto updates (field renames etc.) and new carbon source samples added to testdata.

```
$ rm explorer/fuzzing/fuzzer_corpus/*
$ explorer/fuzzing/regen_corpus.py
```
pk19604014 3 лет назад
Родитель
Сommit
4c47d87d95
100 измененных файлов с 9670 добавлено и 1242 удалено
  1. 0 83
      explorer/fuzzing/fuzzer_corpus/00a8aa40e52dba3fe5692f4454543d100ba47c7c
  2. 3 2
      explorer/fuzzing/fuzzer_corpus/0126fe3569132be0b4e285618c8fe5b63234a334
  3. 674 0
      explorer/fuzzing/fuzzer_corpus/0136dad99e8d30078c7bc3d04e0f5092cb11bba6
  4. 2 2
      explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650
  5. 176 0
      explorer/fuzzing/fuzzer_corpus/01fd407b28fe2154900e62c790943150b2c3147d
  6. 81 0
      explorer/fuzzing/fuzzer_corpus/0320fd304c1b6d244bb71809ae47b94cc10e3598
  7. 2 2
      explorer/fuzzing/fuzzer_corpus/0334411b5237b6560686cb80741953d202625403
  8. 3 2
      explorer/fuzzing/fuzzer_corpus/035e54ed2f88107e49ddd41e5972037ceb5afc72
  9. 5 3
      explorer/fuzzing/fuzzer_corpus/0365a66b097b7c504a3b78ebe1cb3ca297ad8e14
  10. 218 0
      explorer/fuzzing/fuzzer_corpus/037ed4792467ecaf7f145c6a005c433b4f3c806f
  11. 2 1
      explorer/fuzzing/fuzzer_corpus/0423184dc010280baaf7390c4017a20f2a743102
  12. 110 0
      explorer/fuzzing/fuzzer_corpus/04aca9d1fb78b349504f75dc82c5707eb66e7358
  13. 268 0
      explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7
  14. 86 0
      explorer/fuzzing/fuzzer_corpus/0512f4dcd737922dfec6eb81d4c93d1f11ad2f7c
  15. 3 3
      explorer/fuzzing/fuzzer_corpus/05acd8c5486c8c3c14cc3cd35202080730090b5c
  16. 8 5
      explorer/fuzzing/fuzzer_corpus/07281c243ec05c00152d6c076768adf1243065e6
  17. 1 1
      explorer/fuzzing/fuzzer_corpus/0853ff183c254e06433129992812989b0a83c6d1
  18. 84 0
      explorer/fuzzing/fuzzer_corpus/08b7c85df99757a3e2a21da986cc59412e5d4454
  19. 82 0
      explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676
  20. 60 0
      explorer/fuzzing/fuzzer_corpus/098d50dfd46567ec8237cccc129696c64a60a75b
  21. 609 0
      explorer/fuzzing/fuzzer_corpus/09bfdb72621215dcf457b12c78d419e390e35ff3
  22. 5 3
      explorer/fuzzing/fuzzer_corpus/0a171cb7acaed31daaaa6f8671f3664368ce831d
  23. 1 1
      explorer/fuzzing/fuzzer_corpus/0ac4e657eed8b5281248287683e3528421b1a4b6
  24. 3 2
      explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7
  25. 3 2
      explorer/fuzzing/fuzzer_corpus/0dd8c45c372707496adb50645eb89a2878a20e5a
  26. 78 0
      explorer/fuzzing/fuzzer_corpus/0e3ba8c056c66dd97f847130384042762743541f
  27. 2 2
      explorer/fuzzing/fuzzer_corpus/0ebcf9c08c4fdce3bfc657c7a6361307b3644f26
  28. 0 494
      explorer/fuzzing/fuzzer_corpus/0efb68ab631d0a132d9eb73c0af9c731ca6b3c2a
  29. 588 0
      explorer/fuzzing/fuzzer_corpus/0f2f35d69e772d1548bb252041b45d254bb1f4c8
  30. 168 0
      explorer/fuzzing/fuzzer_corpus/0f507908b0596f095a37412bbaa5064665453720
  31. 3 2
      explorer/fuzzing/fuzzer_corpus/0ff60a71d43fa4bb8b98926ecc4c3c9264ba73af
  32. 93 72
      explorer/fuzzing/fuzzer_corpus/103128bcb516ce489aaaa1532aa50bf80aeca61f
  33. 92 0
      explorer/fuzzing/fuzzer_corpus/10ebe2c0d5ba72c214e7af06a5d987c364c53165
  34. 3 2
      explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864
  35. 33 23
      explorer/fuzzing/fuzzer_corpus/11375e4c6780c9c8358d57a814a7100203686f0c
  36. 4 3
      explorer/fuzzing/fuzzer_corpus/123b2a5baad3b9975bd241845fd936e600c55aaa
  37. 1 1
      explorer/fuzzing/fuzzer_corpus/131845e36ae4393f4e18481b38d58c44b65ae696
  38. 2 1
      explorer/fuzzing/fuzzer_corpus/1655ed04f10c07abc524dfca4bbfc2f38122a665
  39. 124 0
      explorer/fuzzing/fuzzer_corpus/174240eeaa59005d7b46ff86542da6ad9b009ca4
  40. 3 3
      explorer/fuzzing/fuzzer_corpus/17a226907550562b780d15f6ff2e022f3ed880cc
  41. 3 1
      explorer/fuzzing/fuzzer_corpus/1874f41efe6cbac77f4239267d6f05f9f5e26864
  42. 121 0
      explorer/fuzzing/fuzzer_corpus/18a346283d534bc2e8ac6bd6b83f32ab1ce8840e
  43. 2 1
      explorer/fuzzing/fuzzer_corpus/18cc6fefea80deb3e21fa2b3d225b7e503660418
  44. 1 1
      explorer/fuzzing/fuzzer_corpus/18e1ca7823d8ea4621b623c8c0cf64d94a4e61ef
  45. 21 16
      explorer/fuzzing/fuzzer_corpus/1a3c5c7768ee6278315fda324c11bea9bf899b60
  46. 72 0
      explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332
  47. 197 0
      explorer/fuzzing/fuzzer_corpus/1ae261160fce034414718a326ad74b9b73ad5c85
  48. 508 0
      explorer/fuzzing/fuzzer_corpus/1b9a00fdda2a0ad1e7fa522f8910a77a9e639622
  49. 61 0
      explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a
  50. 105 78
      explorer/fuzzing/fuzzer_corpus/1c833bb7c794465474634ef5f6ee0fa9380955ca
  51. 83 0
      explorer/fuzzing/fuzzer_corpus/1cc5cb983b344e8b6c13ccdb2f4e3d908818392a
  52. 3 2
      explorer/fuzzing/fuzzer_corpus/1d9e0b21f3ae7bf7a8f19767054f3a72bc4b85a2
  53. 70 0
      explorer/fuzzing/fuzzer_corpus/1ef8120770659fe409e559e724c2b0c2459b018e
  54. 338 0
      explorer/fuzzing/fuzzer_corpus/1efd8969cb72eb3af6d06dc50d0fbddb8c1140c3
  55. 2 1
      explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc
  56. 3 1
      explorer/fuzzing/fuzzer_corpus/212b776b9eac4e8195374bb267efc816e57ca249
  57. 4 3
      explorer/fuzzing/fuzzer_corpus/2289a078ddc2d55ba7953a9fa293adc57df38d5f
  58. 188 0
      explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7
  59. 2 1
      explorer/fuzzing/fuzzer_corpus/24e679a28f8b2f9b596ec21a3e963cc2a08eab17
  60. 1 1
      explorer/fuzzing/fuzzer_corpus/252c00e39fd07e5f7c1d52a8a85f05fc08a2b3e3
  61. 152 0
      explorer/fuzzing/fuzzer_corpus/256fd58b383bf6fe89a33cdd27c4f9dd5350539e
  62. 472 0
      explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2
  63. 44 0
      explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764
  64. 65 0
      explorer/fuzzing/fuzzer_corpus/2b11b096a3168af04786e118860bff9e01e035da
  65. 323 0
      explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7
  66. 9 4
      explorer/fuzzing/fuzzer_corpus/2b837161326c7b882bbdd46eeab9e54ad90f714d
  67. 52 49
      explorer/fuzzing/fuzzer_corpus/2b883d07bdf4c2db174e4ffa42993d1ffad01815
  68. 0 218
      explorer/fuzzing/fuzzer_corpus/2baf4d05d30daedf3a9c722b678dea7297d144d5
  69. 1 1
      explorer/fuzzing/fuzzer_corpus/2c14058de399008d689923991bc195c29001efcc
  70. 439 0
      explorer/fuzzing/fuzzer_corpus/2e46c9fba5e11ccb139ac809c7c919439a5b00cf
  71. 3 3
      explorer/fuzzing/fuzzer_corpus/2ec468114a962bc61ddd735888caecb69d767a13
  72. 3 1
      explorer/fuzzing/fuzzer_corpus/2f0d66e7cdd3b7f810d91d332e5c7e3cc796fbfb
  73. 35 33
      explorer/fuzzing/fuzzer_corpus/2f88d1825e7b0e71cb625b8ab1beaecd174cd0f8
  74. 161 0
      explorer/fuzzing/fuzzer_corpus/3018f242798c2d5dce1556674891b7dc3a3c0dae
  75. 2 1
      explorer/fuzzing/fuzzer_corpus/304271293fd1fec0a8ace7f9bccc9a052bc8721c
  76. 64 62
      explorer/fuzzing/fuzzer_corpus/3044f51dca656bab9012816c75a4399873af5dbd
  77. 3 1
      explorer/fuzzing/fuzzer_corpus/307da4f675a3da88878f66b7ad5f5546c1bff202
  78. 39 35
      explorer/fuzzing/fuzzer_corpus/31e244f3fdbe46f75fb7fa775ee282e960b57c0c
  79. 129 0
      explorer/fuzzing/fuzzer_corpus/325183e04a4232e4b1cf2779ca2c7c18ab314a06
  80. 148 2
      explorer/fuzzing/fuzzer_corpus/329852da9d25572d3551a281f4fce0852ece2534
  81. 3 2
      explorer/fuzzing/fuzzer_corpus/3434928d1dc3a66f3a3f1f44b3937e864ef81f4e
  82. 69 0
      explorer/fuzzing/fuzzer_corpus/34d3923f8e4a9ceb3ff3d44e54343b1f31ecfd15
  83. 2 1
      explorer/fuzzing/fuzzer_corpus/34d42a476155fee7c60325c55cf14bbe1749c1a0
  84. 3 2
      explorer/fuzzing/fuzzer_corpus/3598b6a104a952dfc65fad1fbd8f4d14ca233647
  85. 2 1
      explorer/fuzzing/fuzzer_corpus/360d030d3ed81fd7cb6b56888b0deaf8a8196773
  86. 341 0
      explorer/fuzzing/fuzzer_corpus/36170fc5efef82cc7db909323cca1c914df5c3e8
  87. 170 0
      explorer/fuzzing/fuzzer_corpus/362694fa674b4233cb14a35dae968676dbd303d9
  88. 41 0
      explorer/fuzzing/fuzzer_corpus/373731d03672f31b356f0068a9680c6b03d87cd0
  89. 2 1
      explorer/fuzzing/fuzzer_corpus/3852c46698bc370c1d570425b5ec4173db293008
  90. 63 0
      explorer/fuzzing/fuzzer_corpus/391137139a4e8562e68024f65f38a043a493931b
  91. 2 2
      explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53
  92. 206 0
      explorer/fuzzing/fuzzer_corpus/393e58a1743cf2f0b3d90112ce1591e420209994
  93. 2 1
      explorer/fuzzing/fuzzer_corpus/39e350656615be34b022ac0a977d0c1e164e30b3
  94. 252 0
      explorer/fuzzing/fuzzer_corpus/39f118ee2121de551414b80dca0c8daa35c3b987
  95. 1 1
      explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec
  96. 227 0
      explorer/fuzzing/fuzzer_corpus/3a1da05a244c47594a645929ded6293a983044c2
  97. 267 0
      explorer/fuzzing/fuzzer_corpus/3a20fc1c6b51cce8138ebe64a908efb25b1af754
  98. 231 0
      explorer/fuzzing/fuzzer_corpus/3a474b4f07864125949f0ad5c1e9f1d2bdab5f61
  99. 48 0
      explorer/fuzzing/fuzzer_corpus/3a56c95203d25effc213b596eeb3eeb9c01682e2
  100. 126 0
      explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811

+ 0 - 83
explorer/fuzzing/fuzzer_corpus/00a8aa40e52dba3fe5692f4454543d100ba47c7c

@@ -1,83 +0,0 @@
-compilation_unit {
-  package_statement {
-    package_name: "ExplorerTest"
-  }
-  is_api: true
-  declarations {
-    function {
-      name: "Main"
-      param_pattern {
-      }
-      return_term {
-        kind: Expression
-        type {
-          int_type_literal {
-          }
-        }
-      }
-      body {
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "t"
-                type {
-                  auto_pattern {
-                  }
-                }
-              }
-            }
-            init {
-              int_literal {
-                value: 5
-              }
-            }
-          }
-        }
-        statements {
-          match {
-            expression {
-              identifier {
-                name: "t"
-              }
-            }
-            clauses {
-              pattern {
-                binding_pattern {
-                  name: "x"
-                  type {
-                    expression_pattern {
-                      expression {
-                        int_type_literal {
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                return_statement {
-                  expression {
-                    operator {
-                      op: Sub
-                      arguments {
-                        identifier {
-                          name: "x"
-                        }
-                      }
-                      arguments {
-                        int_literal {
-                          value: 5
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/4aa3e7d6d9cdb22da86938b3d65f72c90268dbfd → explorer/fuzzing/fuzzer_corpus/0126fe3569132be0b4e285618c8fe5b63234a334

@@ -113,10 +113,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "v"
@@ -146,7 +147,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 674 - 0
explorer/fuzzing/fuzzer_corpus/0136dad99e8d30078c7bc3d04e0f5092cb11bba6

@@ -0,0 +1,674 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "Vector"
+      members {
+        function {
+          name: "Add"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "b"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Self"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "Self"
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Scale"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "v"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "Self"
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    class_declaration {
+      name: "Point"
+      members {
+        variable {
+          binding {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        variable {
+          binding {
+            name: "y"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        identifier {
+          name: "Self"
+        }
+      }
+      interface {
+        identifier {
+          name: "Vector"
+        }
+      }
+      members {
+        function {
+          name: "Add"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Point"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "b"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "Point"
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  struct_literal {
+                    fields {
+                      name: "x"
+                      expression {
+                        operator {
+                          op: Add
+                          arguments {
+                            simple_member_access {
+                              field: "x"
+                              object {
+                                identifier {
+                                  name: "me"
+                                }
+                              }
+                            }
+                          }
+                          arguments {
+                            simple_member_access {
+                              field: "x"
+                              object {
+                                identifier {
+                                  name: "b"
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    fields {
+                      name: "y"
+                      expression {
+                        operator {
+                          op: Add
+                          arguments {
+                            simple_member_access {
+                              field: "y"
+                              object {
+                                identifier {
+                                  name: "me"
+                                }
+                              }
+                            }
+                          }
+                          arguments {
+                            simple_member_access {
+                              field: "y"
+                              object {
+                                identifier {
+                                  name: "b"
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Scale"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Point"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "v"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "Point"
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  struct_literal {
+                    fields {
+                      name: "x"
+                      expression {
+                        operator {
+                          op: Mul
+                          arguments {
+                            simple_member_access {
+                              field: "x"
+                              object {
+                                identifier {
+                                  name: "me"
+                                }
+                              }
+                            }
+                          }
+                          arguments {
+                            identifier {
+                              name: "v"
+                            }
+                          }
+                        }
+                      }
+                    }
+                    fields {
+                      name: "y"
+                      expression {
+                        operator {
+                          op: Mul
+                          arguments {
+                            simple_member_access {
+                              field: "y"
+                              object {
+                                identifier {
+                                  name: "me"
+                                }
+                              }
+                            }
+                          }
+                          arguments {
+                            identifier {
+                              name: "v"
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "AddAndScaleGeneric"
+      deduced_parameters {
+        name: "T"
+        type {
+          identifier {
+            name: "Vector"
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "a"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "b"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "s"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          identifier {
+            name: "T"
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "m"
+                type {
+                  auto_pattern {
+                  }
+                }
+              }
+            }
+            init {
+              simple_member_access {
+                field: "Add"
+                object {
+                  identifier {
+                    name: "a"
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "n"
+                type {
+                  auto_pattern {
+                  }
+                }
+              }
+            }
+            init {
+              simple_member_access {
+                field: "Scale"
+                object {
+                  call {
+                    function {
+                      identifier {
+                        name: "m"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          identifier {
+                            name: "b"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "n"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "s"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "a"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_literal {
+                fields {
+                  name: "x"
+                  expression {
+                    int_literal {
+                      value: 1
+                    }
+                  }
+                }
+                fields {
+                  name: "y"
+                  expression {
+                    int_literal {
+                      value: 4
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "b"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_literal {
+                fields {
+                  name: "x"
+                  expression {
+                    int_literal {
+                      value: 2
+                    }
+                  }
+                }
+                fields {
+                  name: "y"
+                  expression {
+                    int_literal {
+                      value: 3
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "p"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              call {
+                function {
+                  identifier {
+                    name: "AddAndScaleGeneric"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "a"
+                      }
+                    }
+                    fields {
+                      identifier {
+                        name: "b"
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 5
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Sub
+                arguments {
+                  simple_member_access {
+                    field: "x"
+                    object {
+                      identifier {
+                        name: "p"
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 15
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 2
explorer/fuzzing/fuzzer_corpus/78d204668abeb3bc386d8859c400e2cbba3d0e9e → explorer/fuzzing/fuzzer_corpus/0186891e2e6abcece4f5de8304e92fb57cbf8650

@@ -56,7 +56,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   int_literal {
                     value: 0
@@ -83,7 +83,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 176 - 0
explorer/fuzzing/fuzzer_corpus/01fd407b28fe2154900e62c790943150b2c3147d

@@ -0,0 +1,176 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "ar"
+                type {
+                  expression_pattern {
+                    expression {
+                      array_type_literal {
+                        element_type {
+                          int_type_literal {
+                          }
+                        }
+                        size {
+                          int_literal {
+                            value: 4
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              tuple_literal {
+                fields {
+                  int_literal {
+                    value: 0
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 1
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 2
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 3
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "count"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          for_statement {
+            var_decl {
+              name: "x"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+            }
+            target {
+              identifier {
+                name: "ar"
+              }
+            }
+            body {
+              statements {
+                assign {
+                  lhs {
+                    identifier {
+                      name: "count"
+                    }
+                  }
+                  rhs {
+                    operator {
+                      op: Add
+                      arguments {
+                        identifier {
+                          name: "count"
+                        }
+                      }
+                      arguments {
+                        identifier {
+                          name: "x"
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+              statements {
+                if_statement {
+                  condition {
+                    operator {
+                      op: Eq
+                      arguments {
+                        identifier {
+                          name: "x"
+                        }
+                      }
+                      arguments {
+                        int_literal {
+                          value: 2
+                        }
+                      }
+                    }
+                  }
+                  then_block {
+                    statements {
+                      break_statement {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "count"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 81 - 0
explorer/fuzzing/fuzzer_corpus/0320fd304c1b6d244bb71809ae47b94cc10e3598

@@ -0,0 +1,81 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "y"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "y"
+              }
+            }
+            rhs {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "y"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 2
explorer/fuzzing/fuzzer_corpus/78b26d4cc87a7201331f2b2343091b85571fad22 → explorer/fuzzing/fuzzer_corpus/0334411b5237b6560686cb80741953d202625403

@@ -26,7 +26,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "t"
@@ -64,7 +64,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/a3849c4ee936d86c6e1aa5fe989eb32902009e45 → explorer/fuzzing/fuzzer_corpus/035e54ed2f88107e49ddd41e5972037ceb5afc72

@@ -30,7 +30,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add
@@ -94,10 +94,11 @@ compilation_unit {
                 name: "add1"
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 5 - 3
explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 → explorer/fuzzing/fuzzer_corpus/0365a66b097b7c504a3b78ebe1cb3ca297ad8e14

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -75,7 +75,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   simple_member_access {
                     field: "x"
@@ -170,6 +170,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -203,10 +204,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 218 - 0
explorer/fuzzing/fuzzer_corpus/037ed4792467ecaf7f145c6a005c433b4f3c806f

@@ -0,0 +1,218 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    interface {
+      name: "B"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    class_declaration {
+      name: "C"
+      type_params {
+        fields {
+          generic_binding {
+            name: "T"
+            type {
+              type_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        call {
+          function {
+            identifier {
+              name: "C"
+            }
+          }
+          argument {
+            tuple_literal {
+              fields {
+                identifier {
+                  name: "T"
+                }
+              }
+            }
+          }
+        }
+      }
+      interface {
+        operator {
+          op: BitwiseAnd
+          arguments {
+            call {
+              function {
+                identifier {
+                  name: "A"
+                }
+              }
+              argument {
+                tuple_literal {
+                  fields {
+                    identifier {
+                      name: "T"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          arguments {
+            identifier {
+              name: "B"
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "v"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "C"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              int_type_literal {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_type_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  compound_member_access {
+                    object {
+                      identifier {
+                        name: "v"
+                      }
+                    }
+                    path {
+                      simple_member_access {
+                        field: "F"
+                        object {
+                          identifier {
+                            name: "B"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/452707129ac2d03d141b9064cc34530f1d40d134 → explorer/fuzzing/fuzzer_corpus/0423184dc010280baaf7390c4017a20f2a743102

@@ -79,10 +79,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 110 - 0
explorer/fuzzing/fuzzer_corpus/04aca9d1fb78b349504f75dc82c5707eb66e7358

@@ -0,0 +1,110 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "fst"
+      deduced_parameters {
+        name: "T"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "y"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          identifier {
+            name: "T"
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "fst"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 0
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 268 - 0
explorer/fuzzing/fuzzer_corpus/04c799ab9e9d2efb9ca6b72bd89ce9b67f3613a7

@@ -0,0 +1,268 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    alias {
+      name: "AB"
+      target {
+        struct_type_literal {
+          fields {
+            name: "a"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+          fields {
+            name: "b"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    alias {
+      name: "BA"
+      target {
+        struct_type_literal {
+          fields {
+            name: "b"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+          fields {
+            name: "a"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "ab"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "AB"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_literal {
+                fields {
+                  name: "b"
+                  expression {
+                    int_literal {
+                      value: 1
+                    }
+                  }
+                }
+                fields {
+                  name: "a"
+                  expression {
+                    int_literal {
+                      value: 2
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "ba"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "BA"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              identifier {
+                name: "ab"
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ab.a: {0}"
+                      }
+                    }
+                    fields {
+                      simple_member_access {
+                        field: "a"
+                        object {
+                          identifier {
+                            name: "ab"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ab.b: {0}"
+                      }
+                    }
+                    fields {
+                      simple_member_access {
+                        field: "b"
+                        object {
+                          identifier {
+                            name: "ab"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ba.a: {0}"
+                      }
+                    }
+                    fields {
+                      simple_member_access {
+                        field: "a"
+                        object {
+                          identifier {
+                            name: "ba"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ba.b: {0}"
+                      }
+                    }
+                    fields {
+                      simple_member_access {
+                        field: "b"
+                        object {
+                          identifier {
+                            name: "ba"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 86 - 0
explorer/fuzzing/fuzzer_corpus/0512f4dcd737922dfec6eb81d4c93d1f11ad2f7c

@@ -0,0 +1,86 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Foo"
+      param_pattern {
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              tuple_literal {
+              }
+            }
+            is_returned: true
+          }
+        }
+        statements {
+          return_var_statement {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Foo"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 3
explorer/fuzzing/fuzzer_corpus/4ce3a6280cb42032b421b2ada1018f692720e17d → explorer/fuzzing/fuzzer_corpus/05acd8c5486c8c3c14cc3cd35202080730090b5c

@@ -82,7 +82,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   identifier {
                     name: "me"
@@ -168,7 +168,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add
@@ -336,7 +336,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 8 - 5
explorer/fuzzing/fuzzer_corpus/e629764c8d1fa144b53709998d97097c64b8777e → explorer/fuzzing/fuzzer_corpus/07281c243ec05c00152d6c076768adf1243065e6

@@ -59,7 +59,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       int_literal {
                         value: 1
@@ -130,7 +130,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       int_literal {
                         value: 2
@@ -201,7 +201,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       simple_member_access {
                         field: "n"
@@ -289,7 +289,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add
@@ -373,6 +373,7 @@ compilation_unit {
               struct_type_literal {
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -395,6 +396,7 @@ compilation_unit {
               struct_type_literal {
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -425,10 +427,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/50201a9944ed14b8eda2832d2e83a6258e383df8 → explorer/fuzzing/fuzzer_corpus/0853ff183c254e06433129992812989b0a83c6d1

@@ -50,7 +50,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 84 - 0
explorer/fuzzing/fuzzer_corpus/08b7c85df99757a3e2a21da986cc59412e5d4454

@@ -0,0 +1,84 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "FrobWith"
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F"
+      deduced_parameters {
+        name: "T"
+        type {
+          call {
+            function {
+              identifier {
+                name: "FrobWith"
+              }
+            }
+            argument {
+              tuple_literal {
+                fields {
+                  designator {
+                    name: "Self"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      deduced_parameters {
+        name: "U"
+        type {
+          designator {
+            name: "Self"
+          }
+        }
+      }
+      param_pattern {
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 82 - 0
explorer/fuzzing/fuzzer_corpus/090c7d5cfc2ffc4a812bd48800da8e98af91a676

@@ -0,0 +1,82 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "F"
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  call {
+                    function {
+                      identifier {
+                        name: "F"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 60 - 0
explorer/fuzzing/fuzzer_corpus/098d50dfd46567ec8237cccc129696c64a60a75b

@@ -0,0 +1,60 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    variable {
+      binding {
+        name: "x"
+        type {
+          expression_pattern {
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "x"
+              }
+            }
+            rhs {
+              int_literal {
+                value: 1
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 609 - 0
explorer/fuzzing/fuzzer_corpus/09bfdb72621215dcf457b12c78d419e390e35ff3

@@ -0,0 +1,609 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    class_declaration {
+      name: "Cell"
+      members {
+        function {
+          name: "Create"
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              call {
+                function {
+                  identifier {
+                    name: "Cell"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  struct_literal {
+                    fields {
+                      name: "data"
+                      expression {
+                        identifier {
+                          name: "x"
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Get"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "T"
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  simple_member_access {
+                    field: "data"
+                    object {
+                      identifier {
+                        name: "me"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Put"
+          me_pattern {
+            addr_pattern {
+              binding_pattern {
+                name: "me"
+                type {
+                  expression_pattern {
+                    expression {
+                      operator {
+                        op: Ptr
+                        arguments {
+                          identifier {
+                            name: "Self"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Omitted
+          }
+          body {
+            statements {
+              assign {
+                lhs {
+                  simple_member_access {
+                    field: "data"
+                    object {
+                      operator {
+                        op: Deref
+                        arguments {
+                          identifier {
+                            name: "me"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                rhs {
+                  identifier {
+                    name: "x"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "CreateOther"
+          deduced_parameters {
+            name: "U"
+            type {
+              type_type_literal {
+              }
+            }
+          }
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "U"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              call {
+                function {
+                  identifier {
+                    name: "Cell"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "U"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  struct_literal {
+                    fields {
+                      name: "data"
+                      expression {
+                        identifier {
+                          name: "x"
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        variable {
+          binding {
+            name: "data"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      type_params {
+        fields {
+          generic_binding {
+            name: "T"
+            type {
+              type_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    class_declaration {
+      name: "Integer"
+      members {
+        variable {
+          binding {
+            name: "int"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      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 {
+                      identifier {
+                        name: "Integer"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_literal {
+                fields {
+                  name: "int"
+                  expression {
+                    int_literal {
+                      value: 1
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "c"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "Cell"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              identifier {
+                                name: "Integer"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              call {
+                function {
+                  simple_member_access {
+                    field: "Create"
+                    object {
+                      call {
+                        function {
+                          identifier {
+                            name: "Cell"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              identifier {
+                                name: "Integer"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "i"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "i"
+              }
+            }
+            rhs {
+              struct_literal {
+                fields {
+                  name: "int"
+                  expression {
+                    int_literal {
+                      value: 0
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "Put"
+                    object {
+                      identifier {
+                        name: "c"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "i"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "j"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Integer"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              call {
+                function {
+                  simple_member_access {
+                    field: "Get"
+                    object {
+                      identifier {
+                        name: "c"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "d"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "Cell"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              identifier {
+                                name: "Integer"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              call {
+                function {
+                  simple_member_access {
+                    field: "CreateOther"
+                    object {
+                      identifier {
+                        name: "c"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "j"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Add
+                arguments {
+                  simple_member_access {
+                    field: "int"
+                    object {
+                      simple_member_access {
+                        field: "data"
+                        object {
+                          identifier {
+                            name: "c"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  simple_member_access {
+                    field: "int"
+                    object {
+                      simple_member_access {
+                        field: "data"
+                        object {
+                          identifier {
+                            name: "d"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 5 - 3
explorer/fuzzing/fuzzer_corpus/0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da → explorer/fuzzing/fuzzer_corpus/0a171cb7acaed31daaaa6f8671f3664368ce831d

@@ -117,7 +117,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -225,7 +225,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -313,6 +313,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -343,10 +344,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "n"

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/f10ec46c184b4ced165d8716780601f760ca0e99 → explorer/fuzzing/fuzzer_corpus/0ac4e657eed8b5281248287683e3528421b1a4b6

@@ -52,7 +52,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/c6d64b65616822d77916f2f4d0bb0cb8a3c2a3f4 → explorer/fuzzing/fuzzer_corpus/0bc9b876b1d01ef7d1fe26ebb7726dab202046d7

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -124,10 +124,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "x"

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 → explorer/fuzzing/fuzzer_corpus/0dd8c45c372707496adb50645eb89a2878a20e5a

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -179,6 +179,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -209,7 +210,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 78 - 0
explorer/fuzzing/fuzzer_corpus/0e3ba8c056c66dd97f847130384042762743541f

@@ -0,0 +1,78 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    class_declaration {
+      name: "A"
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "a"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_type_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              operator {
+                op: Mul
+                arguments {
+                  identifier {
+                    name: "a"
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 2
explorer/fuzzing/fuzzer_corpus/81b32b8dcef96d836fd3eb769d58f3bfefa593fa → explorer/fuzzing/fuzzer_corpus/0ebcf9c08c4fdce3bfc657c7a6361307b3644f26

@@ -13,7 +13,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             is_omitted_expression: true
           }
         }
@@ -51,7 +51,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 0 - 494
explorer/fuzzing/fuzzer_corpus/0efb68ab631d0a132d9eb73c0af9c731ca6b3c2a

@@ -1,494 +0,0 @@
-compilation_unit {
-  package_statement {
-    package_name: "ExplorerTest"
-  }
-  is_api: true
-  declarations {
-    choice {
-      name: "Ints"
-      alternatives {
-        name: "None"
-        signature {
-          tuple_literal {
-          }
-        }
-      }
-      alternatives {
-        name: "One"
-        signature {
-          tuple_literal {
-            fields {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-      alternatives {
-        name: "Two"
-        signature {
-          tuple_literal {
-            fields {
-              int_type_literal {
-              }
-            }
-            fields {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  declarations {
-    function {
-      name: "Main"
-      param_pattern {
-      }
-      return_term {
-        kind: Expression
-        type {
-          int_type_literal {
-          }
-        }
-      }
-      body {
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "x"
-                type {
-                  auto_pattern {
-                  }
-                }
-              }
-            }
-            init {
-              call {
-                function {
-                  simple_member_access {
-                    field: "None"
-                    object {
-                      identifier {
-                        name: "Ints"
-                      }
-                    }
-                  }
-                }
-                argument {
-                  tuple_literal {
-                  }
-                }
-              }
-            }
-          }
-        }
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "y"
-                type {
-                  auto_pattern {
-                  }
-                }
-              }
-            }
-            init {
-              call {
-                function {
-                  simple_member_access {
-                    field: "One"
-                    object {
-                      identifier {
-                        name: "Ints"
-                      }
-                    }
-                  }
-                }
-                argument {
-                  tuple_literal {
-                    fields {
-                      int_literal {
-                        value: 42
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "n"
-                type {
-                  auto_pattern {
-                  }
-                }
-              }
-            }
-            init {
-              int_literal {
-                value: 0
-              }
-            }
-          }
-        }
-        statements {
-          match {
-            expression {
-              identifier {
-                name: "y"
-              }
-            }
-            clauses {
-              pattern {
-                expression_pattern {
-                  expression {
-                    simple_member_access {
-                      field: "None"
-                      object {
-                        identifier {
-                          name: "Ints"
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Add
-                      arguments {
-                        identifier {
-                          name: "n"
-                        }
-                      }
-                      arguments {
-                        int_literal {
-                          value: 2
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            clauses {
-              pattern {
-                alternative_pattern {
-                  choice_type {
-                    identifier {
-                      name: "Ints"
-                    }
-                  }
-                  alternative_name: "One"
-                  arguments {
-                    fields {
-                      binding_pattern {
-                        name: "x"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Sub
-                      arguments {
-                        operator {
-                          op: Add
-                          arguments {
-                            identifier {
-                              name: "x"
-                            }
-                          }
-                          arguments {
-                            int_literal {
-                              value: 1
-                            }
-                          }
-                        }
-                      }
-                      arguments {
-                        int_literal {
-                          value: 42
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            clauses {
-              pattern {
-                alternative_pattern {
-                  choice_type {
-                    identifier {
-                      name: "Ints"
-                    }
-                  }
-                  alternative_name: "Two"
-                  arguments {
-                    fields {
-                      binding_pattern {
-                        name: "a"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                    fields {
-                      binding_pattern {
-                        name: "b"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    int_literal {
-                      value: 2
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        statements {
-          match {
-            expression {
-              identifier {
-                name: "x"
-              }
-            }
-            clauses {
-              pattern {
-                alternative_pattern {
-                  choice_type {
-                    identifier {
-                      name: "Ints"
-                    }
-                  }
-                  alternative_name: "One"
-                  arguments {
-                    fields {
-                      binding_pattern {
-                        name: "x"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Add
-                      arguments {
-                        identifier {
-                          name: "x"
-                        }
-                      }
-                      arguments {
-                        int_literal {
-                          value: 2
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            clauses {
-              pattern {
-                expression_pattern {
-                  expression {
-                    call {
-                      function {
-                        simple_member_access {
-                          field: "None"
-                          object {
-                            identifier {
-                              name: "Ints"
-                            }
-                          }
-                        }
-                      }
-                      argument {
-                        tuple_literal {
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Sub
-                      arguments {
-                        identifier {
-                          name: "n"
-                        }
-                      }
-                      arguments {
-                        int_literal {
-                          value: 1
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            clauses {
-              pattern {
-                alternative_pattern {
-                  choice_type {
-                    identifier {
-                      name: "Ints"
-                    }
-                  }
-                  alternative_name: "Two"
-                  arguments {
-                    fields {
-                      binding_pattern {
-                        name: "x"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                    fields {
-                      binding_pattern {
-                        name: "y"
-                        type {
-                          auto_pattern {
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    int_literal {
-                      value: 5
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        statements {
-          return_statement {
-            expression {
-              identifier {
-                name: "n"
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  declarations {
-    choice {
-      name: "MoreInts"
-      alternatives {
-        name: "None"
-        signature {
-          tuple_literal {
-          }
-        }
-      }
-      alternatives {
-        name: "One"
-        signature {
-          tuple_literal {
-            fields {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-      alternatives {
-        name: "Two"
-        signature {
-          tuple_literal {
-            fields {
-              int_type_literal {
-              }
-            }
-            fields {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 588 - 0
explorer/fuzzing/fuzzer_corpus/0f2f35d69e772d1548bb252041b45d254bb1f4c8

@@ -0,0 +1,588 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "G"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    interface {
+      name: "B"
+      members {
+        function {
+          name: "H"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Get1"
+      deduced_parameters {
+        name: "T"
+        type {
+          operator {
+            op: BitwiseAnd
+            arguments {
+              identifier {
+                name: "A"
+              }
+            }
+            arguments {
+              identifier {
+                name: "B"
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "n"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Add
+                arguments {
+                  call {
+                    function {
+                      simple_member_access {
+                        field: "F"
+                        object {
+                          identifier {
+                            name: "n"
+                          }
+                        }
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  call {
+                    function {
+                      simple_member_access {
+                        field: "H"
+                        object {
+                          identifier {
+                            name: "n"
+                          }
+                        }
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Get2"
+      deduced_parameters {
+        name: "T"
+        type {
+          operator {
+            op: BitwiseAnd
+            arguments {
+              identifier {
+                name: "B"
+              }
+            }
+            arguments {
+              identifier {
+                name: "A"
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "n"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "G"
+                    object {
+                      identifier {
+                        name: "n"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Get3"
+      deduced_parameters {
+        name: "T"
+        type {
+          operator {
+            op: BitwiseAnd
+            arguments {
+              operator {
+                op: BitwiseAnd
+                arguments {
+                  operator {
+                    op: BitwiseAnd
+                    arguments {
+                      operator {
+                        op: BitwiseAnd
+                        arguments {
+                          identifier {
+                            name: "B"
+                          }
+                        }
+                        arguments {
+                          identifier {
+                            name: "A"
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  identifier {
+                    name: "B"
+                  }
+                }
+              }
+            }
+            arguments {
+              identifier {
+                name: "A"
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "n"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Add
+                arguments {
+                  call {
+                    function {
+                      simple_member_access {
+                        field: "G"
+                        object {
+                          identifier {
+                            name: "n"
+                          }
+                        }
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  call {
+                    function {
+                      simple_member_access {
+                        field: "H"
+                        object {
+                          identifier {
+                            name: "n"
+                          }
+                        }
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "A"
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "G"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 2
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "B"
+        }
+      }
+      members {
+        function {
+          name: "H"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 4
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "z"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Add
+                arguments {
+                  operator {
+                    op: Add
+                    arguments {
+                      operator {
+                        op: Mul
+                        arguments {
+                          call {
+                            function {
+                              identifier {
+                                name: "Get1"
+                              }
+                            }
+                            argument {
+                              tuple_literal {
+                                fields {
+                                  identifier {
+                                    name: "z"
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                        arguments {
+                          int_literal {
+                            value: 100
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      operator {
+                        op: Mul
+                        arguments {
+                          call {
+                            function {
+                              identifier {
+                                name: "Get2"
+                              }
+                            }
+                            argument {
+                              tuple_literal {
+                                fields {
+                                  identifier {
+                                    name: "z"
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                        arguments {
+                          int_literal {
+                            value: 10
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  call {
+                    function {
+                      identifier {
+                        name: "Get3"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          identifier {
+                            name: "z"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 168 - 0
explorer/fuzzing/fuzzer_corpus/0f507908b0596f095a37412bbaa5064665453720

@@ -0,0 +1,168 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    variable {
+      binding {
+        name: "call_count"
+        type {
+          expression_pattern {
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      initializer {
+        int_literal {
+          value: 0
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "ReturnTrue"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          bool_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "call_count"
+              }
+            }
+            rhs {
+              operator {
+                op: Add
+                arguments {
+                  identifier {
+                    name: "call_count"
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              bool_literal {
+                value: true
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "result"
+                type {
+                  expression_pattern {
+                    expression {
+                      bool_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              operator {
+                op: Or
+                arguments {
+                  call {
+                    function {
+                      identifier {
+                        name: "ReturnTrue"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  call {
+                    function {
+                      identifier {
+                        name: "ReturnTrue"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              if_expression {
+                condition {
+                  identifier {
+                    name: "result"
+                  }
+                }
+                then_expression {
+                  identifier {
+                    name: "call_count"
+                  }
+                }
+                else_expression {
+                  operator {
+                    op: Neg
+                    arguments {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/af823bcd329c5523c03eef4a68a941ec235b6769 → explorer/fuzzing/fuzzer_corpus/0ff60a71d43fa4bb8b98926ecc4c3c9264ba73af

@@ -29,9 +29,10 @@ compilation_unit {
             }
             init {
               string_literal {
-                value: "Hello world!\n"
+                value: "Hello world!"
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -57,7 +58,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 93 - 72
explorer/fuzzing/fuzzer_corpus/7f0f1bc85599a63045bfc3d2a4a7d0e5865beff0 → explorer/fuzzing/fuzzer_corpus/103128bcb516ce489aaaa1532aa50bf80aeca61f

@@ -20,39 +20,18 @@ compilation_unit {
           variable_definition {
             pattern {
               binding_pattern {
-                name: "x"
+                name: "ar"
                 type {
                   expression_pattern {
                     expression {
-                      int_type_literal {
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            init {
-              int_literal {
-                value: 1
-              }
-            }
-          }
-        }
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "t2"
-                type {
-                  expression_pattern {
-                    expression {
-                      tuple_literal {
-                        fields {
+                      array_type_literal {
+                        element_type {
                           int_type_literal {
                           }
                         }
-                        fields {
-                          int_type_literal {
+                        size {
+                          int_literal {
+                            value: 4
                           }
                         }
                       }
@@ -65,7 +44,12 @@ compilation_unit {
               tuple_literal {
                 fields {
                   int_literal {
-                    value: 5
+                    value: 0
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 1
                   }
                 }
                 fields {
@@ -73,80 +57,117 @@ compilation_unit {
                     value: 2
                   }
                 }
+                fields {
+                  int_literal {
+                    value: 3
+                  }
+                }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          assign {
-            lhs {
-              index {
-                object {
-                  identifier {
-                    name: "t2"
-                  }
-                }
-                offset {
-                  int_literal {
-                    value: 0
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "count"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
                   }
                 }
               }
             }
-            rhs {
+            init {
               int_literal {
-                value: 3
+                value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
-            expression {
-              operator {
-                op: Sub
-                arguments {
-                  operator {
-                    op: Sub
-                    arguments {
-                      index {
-                        object {
-                          identifier {
-                            name: "t2"
-                          }
-                        }
-                        offset {
-                          int_literal {
-                            value: 0
-                          }
+          for_statement {
+            var_decl {
+              name: "x"
+              type {
+                auto_pattern {
+                }
+              }
+            }
+            target {
+              identifier {
+                name: "ar"
+              }
+            }
+            body {
+              statements {
+                expression_statement {
+                  expression {
+                    call {
+                      function {
+                        identifier {
+                          name: "Print"
                         }
                       }
-                    }
-                    arguments {
-                      index {
-                        object {
-                          identifier {
-                            name: "t2"
+                      argument {
+                        tuple_literal {
+                          fields {
+                            string_literal {
+                              value: "HALLO WELT "
+                            }
                           }
-                        }
-                        offset {
-                          int_literal {
-                            value: 1
+                          fields {
+                            identifier {
+                              name: "x"
+                            }
                           }
                         }
                       }
                     }
                   }
                 }
-                arguments {
-                  identifier {
-                    name: "x"
+              }
+              statements {
+                assign {
+                  lhs {
+                    identifier {
+                      name: "count"
+                    }
+                  }
+                  rhs {
+                    operator {
+                      op: Add
+                      arguments {
+                        identifier {
+                          name: "count"
+                        }
+                      }
+                      arguments {
+                        int_literal {
+                          value: 1
+                        }
+                      }
+                    }
                   }
                 }
               }
             }
           }
         }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "count"
+              }
+            }
+          }
+        }
       }
     }
   }

+ 92 - 0
explorer/fuzzing/fuzzer_corpus/10ebe2c0d5ba72c214e7af06a5d987c364c53165

@@ -0,0 +1,92 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "f"
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Sub
+                arguments {
+                  identifier {
+                    name: "x"
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "f"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/3970d3e6038118b382fcd8e1a5a03b8467b19e3c → explorer/fuzzing/fuzzer_corpus/110dd41650498a5aecc23b5b6e483cad55f35864

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -138,10 +138,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 33 - 23
explorer/fuzzing/fuzzer_corpus/f1cd0eda5c6c5b8782bb45164e4c431795d91ed8 → explorer/fuzzing/fuzzer_corpus/11375e4c6780c9c8358d57a814a7100203686f0c

@@ -77,6 +77,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -95,6 +96,7 @@ compilation_unit {
                 value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -131,15 +133,19 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "x"
-                    }
-                  }
-                  rhs {
-                    int_literal {
-                      value: 2
+                block {
+                  statements {
+                    assign {
+                      lhs {
+                        identifier {
+                          name: "x"
+                        }
+                      }
+                      rhs {
+                        int_literal {
+                          value: 2
+                        }
+                      }
                     }
                   }
                 }
@@ -169,23 +175,27 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Sub
-                      arguments {
+                block {
+                  statements {
+                    assign {
+                      lhs {
                         identifier {
                           name: "n"
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 1
+                      rhs {
+                        operator {
+                          op: Sub
+                          arguments {
+                            identifier {
+                              name: "n"
+                            }
+                          }
+                          arguments {
+                            int_literal {
+                              value: 1
+                            }
+                          }
                         }
                       }
                     }
@@ -246,7 +256,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 4 - 3
explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c → explorer/fuzzing/fuzzer_corpus/123b2a5baad3b9975bd241845fd936e600c55aaa

@@ -61,7 +61,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -142,7 +142,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   simple_member_access {
                     field: "x"
@@ -279,10 +279,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/2d8f362c9aa1fb508c8f25ea687905183abeadcf → explorer/fuzzing/fuzzer_corpus/131845e36ae4393f4e18481b38d58c44b65ae696

@@ -17,7 +17,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/733898e2c7730693eb323caa6b2a827a547db97a → explorer/fuzzing/fuzzer_corpus/1655ed04f10c07abc524dfca4bbfc2f38122a665

@@ -91,10 +91,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 124 - 0
explorer/fuzzing/fuzzer_corpus/174240eeaa59005d7b46ff86542da6ad9b009ca4

@@ -0,0 +1,124 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      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: Auto
+      }
+      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: "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
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 3
explorer/fuzzing/fuzzer_corpus/96c23d870abc34df6a29ffbb8c36d1244d25920c → explorer/fuzzing/fuzzer_corpus/17a226907550562b780d15f6ff2e022f3ed880cc

@@ -48,7 +48,7 @@ compilation_unit {
             }
             then_block {
               statements {
-                return_statement {
+                return_expression_statement {
                   expression {
                     int_literal {
                       value: 0
@@ -60,7 +60,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 1
@@ -85,7 +85,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/c9606ffaf4f210c8a238c44b9df1cc0e2b331568 → explorer/fuzzing/fuzzer_corpus/1874f41efe6cbac77f4239267d6f05f9f5e26864

@@ -36,6 +36,7 @@ compilation_unit {
                 value: 5
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -68,10 +69,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 121 - 0
explorer/fuzzing/fuzzer_corpus/18a346283d534bc2e8ac6bd6b83f32ab1ce8840e

@@ -0,0 +1,121 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "ar"
+                type {
+                  expression_pattern {
+                    expression {
+                      array_type_literal {
+                        element_type {
+                          int_type_literal {
+                          }
+                        }
+                        size {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              tuple_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "count"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          for_statement {
+            var_decl {
+              name: "x"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+            }
+            target {
+              identifier {
+                name: "ar"
+              }
+            }
+            body {
+              statements {
+                assign {
+                  lhs {
+                    identifier {
+                      name: "count"
+                    }
+                  }
+                  rhs {
+                    int_literal {
+                      value: 2
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "count"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/8fe762ea6e0d319af3a4fabe55061d8b06f199c7 → explorer/fuzzing/fuzzer_corpus/18cc6fefea80deb3e21fa2b3d225b7e503660418

@@ -32,6 +32,7 @@ compilation_unit {
                 value: 10
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -49,7 +50,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/5d23159de123d0f5bf00df8d6027e5ef3546f3b9 → explorer/fuzzing/fuzzer_corpus/18e1ca7823d8ea4621b623c8c0cf64d94a4e61ef

@@ -51,7 +51,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "zero"

+ 21 - 16
explorer/fuzzing/fuzzer_corpus/adb602ba9f22045e62faf571ba97b36a44977b21 → explorer/fuzzing/fuzzer_corpus/1a3c5c7768ee6278315fda324c11bea9bf899b60

@@ -41,6 +41,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -74,30 +75,34 @@ compilation_unit {
                 }
               }
               statement {
-                return_statement {
-                  expression {
-                    operator {
-                      op: Sub
-                      arguments {
+                block {
+                  statements {
+                    return_expression_statement {
+                      expression {
                         operator {
-                          op: Add
+                          op: Sub
                           arguments {
-                            identifier {
-                              name: "a"
+                            operator {
+                              op: Add
+                              arguments {
+                                identifier {
+                                  name: "a"
+                                }
+                              }
+                              arguments {
+                                identifier {
+                                  name: "b"
+                                }
+                              }
                             }
                           }
                           arguments {
-                            identifier {
-                              name: "b"
+                            int_literal {
+                              value: 7
                             }
                           }
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 7
-                        }
-                      }
                     }
                   }
                 }
@@ -106,7 +111,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 1

+ 72 - 0
explorer/fuzzing/fuzzer_corpus/1a697491793f55ffad86d792d4cc1031b0a1d332

@@ -0,0 +1,72 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "y"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              identifier {
+                name: "x"
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 197 - 0
explorer/fuzzing/fuzzer_corpus/1ae261160fce034414718a326ad74b9b73ad5c85

@@ -0,0 +1,197 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "ar"
+                type {
+                  expression_pattern {
+                    expression {
+                      array_type_literal {
+                        element_type {
+                          int_type_literal {
+                          }
+                        }
+                        size {
+                          int_literal {
+                            value: 4
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              tuple_literal {
+                fields {
+                  int_literal {
+                    value: 0
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 1
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 2
+                  }
+                }
+                fields {
+                  int_literal {
+                    value: 3
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "count"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          for_statement {
+            var_decl {
+              name: "x"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+            }
+            target {
+              identifier {
+                name: "ar"
+              }
+            }
+            body {
+              statements {
+                assign {
+                  lhs {
+                    identifier {
+                      name: "count"
+                    }
+                  }
+                  rhs {
+                    operator {
+                      op: Add
+                      arguments {
+                        identifier {
+                          name: "count"
+                        }
+                      }
+                      arguments {
+                        int_literal {
+                          value: 1
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+              statements {
+                for_statement {
+                  var_decl {
+                    name: "x"
+                    type {
+                      expression_pattern {
+                        expression {
+                          int_type_literal {
+                          }
+                        }
+                      }
+                    }
+                  }
+                  target {
+                    identifier {
+                      name: "ar"
+                    }
+                  }
+                  body {
+                    statements {
+                      assign {
+                        lhs {
+                          identifier {
+                            name: "count"
+                          }
+                        }
+                        rhs {
+                          operator {
+                            op: Add
+                            arguments {
+                              identifier {
+                                name: "count"
+                              }
+                            }
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "count"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 508 - 0
explorer/fuzzing/fuzzer_corpus/1b9a00fdda2a0ad1e7fa522f8910a77a9e639622

@@ -0,0 +1,508 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "Vector"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "Dim"
+              type {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        tuple_literal {
+          fields {
+            int_type_literal {
+            }
+          }
+          fields {
+            int_type_literal {
+            }
+          }
+          fields {
+            int_type_literal {
+            }
+          }
+        }
+      }
+      interface {
+        where {
+          base {
+            identifier {
+              name: "Vector"
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "Dim"
+                }
+              }
+              rhs {
+                int_literal {
+                  value: 3
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    class_declaration {
+      name: "Point"
+      type_params {
+        fields {
+          generic_binding {
+            name: "Scalar"
+            type {
+              type_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "Dim"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F"
+      deduced_parameters {
+        name: "Scalar"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      deduced_parameters {
+        name: "V"
+        type {
+          where {
+            base {
+              identifier {
+                name: "Vector"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "Dim"
+                  }
+                }
+                rhs {
+                  int_literal {
+                    value: 3
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "p"
+            type {
+              expression_pattern {
+                expression {
+                  call {
+                    function {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          identifier {
+                            name: "Scalar"
+                          }
+                        }
+                        fields {
+                          simple_member_access {
+                            field: "Dim"
+                            object {
+                              identifier {
+                                name: "V"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "v"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "V"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "G"
+      deduced_parameters {
+        name: "Scalar"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "p"
+            type {
+              expression_pattern {
+                expression {
+                  call {
+                    function {
+                      identifier {
+                        name: "Point"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          identifier {
+                            name: "Scalar"
+                          }
+                        }
+                        fields {
+                          int_literal {
+                            value: 3
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "H"
+      deduced_parameters {
+        name: "V"
+        type {
+          where {
+            base {
+              identifier {
+                name: "Vector"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "Dim"
+                  }
+                }
+                rhs {
+                  int_literal {
+                    value: 3
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "v"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "V"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "p"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "Point"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              int_type_literal {
+                              }
+                            }
+                            fields {
+                              simple_member_access {
+                                field: "Dim"
+                                object {
+                                  identifier {
+                                    name: "V"
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_type_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "G"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "p"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "p"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "Point"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              int_type_literal {
+                              }
+                            }
+                            fields {
+                              int_literal {
+                                value: 3
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_type_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "F"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "p"
+                      }
+                    }
+                    fields {
+                      tuple_literal {
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "H"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      tuple_literal {
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                        fields {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 61 - 0
explorer/fuzzing/fuzzer_corpus/1c6306b5f3ee237f9364851331ae6a468ec4f40a

@@ -0,0 +1,61 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          if_statement {
+            condition {
+              operator {
+                op: Eq
+                arguments {
+                  int_literal {
+                    value: 1
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+            then_block {
+              statements {
+                return_expression_statement {
+                  expression {
+                    int_literal {
+                      value: 0
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 1
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 105 - 78
explorer/fuzzing/fuzzer_corpus/57182bf25e23bdbb8db74996446c7e510d08323e → explorer/fuzzing/fuzzer_corpus/1c833bb7c794465474634ef5f6ee0fa9380955ca

@@ -82,6 +82,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -123,6 +124,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -145,6 +147,7 @@ compilation_unit {
                 value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -178,23 +181,27 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Add
-                      arguments {
+                block {
+                  statements {
+                    assign {
+                      lhs {
                         identifier {
                           name: "n"
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 2
+                      rhs {
+                        operator {
+                          op: Add
+                          arguments {
+                            identifier {
+                              name: "n"
+                            }
+                          }
+                          arguments {
+                            int_literal {
+                              value: 2
+                            }
+                          }
                         }
                       }
                     }
@@ -225,35 +232,39 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Sub
-                      arguments {
+                block {
+                  statements {
+                    assign {
+                      lhs {
+                        identifier {
+                          name: "n"
+                        }
+                      }
+                      rhs {
                         operator {
-                          op: Add
+                          op: Sub
                           arguments {
-                            identifier {
-                              name: "x"
+                            operator {
+                              op: Add
+                              arguments {
+                                identifier {
+                                  name: "x"
+                                }
+                              }
+                              arguments {
+                                int_literal {
+                                  value: 1
+                                }
+                              }
                             }
                           }
                           arguments {
                             int_literal {
-                              value: 1
+                              value: 42
                             }
                           }
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 42
-                        }
-                      }
                     }
                   }
                 }
@@ -291,15 +302,19 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    int_literal {
-                      value: 2
+                block {
+                  statements {
+                    assign {
+                      lhs {
+                        identifier {
+                          name: "n"
+                        }
+                      }
+                      rhs {
+                        int_literal {
+                          value: 2
+                        }
+                      }
                     }
                   }
                 }
@@ -337,23 +352,27 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Add
-                      arguments {
+                block {
+                  statements {
+                    assign {
+                      lhs {
                         identifier {
-                          name: "x"
+                          name: "n"
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 2
+                      rhs {
+                        operator {
+                          op: Add
+                          arguments {
+                            identifier {
+                              name: "x"
+                            }
+                          }
+                          arguments {
+                            int_literal {
+                              value: 2
+                            }
+                          }
                         }
                       }
                     }
@@ -385,23 +404,27 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    operator {
-                      op: Sub
-                      arguments {
+                block {
+                  statements {
+                    assign {
+                      lhs {
                         identifier {
                           name: "n"
                         }
                       }
-                      arguments {
-                        int_literal {
-                          value: 1
+                      rhs {
+                        operator {
+                          op: Sub
+                          arguments {
+                            identifier {
+                              name: "n"
+                            }
+                          }
+                          arguments {
+                            int_literal {
+                              value: 1
+                            }
+                          }
                         }
                       }
                     }
@@ -441,15 +464,19 @@ compilation_unit {
                 }
               }
               statement {
-                assign {
-                  lhs {
-                    identifier {
-                      name: "n"
-                    }
-                  }
-                  rhs {
-                    int_literal {
-                      value: 5
+                block {
+                  statements {
+                    assign {
+                      lhs {
+                        identifier {
+                          name: "n"
+                        }
+                      }
+                      rhs {
+                        int_literal {
+                          value: 5
+                        }
+                      }
                     }
                   }
                 }
@@ -458,7 +485,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "n"

+ 83 - 0
explorer/fuzzing/fuzzer_corpus/1cc5cb983b344e8b6c13ccdb2f4e3d908818392a

@@ -0,0 +1,83 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "DoNothing"
+      param_pattern {
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "DoNothing"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/2cba46ce7d3c8ac95503a2f3b0fc008f49a0e8c0 → explorer/fuzzing/fuzzer_corpus/1d9e0b21f3ae7bf7a8f19767054f3a72bc4b85a2

@@ -26,7 +26,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "t"
@@ -83,10 +83,11 @@ compilation_unit {
                 value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "x"

+ 70 - 0
explorer/fuzzing/fuzzer_corpus/1ef8120770659fe409e559e724c2b0c2459b018e

@@ -0,0 +1,70 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    alias {
+      name: "B"
+      target {
+        where {
+          base {
+            identifier {
+              name: "A"
+            }
+          }
+          clauses {
+            is {
+              type {
+                int_type_literal {
+                }
+              }
+              constraint {
+                int_literal {
+                  value: 5
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 338 - 0
explorer/fuzzing/fuzzer_corpus/1efd8969cb72eb3af6d06dc50d0fbddb8c1140c3

@@ -0,0 +1,338 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "T"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F1"
+      deduced_parameters {
+        name: "T"
+        type {
+          where {
+            base {
+              identifier {
+                name: "A"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "T"
+                  }
+                }
+                rhs {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  simple_member_access {
+                    field: "T"
+                    object {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F2"
+      deduced_parameters {
+        name: "U"
+        type {
+          where {
+            base {
+              identifier {
+                name: "A"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "T"
+                  }
+                }
+                rhs {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          simple_member_access {
+            field: "T"
+            object {
+              identifier {
+                name: "U"
+              }
+            }
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F3"
+      deduced_parameters {
+        name: "T"
+        type {
+          where {
+            base {
+              identifier {
+                name: "A"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "T"
+                  }
+                }
+                rhs {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      deduced_parameters {
+        name: "U"
+        type {
+          where {
+            base {
+              identifier {
+                name: "A"
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "T"
+                  }
+                }
+                rhs {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  simple_member_access {
+                    field: "T"
+                    object {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          simple_member_access {
+            field: "T"
+            object {
+              identifier {
+                name: "U"
+              }
+            }
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        where {
+          base {
+            identifier {
+              name: "A"
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "T"
+                }
+              }
+              rhs {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "F3"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 0
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/8b1e226f1db3bcb383c02953aba964b742263458 → explorer/fuzzing/fuzzer_corpus/210db2016458d0bdcfcbb47dca27f5fccebe3bcc

@@ -65,10 +65,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/dc2e50336df6ff0869998c617d892af54733cbd6 → explorer/fuzzing/fuzzer_corpus/212b776b9eac4e8195374bb267efc816e57ca249

@@ -36,6 +36,7 @@ compilation_unit {
                 value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -62,6 +63,7 @@ compilation_unit {
                       value: 0
                     }
                   }
+                  is_returned: false
                 }
               }
               statements {
@@ -152,7 +154,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "y"

+ 4 - 3
explorer/fuzzing/fuzzer_corpus/1d3fda03a0e7a36ebb1e70237c64398b5342a8cf → explorer/fuzzing/fuzzer_corpus/2289a078ddc2d55ba7953a9fa293adc57df38d5f

@@ -100,7 +100,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "x"
@@ -167,7 +167,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "y"
@@ -244,10 +244,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add

+ 188 - 0
explorer/fuzzing/fuzzer_corpus/2389be0b3839188c1de312636cc6aa31c253dcf7

@@ -0,0 +1,188 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "IntDiff"
+      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 {
+          if_statement {
+            condition {
+              operator {
+                op: Eq
+                arguments {
+                  identifier {
+                    name: "a"
+                  }
+                }
+                arguments {
+                  identifier {
+                    name: "b"
+                  }
+                }
+              }
+            }
+            then_block {
+              statements {
+                variable_definition {
+                  pattern {
+                    binding_pattern {
+                      name: "ret"
+                      type {
+                        expression_pattern {
+                          expression {
+                            int_type_literal {
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                  init {
+                    operator {
+                      op: Sub
+                      arguments {
+                        identifier {
+                          name: "a"
+                        }
+                      }
+                      arguments {
+                        identifier {
+                          name: "b"
+                        }
+                      }
+                    }
+                  }
+                  is_returned: true
+                }
+              }
+              statements {
+                return_var_statement {
+                }
+              }
+            }
+            else_block {
+              statements {
+                variable_definition {
+                  pattern {
+                    binding_pattern {
+                      name: "ret2"
+                      type {
+                        expression_pattern {
+                          expression {
+                            int_type_literal {
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                  init {
+                    operator {
+                      op: Sub
+                      arguments {
+                        identifier {
+                          name: "b"
+                        }
+                      }
+                      arguments {
+                        identifier {
+                          name: "a"
+                        }
+                      }
+                    }
+                  }
+                  is_returned: true
+                }
+              }
+              statements {
+                return_var_statement {
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "IntDiff"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 2
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/b975f0686fbaedb1c887681cb7030b0c6a44ebba → explorer/fuzzing/fuzzer_corpus/24e679a28f8b2f9b596ec21a3e963cc2a08eab17

@@ -65,6 +65,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -87,7 +88,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/5c138fdb364e8686fe0b7b9e85a4c4d7885091c8 → explorer/fuzzing/fuzzer_corpus/252c00e39fd07e5f7c1d52a8a85f05fc08a2b3e3

@@ -18,7 +18,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 152 - 0
explorer/fuzzing/fuzzer_corpus/256fd58b383bf6fe89a33cdd27c4f9dd5350539e

@@ -0,0 +1,152 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "DoMul"
+      deduced_parameters {
+        name: "T"
+        type {
+          where {
+            base {
+              call {
+                function {
+                  identifier {
+                    name: "MulWith"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      designator {
+                        name: "Self"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            clauses {
+              equals {
+                lhs {
+                  designator {
+                    name: "Result"
+                  }
+                }
+                rhs {
+                  designator {
+                    name: "Self"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "x"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "y"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          identifier {
+            name: "T"
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Mul
+                arguments {
+                  identifier {
+                    name: "x"
+                  }
+                }
+                arguments {
+                  identifier {
+                    name: "y"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "DoMul"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 2
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 3
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 472 - 0
explorer/fuzzing/fuzzer_corpus/25ef4723c03efe1378b8b1d98d432bc537bf07e2

@@ -0,0 +1,472 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "TA"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "FA"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "TA"
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    interface {
+      name: "B"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "TB"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "FB"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "TB"
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    class_declaration {
+      name: "C"
+      members {
+        impl {
+          kind: InternalImpl
+          impl_type {
+            identifier {
+              name: "Self"
+            }
+          }
+          interface {
+            where {
+              base {
+                operator {
+                  op: BitwiseAnd
+                  arguments {
+                    identifier {
+                      name: "A"
+                    }
+                  }
+                  arguments {
+                    identifier {
+                      name: "B"
+                    }
+                  }
+                }
+              }
+              clauses {
+                equals {
+                  lhs {
+                    designator {
+                      name: "TA"
+                    }
+                  }
+                  rhs {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+              clauses {
+                equals {
+                  lhs {
+                    designator {
+                      name: "TB"
+                    }
+                  }
+                  rhs {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+            }
+          }
+          members {
+            function {
+              name: "FA"
+              param_pattern {
+              }
+              return_term {
+                kind: Expression
+                type {
+                  int_type_literal {
+                  }
+                }
+              }
+              body {
+                statements {
+                  variable_definition {
+                    pattern {
+                      binding_pattern {
+                        name: "v"
+                        type {
+                          expression_pattern {
+                            expression {
+                              compound_member_access {
+                                object {
+                                  identifier {
+                                    name: "Self"
+                                  }
+                                }
+                                path {
+                                  simple_member_access {
+                                    field: "TA"
+                                    object {
+                                      identifier {
+                                        name: "A"
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    init {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    is_returned: false
+                  }
+                }
+                statements {
+                  variable_definition {
+                    pattern {
+                      binding_pattern {
+                        name: "w"
+                        type {
+                          expression_pattern {
+                            expression {
+                              int_type_literal {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    init {
+                      identifier {
+                        name: "v"
+                      }
+                    }
+                    is_returned: false
+                  }
+                }
+                statements {
+                  return_expression_statement {
+                    expression {
+                      identifier {
+                        name: "w"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          members {
+            function {
+              name: "FB"
+              param_pattern {
+              }
+              return_term {
+                kind: Expression
+                type {
+                  int_type_literal {
+                  }
+                }
+              }
+              body {
+                statements {
+                  variable_definition {
+                    pattern {
+                      binding_pattern {
+                        name: "v"
+                        type {
+                          expression_pattern {
+                            expression {
+                              compound_member_access {
+                                object {
+                                  identifier {
+                                    name: "Self"
+                                  }
+                                }
+                                path {
+                                  simple_member_access {
+                                    field: "TB"
+                                    object {
+                                      identifier {
+                                        name: "B"
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    init {
+                      int_literal {
+                        value: 2
+                      }
+                    }
+                    is_returned: false
+                  }
+                }
+                statements {
+                  variable_definition {
+                    pattern {
+                      binding_pattern {
+                        name: "w"
+                        type {
+                          expression_pattern {
+                            expression {
+                              compound_member_access {
+                                object {
+                                  identifier {
+                                    name: "Self"
+                                  }
+                                }
+                                path {
+                                  simple_member_access {
+                                    field: "TA"
+                                    object {
+                                      identifier {
+                                        name: "A"
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    init {
+                      int_literal {
+                        value: 3
+                      }
+                    }
+                    is_returned: false
+                  }
+                }
+                statements {
+                  return_expression_statement {
+                    expression {
+                      operator {
+                        op: Add
+                        arguments {
+                          identifier {
+                            name: "v"
+                          }
+                        }
+                        arguments {
+                          identifier {
+                            name: "w"
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      type_params {
+        fields {
+          generic_binding {
+            name: "T"
+            type {
+              type_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        call {
+          function {
+            identifier {
+              name: "C"
+            }
+          }
+          argument {
+            tuple_literal {
+              fields {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      interface {
+        where {
+          base {
+            identifier {
+              name: "B"
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "TB"
+                }
+              }
+              rhs {
+                tuple_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "FB"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              tuple_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "FB"
+                    object {
+                      call {
+                        function {
+                          identifier {
+                            name: "C"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              int_type_literal {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 44 - 0
explorer/fuzzing/fuzzer_corpus/273aab31993dab582bccec3a80de7233e79a8764

@@ -0,0 +1,44 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: true
+          }
+        }
+        statements {
+          return_var_statement {
+          }
+        }
+      }
+    }
+  }
+}

+ 65 - 0
explorer/fuzzing/fuzzer_corpus/2b11b096a3168af04786e118860bff9e01e035da

@@ -0,0 +1,65 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "{0}"
+                      }
+                    }
+                    fields {
+                      struct_literal {
+                        fields {
+                          name: "x"
+                          expression {
+                            int_literal {
+                              value: 1
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 323 - 0
explorer/fuzzing/fuzzer_corpus/2b2f010551966d603bef56c3e3e7cb35c1937bf7

@@ -0,0 +1,323 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    interface {
+      name: "B"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "A"
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "B"
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 2
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "GetAB"
+      param_pattern {
+        fields {
+          generic_binding {
+            name: "T"
+            type {
+              where {
+                base {
+                  identifier {
+                    name: "B"
+                  }
+                }
+                clauses {
+                  is {
+                    type {
+                      designator {
+                        name: "Self"
+                      }
+                    }
+                    constraint {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Add
+                arguments {
+                  operator {
+                    op: Add
+                    arguments {
+                      operator {
+                        op: Mul
+                        arguments {
+                          int_literal {
+                            value: 100
+                          }
+                        }
+                        arguments {
+                          call {
+                            function {
+                              compound_member_access {
+                                object {
+                                  identifier {
+                                    name: "T"
+                                  }
+                                }
+                                path {
+                                  simple_member_access {
+                                    field: "F"
+                                    object {
+                                      identifier {
+                                        name: "A"
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                            argument {
+                              tuple_literal {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      operator {
+                        op: Mul
+                        arguments {
+                          int_literal {
+                            value: 10
+                          }
+                        }
+                        arguments {
+                          call {
+                            function {
+                              compound_member_access {
+                                object {
+                                  identifier {
+                                    name: "T"
+                                  }
+                                }
+                                path {
+                                  simple_member_access {
+                                    field: "F"
+                                    object {
+                                      identifier {
+                                        name: "B"
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                            argument {
+                              tuple_literal {
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                arguments {
+                  call {
+                    function {
+                      simple_member_access {
+                        field: "F"
+                        object {
+                          identifier {
+                            name: "T"
+                          }
+                        }
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "GetAB"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 9 - 4
explorer/fuzzing/fuzzer_corpus/192dc5815905d8b0540486bfc0638c978d20039c → explorer/fuzzing/fuzzer_corpus/2b837161326c7b882bbdd46eeab9e54ad90f714d

@@ -189,7 +189,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -296,7 +296,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       int_literal {
                         value: 0
@@ -395,6 +395,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -431,10 +432,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -507,6 +509,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -545,6 +548,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -591,10 +595,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 52 - 49
explorer/fuzzing/fuzzer_corpus/350c28992cc3659ed0d99c0cd88376346e9958cc → explorer/fuzzing/fuzzer_corpus/2b883d07bdf4c2db174e4ffa42993d1ffad01815

@@ -11,17 +11,17 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -54,17 +54,17 @@ compilation_unit {
           name: "Scale"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -151,17 +151,17 @@ compilation_unit {
               name: "Add"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point1"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point1"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -189,7 +189,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -260,17 +260,17 @@ compilation_unit {
               name: "Scale"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point1"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point1"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -297,7 +297,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -408,17 +408,17 @@ compilation_unit {
               name: "Add"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point2"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point2"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -446,7 +446,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -537,17 +537,17 @@ compilation_unit {
               name: "Scale"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point2"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point2"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -574,7 +574,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -704,7 +704,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -814,7 +814,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               tuple_literal {
                 fields {
@@ -955,6 +955,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -993,6 +994,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -1057,10 +1059,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 0 - 218
explorer/fuzzing/fuzzer_corpus/2baf4d05d30daedf3a9c722b678dea7297d144d5

@@ -1,218 +0,0 @@
-compilation_unit {
-  package_statement {
-    package_name: "ExplorerTest"
-  }
-  is_api: true
-  declarations {
-    alias {
-      name: "AB"
-      target {
-        struct_type_literal {
-          fields {
-            name: "a"
-            expression {
-              int_type_literal {
-              }
-            }
-          }
-          fields {
-            name: "b"
-            expression {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  declarations {
-    alias {
-      name: "BA"
-      target {
-        struct_type_literal {
-          fields {
-            name: "b"
-            expression {
-              int_type_literal {
-              }
-            }
-          }
-          fields {
-            name: "a"
-            expression {
-              int_type_literal {
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  declarations {
-    function {
-      name: "Main"
-      param_pattern {
-      }
-      return_term {
-        kind: Expression
-        type {
-          int_type_literal {
-          }
-        }
-      }
-      body {
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "ab"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "AB"
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            init {
-              struct_literal {
-                fields {
-                  name: "b"
-                  expression {
-                    int_literal {
-                      value: 1
-                    }
-                  }
-                }
-                fields {
-                  name: "a"
-                  expression {
-                    int_literal {
-                      value: 2
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        statements {
-          variable_definition {
-            pattern {
-              binding_pattern {
-                name: "ba"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "BA"
-                      }
-                    }
-                  }
-                }
-              }
-            }
-            init {
-              identifier {
-                name: "ab"
-              }
-            }
-          }
-        }
-        statements {
-          return_statement {
-            expression {
-              operator {
-                op: Add
-                arguments {
-                  operator {
-                    op: Add
-                    arguments {
-                      operator {
-                        op: Add
-                        arguments {
-                          operator {
-                            op: Mul
-                            arguments {
-                              int_literal {
-                                value: 1000
-                              }
-                            }
-                            arguments {
-                              simple_member_access {
-                                field: "a"
-                                object {
-                                  identifier {
-                                    name: "ab"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                        arguments {
-                          operator {
-                            op: Mul
-                            arguments {
-                              int_literal {
-                                value: 100
-                              }
-                            }
-                            arguments {
-                              simple_member_access {
-                                field: "b"
-                                object {
-                                  identifier {
-                                    name: "ab"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      }
-                    }
-                    arguments {
-                      operator {
-                        op: Mul
-                        arguments {
-                          int_literal {
-                            value: 10
-                          }
-                        }
-                        arguments {
-                          simple_member_access {
-                            field: "a"
-                            object {
-                              identifier {
-                                name: "ba"
-                              }
-                            }
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-                arguments {
-                  simple_member_access {
-                    field: "b"
-                    object {
-                      identifier {
-                        name: "ba"
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/3f52afb070ee95235558d20a09b4f4c87c6fed9b → explorer/fuzzing/fuzzer_corpus/2c14058de399008d689923991bc195c29001efcc

@@ -37,7 +37,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 439 - 0
explorer/fuzzing/fuzzer_corpus/2e46c9fba5e11ccb139ac809c7c919439a5b00cf

@@ -0,0 +1,439 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "strings less: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: Less
+                            arguments {
+                              string_literal {
+                                value: "hello"
+                              }
+                            }
+                            arguments {
+                              string_literal {
+                                value: "world"
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ints less: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: Less
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "strings less eq: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: LessEq
+                            arguments {
+                              string_literal {
+                                value: "hello"
+                              }
+                            }
+                            arguments {
+                              string_literal {
+                                value: "world"
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ints less eq: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: LessEq
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "strings greater: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: Greater
+                            arguments {
+                              string_literal {
+                                value: "hello"
+                              }
+                            }
+                            arguments {
+                              string_literal {
+                                value: "world"
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ints greater: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: Greater
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "strings greater eq: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: GreaterEq
+                            arguments {
+                              string_literal {
+                                value: "hello"
+                              }
+                            }
+                            arguments {
+                              string_literal {
+                                value: "world"
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Print"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      string_literal {
+                        value: "ints greater eq: {0}"
+                      }
+                    }
+                    fields {
+                      if_expression {
+                        condition {
+                          operator {
+                            op: GreaterEq
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                            arguments {
+                              int_literal {
+                                value: 1
+                              }
+                            }
+                          }
+                        }
+                        then_expression {
+                          int_literal {
+                            value: 1
+                          }
+                        }
+                        else_expression {
+                          int_literal {
+                            value: 0
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 3 - 3
explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b → explorer/fuzzing/fuzzer_corpus/2ec468114a962bc61ddd735888caecb69d767a13

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -75,7 +75,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   simple_member_access {
                     field: "x"
@@ -137,7 +137,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b → explorer/fuzzing/fuzzer_corpus/2f0d66e7cdd3b7f810d91d332e5c7e3cc796fbfb

@@ -80,6 +80,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -103,10 +104,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 35 - 33
explorer/fuzzing/fuzzer_corpus/127b893cd279bdcff0f2d37493b3e975aa86c4e3 → explorer/fuzzing/fuzzer_corpus/2f88d1825e7b0e71cb625b8ab1beaecd174cd0f8

@@ -26,17 +26,17 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -69,17 +69,17 @@ compilation_unit {
           name: "Scale"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -176,7 +176,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -207,17 +207,17 @@ compilation_unit {
               name: "Add"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -245,7 +245,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -316,17 +316,17 @@ compilation_unit {
               name: "Scale"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -353,7 +353,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -463,7 +463,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -572,6 +572,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -613,10 +614,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 161 - 0
explorer/fuzzing/fuzzer_corpus/3018f242798c2d5dce1556674891b7dc3a3c0dae

@@ -0,0 +1,161 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "swap"
+      deduced_parameters {
+        name: "T"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      deduced_parameters {
+        name: "U"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "tuple"
+            type {
+              expression_pattern {
+                expression {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                    fields {
+                      identifier {
+                        name: "U"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          tuple_literal {
+            fields {
+              identifier {
+                name: "U"
+              }
+            }
+            fields {
+              identifier {
+                name: "T"
+              }
+            }
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              tuple_literal {
+                fields {
+                  index {
+                    object {
+                      identifier {
+                        name: "tuple"
+                      }
+                    }
+                    offset {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                  }
+                }
+                fields {
+                  index {
+                    object {
+                      identifier {
+                        name: "tuple"
+                      }
+                    }
+                    offset {
+                      int_literal {
+                        value: 0
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              index {
+                object {
+                  call {
+                    function {
+                      identifier {
+                        name: "swap"
+                      }
+                    }
+                    argument {
+                      tuple_literal {
+                        fields {
+                          tuple_literal {
+                            fields {
+                              int_literal {
+                                value: 0
+                              }
+                            }
+                            fields {
+                              bool_literal {
+                                value: true
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+                offset {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/fd9996464706e8a5f7a4e4285f7686bba9d87c6f → explorer/fuzzing/fuzzer_corpus/304271293fd1fec0a8ace7f9bccc9a052bc8721c

@@ -32,6 +32,7 @@ compilation_unit {
                 value: 2
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -113,7 +114,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "x"

+ 64 - 62
explorer/fuzzing/fuzzer_corpus/14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c → explorer/fuzzing/fuzzer_corpus/3044f51dca656bab9012816c75a4399873af5dbd

@@ -118,16 +118,16 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  int_type_literal {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -153,7 +153,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   operator {
                     op: Add
@@ -179,16 +179,16 @@ compilation_unit {
           name: "Mul"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  int_type_literal {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -214,7 +214,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   operator {
                     op: Mul
@@ -293,17 +293,17 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -336,17 +336,17 @@ compilation_unit {
           name: "Scale"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -379,17 +379,17 @@ compilation_unit {
           name: "Hold"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -512,7 +512,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -543,17 +543,17 @@ compilation_unit {
               name: "Add"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -581,7 +581,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -652,17 +652,17 @@ compilation_unit {
               name: "Scale"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -689,7 +689,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -750,17 +750,17 @@ compilation_unit {
               name: "Hold"
               me_pattern {
                 binding_pattern {
-                name: "me"
-                type {
-                  expression_pattern {
-                    expression {
-                      identifier {
-                        name: "Point"
+                  name: "me"
+                  type {
+                    expression_pattern {
+                      expression {
+                        identifier {
+                          name: "Point"
+                        }
                       }
                     }
                   }
                 }
-                }
               }
               param_pattern {
                 fields {
@@ -799,7 +799,7 @@ compilation_unit {
               }
               body {
                 statements {
-                  return_statement {
+                  return_expression_statement {
                     expression {
                       struct_literal {
                         fields {
@@ -893,7 +893,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -1025,6 +1025,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -1066,10 +1067,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 3 - 1
explorer/fuzzing/fuzzer_corpus/a18f45983e87cca1451d15aaa490765d630cfb37 → explorer/fuzzing/fuzzer_corpus/307da4f675a3da88878f66b7ad5f5546c1bff202

@@ -112,6 +112,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -147,10 +148,11 @@ compilation_unit {
                 name: "p"
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               int_literal {
                 value: 0

+ 39 - 35
explorer/fuzzing/fuzzer_corpus/df26c1e8e0e4003833b754f9265c211e25e3e9d6 → explorer/fuzzing/fuzzer_corpus/31e244f3fdbe46f75fb7fa775ee282e960b57c0c

@@ -26,17 +26,17 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  identifier {
-                    name: "Self"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -148,7 +148,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   int_literal {
                     value: 0
@@ -164,16 +164,16 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  int_type_literal {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    int_type_literal {
+                    }
                   }
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -199,7 +199,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   operator {
                     op: Add
@@ -276,7 +276,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -333,21 +333,22 @@ compilation_unit {
           name: "Add"
           me_pattern {
             binding_pattern {
-            name: "me"
-            type {
-              expression_pattern {
-                expression {
-                  call {
-                    function {
-                      identifier {
-                        name: "Point"
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    call {
+                      function {
+                        identifier {
+                          name: "Point"
+                        }
                       }
-                    }
-                    argument {
-                      tuple_literal {
-                        fields {
-                          identifier {
-                            name: "U"
+                      argument {
+                        tuple_literal {
+                          fields {
+                            identifier {
+                              name: "U"
+                            }
                           }
                         }
                       }
@@ -356,7 +357,6 @@ compilation_unit {
                 }
               }
             }
-            }
           }
           param_pattern {
             fields {
@@ -410,7 +410,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -578,6 +578,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -645,7 +646,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "total"
@@ -746,7 +747,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {
@@ -836,6 +837,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -886,6 +888,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -939,10 +942,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 129 - 0
explorer/fuzzing/fuzzer_corpus/325183e04a4232e4b1cf2779ca2c7c18ab314a06

@@ -0,0 +1,129 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "p"
+                type {
+                  expression_pattern {
+                    expression {
+                      operator {
+                        op: Ptr
+                        arguments {
+                          int_type_literal {
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              call {
+                function {
+                  simple_member_access {
+                    field: "New"
+                    object {
+                      identifier {
+                        name: "heap"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 5
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "q"
+                type {
+                  expression_pattern {
+                    expression {
+                      operator {
+                        op: Ptr
+                        arguments {
+                          int_type_literal {
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              identifier {
+                name: "p"
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          assign {
+            lhs {
+              operator {
+                op: Deref
+                arguments {
+                  identifier {
+                    name: "q"
+                  }
+                }
+              }
+            }
+            rhs {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              operator {
+                op: Deref
+                arguments {
+                  identifier {
+                    name: "p"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 148 - 2
explorer/fuzzing/fuzzer_corpus/cb515a6f74a44b0f9bfdabbfde50e202ec558b3e → explorer/fuzzing/fuzzer_corpus/329852da9d25572d3551a281f4fce0852ece2534

@@ -3,6 +3,150 @@ compilation_unit {
     package_name: "ExplorerTest"
   }
   is_api: true
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        struct_type_literal {
+          fields {
+            name: "x"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+          fields {
+            name: "y"
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      interface {
+        call {
+          function {
+            identifier {
+              name: "EqWith"
+            }
+          }
+          argument {
+            tuple_literal {
+              fields {
+                identifier {
+                  name: "Self"
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Equal"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "other"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Self"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              bool_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  operator {
+                    op: And
+                    arguments {
+                      operator {
+                        op: Eq
+                        arguments {
+                          simple_member_access {
+                            field: "x"
+                            object {
+                              identifier {
+                                name: "me"
+                              }
+                            }
+                          }
+                        }
+                        arguments {
+                          simple_member_access {
+                            field: "x"
+                            object {
+                              identifier {
+                                name: "other"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      operator {
+                        op: Eq
+                        arguments {
+                          simple_member_access {
+                            field: "y"
+                            object {
+                              identifier {
+                                name: "me"
+                              }
+                            }
+                          }
+                        }
+                        arguments {
+                          simple_member_access {
+                            field: "y"
+                            object {
+                              identifier {
+                                name: "other"
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
   declarations {
     function {
       name: "Main"
@@ -65,6 +209,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -116,6 +261,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -137,7 +283,7 @@ compilation_unit {
             }
             then_block {
               statements {
-                return_statement {
+                return_expression_statement {
                   expression {
                     int_literal {
                       value: 0
@@ -148,7 +294,7 @@ compilation_unit {
             }
             else_block {
               statements {
-                return_statement {
+                return_expression_statement {
                   expression {
                     int_literal {
                       value: 1

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/856e6531e7f9426985261e7163ce6f1fac98fd75 → explorer/fuzzing/fuzzer_corpus/3434928d1dc3a66f3a3f1f44b3937e864ef81f4e

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -126,10 +126,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "x"

+ 69 - 0
explorer/fuzzing/fuzzer_corpus/34d3923f8e4a9ceb3ff3d44e54343b1f31ecfd15

@@ -0,0 +1,69 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    alias {
+      name: "B"
+      target {
+        where {
+          base {
+            identifier {
+              name: "A"
+            }
+          }
+          clauses {
+            is {
+              type {
+                int_type_literal {
+                }
+              }
+              constraint {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/dca5d37a4707f5a0f2480f1b079ab82a1d148006 → explorer/fuzzing/fuzzer_corpus/34d42a476155fee7c60325c55cf14bbe1749c1a0

@@ -47,6 +47,7 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -84,7 +85,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add

+ 3 - 2
explorer/fuzzing/fuzzer_corpus/4bbdab91d8eec9bd70ec8b119788c0e23e3f75ab → explorer/fuzzing/fuzzer_corpus/3598b6a104a952dfc65fad1fbd8f4d14ca233647

@@ -21,7 +21,7 @@ compilation_unit {
           }
           body {
             statements {
-              return_statement {
+              return_expression_statement {
                 expression {
                   struct_literal {
                     fields {
@@ -126,10 +126,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               simple_member_access {
                 field: "x"

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/d6b7c3221459dc162ed6bb981183b8ac85b70b55 → explorer/fuzzing/fuzzer_corpus/360d030d3ed81fd7cb6b56888b0deaf8a8196773

@@ -144,6 +144,7 @@ compilation_unit {
                 name: "k1"
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -165,7 +166,7 @@ compilation_unit {
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               identifier {
                 name: "x"

+ 341 - 0
explorer/fuzzing/fuzzer_corpus/36170fc5efef82cc7db909323cca1c914df5c3e8

@@ -0,0 +1,341 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "SwizzleWith"
+      members {
+        function {
+          name: "Op"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        call {
+          function {
+            identifier {
+              name: "SwizzleWith"
+            }
+          }
+          argument {
+            tuple_literal {
+              fields {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Op"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "Self"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "Self"
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  operator {
+                    op: Add
+                    arguments {
+                      operator {
+                        op: Mul
+                        arguments {
+                          identifier {
+                            name: "me"
+                          }
+                        }
+                        arguments {
+                          int_literal {
+                            value: 10
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      identifier {
+                        name: "x"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F"
+      deduced_parameters {
+        name: "T"
+        type {
+          call {
+            function {
+              identifier {
+                name: "SwizzleWith"
+              }
+            }
+            argument {
+              tuple_literal {
+                fields {
+                  designator {
+                    name: "Self"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "v"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+        fields {
+          binding_pattern {
+            name: "w"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "Op"
+                    object {
+                      identifier {
+                        name: "v"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "w"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "one"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 1
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "two"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 2
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "F"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "one"
+                      }
+                    }
+                    fields {
+                      identifier {
+                        name: "two"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 170 - 0
explorer/fuzzing/fuzzer_corpus/362694fa674b4233cb14a35dae968676dbd303d9

@@ -0,0 +1,170 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      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 {
+          if_statement {
+            condition {
+              operator {
+                op: Eq
+                arguments {
+                  identifier {
+                    name: "a"
+                  }
+                }
+                arguments {
+                  identifier {
+                    name: "b"
+                  }
+                }
+              }
+            }
+            then_block {
+              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 {
+                }
+              }
+            }
+            else_block {
+              statements {
+                return_expression_statement {
+                  expression {
+                    operator {
+                      op: Add
+                      arguments {
+                        identifier {
+                          name: "a"
+                        }
+                      }
+                      arguments {
+                        identifier {
+                          name: "b"
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      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
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 41 - 0
explorer/fuzzing/fuzzer_corpus/373731d03672f31b356f0068a9680c6b03d87cd0

@@ -0,0 +1,41 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    alias {
+      name: "a"
+      target {
+        identifier {
+          name: "a"
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/e080ed5c98dbf7596eff953be7d16264e1432e2e → explorer/fuzzing/fuzzer_corpus/3852c46698bc370c1d570425b5ec4173db293008

@@ -36,6 +36,7 @@ compilation_unit {
                 value: 0
               }
             }
+            is_returned: false
           }
         }
         statements {
@@ -67,7 +68,7 @@ compilation_unit {
                 }
               }
               statements {
-                return_statement {
+                return_expression_statement {
                   expression {
                     identifier {
                       name: "x"

+ 63 - 0
explorer/fuzzing/fuzzer_corpus/391137139a4e8562e68024f65f38a043a493931b

@@ -0,0 +1,63 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "x"
+              }
+            }
+            rhs {
+              int_literal {
+                value: 1
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 2
explorer/fuzzing/fuzzer_corpus/049f6e3a81538ad088e95b45ce1bb1849cb7ea09 → explorer/fuzzing/fuzzer_corpus/393c83aa4523f0b25cddec59dfc59911b0edaa53

@@ -39,7 +39,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Add
@@ -74,7 +74,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               call {
                 function {

+ 206 - 0
explorer/fuzzing/fuzzer_corpus/393e58a1743cf2f0b3d90112ce1591e420209994

@@ -0,0 +1,206 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    class_declaration {
+      name: "A"
+      members {
+        function {
+          name: "F"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  operator {
+                    op: Add
+                    arguments {
+                      call {
+                        function {
+                          identifier {
+                            name: "G"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                          }
+                        }
+                      }
+                    }
+                    arguments {
+                      call {
+                        function {
+                          simple_member_access {
+                            field: "H"
+                            object {
+                              identifier {
+                                name: "me"
+                              }
+                            }
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "G"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "H"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 2
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "a"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_type_literal {
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "F"
+                    object {
+                      identifier {
+                        name: "a"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 2 - 1
explorer/fuzzing/fuzzer_corpus/0aaa138320ae521ac62573912738cae88d71f96e → explorer/fuzzing/fuzzer_corpus/39e350656615be34b022ac0a977d0c1e164e30b3

@@ -87,10 +87,11 @@ compilation_unit {
                 }
               }
             }
+            is_returned: false
           }
         }
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               operator {
                 op: Sub

+ 252 - 0
explorer/fuzzing/fuzzer_corpus/39f118ee2121de551414b80dca0c8daa35c3b987

@@ -0,0 +1,252 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "I"
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "I"
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F"
+      param_pattern {
+        fields {
+          generic_binding {
+            name: "A"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "B"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "C"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "D"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "E"
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+        fields {
+          generic_binding {
+            name: "T"
+            type {
+              where {
+                base {
+                  identifier {
+                    name: "I"
+                  }
+                }
+                clauses {
+                  equals {
+                    lhs {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                    rhs {
+                      identifier {
+                        name: "B"
+                      }
+                    }
+                  }
+                }
+                clauses {
+                  equals {
+                    lhs {
+                      identifier {
+                        name: "C"
+                      }
+                    }
+                    rhs {
+                      identifier {
+                        name: "D"
+                      }
+                    }
+                  }
+                }
+                clauses {
+                  equals {
+                    lhs {
+                      identifier {
+                        name: "C"
+                      }
+                    }
+                    rhs {
+                      identifier {
+                        name: "E"
+                      }
+                    }
+                  }
+                }
+                clauses {
+                  equals {
+                    lhs {
+                      identifier {
+                        name: "B"
+                      }
+                    }
+                    rhs {
+                      identifier {
+                        name: "D"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Omitted
+      }
+      body {
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "F"
+                    object {
+                      identifier {
+                        name: "T"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "F"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_literal {
+                        value: 1
+                      }
+                    }
+                    fields {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 1 - 1
explorer/fuzzing/fuzzer_corpus/571c33b9a350801317b68253d4fdc913966e4a92 → explorer/fuzzing/fuzzer_corpus/3a199e4c448aae1bd87fde47f5b4cea243be26ec

@@ -17,7 +17,7 @@ compilation_unit {
       }
       body {
         statements {
-          return_statement {
+          return_expression_statement {
             expression {
               compound_member_access {
                 object {

+ 227 - 0
explorer/fuzzing/fuzzer_corpus/3a1da05a244c47594a645929ded6293a983044c2

@@ -0,0 +1,227 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "Iface"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "N"
+              type {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "PickType"
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "N"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          type_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "F"
+      deduced_parameters {
+        name: "T"
+        type {
+          identifier {
+            name: "Iface"
+          }
+        }
+      }
+      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: "x"
+                type {
+                  expression_pattern {
+                    expression {
+                      call {
+                        function {
+                          identifier {
+                            name: "PickType"
+                          }
+                        }
+                        argument {
+                          tuple_literal {
+                            fields {
+                              simple_member_access {
+                                field: "N"
+                                object {
+                                  identifier {
+                                    name: "T"
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              identifier {
+                name: "x"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        where {
+          base {
+            identifier {
+              name: "Iface"
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "N"
+                }
+              }
+              rhs {
+                int_literal {
+                  value: 5
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "F"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      int_literal {
+                        value: 0
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 267 - 0
explorer/fuzzing/fuzzer_corpus/3a20fc1c6b51cce8138ebe64a908efb25b1af754

@@ -0,0 +1,267 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "A"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    interface {
+      name: "B"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Get"
+      deduced_parameters {
+        name: "T"
+        type {
+          operator {
+            op: BitwiseAnd
+            arguments {
+              identifier {
+                name: "A"
+              }
+            }
+            arguments {
+              identifier {
+                name: "B"
+              }
+            }
+          }
+        }
+      }
+      param_pattern {
+        fields {
+          binding_pattern {
+            name: "n"
+            type {
+              expression_pattern {
+                expression {
+                  identifier {
+                    name: "T"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  simple_member_access {
+                    field: "F"
+                    object {
+                      identifier {
+                        name: "n"
+                      }
+                    }
+                  }
+                }
+                argument {
+                  tuple_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "A"
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 1
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: InternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        identifier {
+          name: "B"
+        }
+      }
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Expression
+            type {
+              int_type_literal {
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  int_literal {
+                    value: 2
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "z"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              int_literal {
+                value: 0
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              call {
+                function {
+                  identifier {
+                    name: "Get"
+                  }
+                }
+                argument {
+                  tuple_literal {
+                    fields {
+                      identifier {
+                        name: "z"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 231 - 0
explorer/fuzzing/fuzzer_corpus/3a474b4f07864125949f0ad5c1e9f1d2bdab5f61

@@ -0,0 +1,231 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    class_declaration {
+      name: "A"
+      members {
+        variable {
+          binding {
+            name: "n"
+            type {
+              expression_pattern {
+                expression {
+                  int_type_literal {
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        identifier {
+          name: "A"
+        }
+      }
+      interface {
+        where {
+          base {
+            call {
+              function {
+                identifier {
+                  name: "ModWith"
+                }
+              }
+              argument {
+                tuple_literal {
+                  fields {
+                    int_type_literal {
+                    }
+                  }
+                }
+              }
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "Result"
+                }
+              }
+              rhs {
+                identifier {
+                  name: "A"
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        function {
+          name: "Op"
+          me_pattern {
+            binding_pattern {
+              name: "me"
+              type {
+                expression_pattern {
+                  expression {
+                    identifier {
+                      name: "Self"
+                    }
+                  }
+                }
+              }
+            }
+          }
+          param_pattern {
+            fields {
+              binding_pattern {
+                name: "rhs"
+                type {
+                  expression_pattern {
+                    expression {
+                      int_type_literal {
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+          return_term {
+            kind: Expression
+            type {
+              identifier {
+                name: "A"
+              }
+            }
+          }
+          body {
+            statements {
+              return_expression_statement {
+                expression {
+                  struct_literal {
+                    fields {
+                      name: "n"
+                      expression {
+                        operator {
+                          op: Mod
+                          arguments {
+                            simple_member_access {
+                              field: "n"
+                              object {
+                                identifier {
+                                  name: "me"
+                                }
+                              }
+                            }
+                          }
+                          arguments {
+                            identifier {
+                              name: "rhs"
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          variable_definition {
+            pattern {
+              binding_pattern {
+                name: "a"
+                type {
+                  expression_pattern {
+                    expression {
+                      identifier {
+                        name: "A"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+            init {
+              struct_literal {
+                fields {
+                  name: "n"
+                  expression {
+                    int_literal {
+                      value: 5
+                    }
+                  }
+                }
+              }
+            }
+            is_returned: false
+          }
+        }
+        statements {
+          assign {
+            lhs {
+              identifier {
+                name: "a"
+              }
+            }
+            rhs {
+              operator {
+                op: Mod
+                arguments {
+                  identifier {
+                    name: "a"
+                  }
+                }
+                arguments {
+                  int_literal {
+                    value: 2
+                  }
+                }
+              }
+            }
+          }
+        }
+        statements {
+          return_expression_statement {
+            expression {
+              simple_member_access {
+                field: "n"
+                object {
+                  identifier {
+                    name: "a"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 48 - 0
explorer/fuzzing/fuzzer_corpus/3a56c95203d25effc213b596eeb3eeb9c01682e2

@@ -0,0 +1,48 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    class_declaration {
+      name: "C"
+      members {
+        function {
+          name: "F"
+          param_pattern {
+          }
+          return_term {
+            kind: Omitted
+          }
+          body {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 126 - 0
explorer/fuzzing/fuzzer_corpus/3a5710e0ed83a9904c82c71dad7f7aee4cff6811

@@ -0,0 +1,126 @@
+compilation_unit {
+  package_statement {
+    package_name: "ExplorerTest"
+  }
+  is_api: true
+  declarations {
+    interface {
+      name: "HasThreeTypes"
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "A"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "B"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      members {
+        let {
+          pattern {
+            generic_binding {
+              name: "C"
+              type {
+                type_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+      self {
+        name: "Self"
+        type {
+          type_type_literal {
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    impl {
+      kind: ExternalImpl
+      impl_type {
+        int_type_literal {
+        }
+      }
+      interface {
+        where {
+          base {
+            identifier {
+              name: "HasThreeTypes"
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "A"
+                }
+              }
+              rhs {
+                int_type_literal {
+                }
+              }
+            }
+          }
+          clauses {
+            equals {
+              lhs {
+                designator {
+                  name: "C"
+                }
+              }
+              rhs {
+                int_type_literal {
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  declarations {
+    function {
+      name: "Main"
+      param_pattern {
+      }
+      return_term {
+        kind: Expression
+        type {
+          int_type_literal {
+          }
+        }
+      }
+      body {
+        statements {
+          return_expression_statement {
+            expression {
+              int_literal {
+                value: 0
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

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