فهرست منبع

Fuzz semantics when it passes parsing without errors. (#3003)

Right now we expect crashes on invalid parses, we just don't try to
handle it in general even though the long-term intent is we should
handle semantics for bad parses. However, in theory, we should be
correctly handling code that parses as valid and that's probably more
interesting to fix bugs for. So this starts trying to fuzz that space of
valid parses.

Fuzzer corpus is based on explorer tests, with one merge run.
Jon Ross-Perkins 2 سال پیش
والد
کامیت
907fa82fc6
100فایلهای تغییر یافته به همراه2305 افزوده شده و 0 حذف شده
  1. 12 0
      toolchain/semantics/BUILD
  2. 19 0
      toolchain/semantics/fuzzer_corpus/005cacf2254cee9c357347503a715e3b680b7284
  3. 15 0
      toolchain/semantics/fuzzer_corpus/010856053137c0432260e9145d6f171ae227c715
  4. 14 0
      toolchain/semantics/fuzzer_corpus/0112278cfd21507f5266dfd89b7dc51a6ea801b3
  5. 17 0
      toolchain/semantics/fuzzer_corpus/01cd4d9d3357b42f67e7b85e3b971ade1ab4a3d5
  6. 44 0
      toolchain/semantics/fuzzer_corpus/03a9b31a0b80b5c661d405b654a51932bf3dabad
  7. 22 0
      toolchain/semantics/fuzzer_corpus/0447b0030b48fa60d3d9f9c9163d05acd789796f
  8. 26 0
      toolchain/semantics/fuzzer_corpus/0686bcb78820140c8d024e5b7d35adaa5eec3621
  9. 16 0
      toolchain/semantics/fuzzer_corpus/08187c797a711bdfbd1e48edcba3d9102766cb9d
  10. 22 0
      toolchain/semantics/fuzzer_corpus/086087f87f7a0618c32aaf7e1d9fb0408e54a448
  11. 18 0
      toolchain/semantics/fuzzer_corpus/0896c31a99907299ead911e234074c472a70de30
  12. 15 0
      toolchain/semantics/fuzzer_corpus/08ea37d96dee020359a3cd25344d9b33b23fbe8c
  13. 16 0
      toolchain/semantics/fuzzer_corpus/091db65a1b8f6119b3ba148eccc667ac14e7b9b5
  14. 33 0
      toolchain/semantics/fuzzer_corpus/0a16a746ed273e210abe5ee6cd3c63a475479a39
  15. 18 0
      toolchain/semantics/fuzzer_corpus/0ad9d1e319b4e0ff9813edf6706823127c78cca5
  16. 16 0
      toolchain/semantics/fuzzer_corpus/0c6afa669d8b0036a28c74fa19c7370515938300
  17. 13 0
      toolchain/semantics/fuzzer_corpus/0d8919c02ea985fe0c9e02b75d4d01ac98e1ada7
  18. 14 0
      toolchain/semantics/fuzzer_corpus/0e4dff74694458253dfba70df99260d46c4f7049
  19. 42 0
      toolchain/semantics/fuzzer_corpus/0f16578e125b372618b0f999fa14d20e64baa5c5
  20. 23 0
      toolchain/semantics/fuzzer_corpus/0f51cb18d302c1493cbf5389ca74fa97a49090c5
  21. 41 0
      toolchain/semantics/fuzzer_corpus/1016cb8abba49330ca337c3c650f8b887a8eec56
  22. 19 0
      toolchain/semantics/fuzzer_corpus/105bf041eb0ec468660023a131981170036c4aa4
  23. 28 0
      toolchain/semantics/fuzzer_corpus/10d1744fbabedd2d7b67aeeba5ccfad33dde54eb
  24. 17 0
      toolchain/semantics/fuzzer_corpus/10ed248ac6874c3c6ee8fed1ffff5e2d4f0c5ec5
  25. 17 0
      toolchain/semantics/fuzzer_corpus/1171a926d8aa677aec7042fe5f9e29c1632f5300
  26. 14 0
      toolchain/semantics/fuzzer_corpus/119ac0fd33bccc1f9d8d4c78f485db62b8261039
  27. 16 0
      toolchain/semantics/fuzzer_corpus/119e4e694e8b998c45200f2f9bba291c8f18de86
  28. 45 0
      toolchain/semantics/fuzzer_corpus/1259d0decfb6c2fd6808fda42a9654bbad1640de
  29. 16 0
      toolchain/semantics/fuzzer_corpus/128de0e2a70878988fcd7bf60bdd862ef764b92f
  30. 19 0
      toolchain/semantics/fuzzer_corpus/12b34eb2c07d14c7b6c964bed06d9cd9b295570a
  31. 17 0
      toolchain/semantics/fuzzer_corpus/137565f0078baddcd33c03bcb752cd91e0c15195
  32. 17 0
      toolchain/semantics/fuzzer_corpus/13936e89e497ed4f7b0555ad0fe8142c71385208
  33. 24 0
      toolchain/semantics/fuzzer_corpus/1397a4fbdf1addb0892345321c7fbc14adf77b4c
  34. 14 0
      toolchain/semantics/fuzzer_corpus/14bf3c7665fe5282a469b474df3d2485550adbd4
  35. 19 0
      toolchain/semantics/fuzzer_corpus/1554c1eb73ff3932ad2e83351d6b0c98fca9492c
  36. 12 0
      toolchain/semantics/fuzzer_corpus/164cd743faa60d9495a35aeeaaac5ebcbaaed5c8
  37. 22 0
      toolchain/semantics/fuzzer_corpus/17ec5002557db4205de08c6daad9a3f6cb529076
  38. 46 0
      toolchain/semantics/fuzzer_corpus/188ed5d12d9c374702dfc38ab438dfe4b8cbabfd
  39. 19 0
      toolchain/semantics/fuzzer_corpus/18ec728eade91679104b23c3a949271089132321
  40. 16 0
      toolchain/semantics/fuzzer_corpus/1913a5458321a159544fff949d3f7b0f9d52065a
  41. 21 0
      toolchain/semantics/fuzzer_corpus/19d6f8cf04b59808515a78af96abc89cd4c2583e
  42. 14 0
      toolchain/semantics/fuzzer_corpus/1ad7c0030d4448143955e4e047868426e46a08e6
  43. 14 0
      toolchain/semantics/fuzzer_corpus/1af0cf0cfeabefdff968d557c1b67a32a424f357
  44. 44 0
      toolchain/semantics/fuzzer_corpus/1b5911a616ba8ae35eb39f855270fa9b766c3afc
  45. 34 0
      toolchain/semantics/fuzzer_corpus/1c939f5777f53aaf53300f4e54c1f2380b8b4f6a
  46. 37 0
      toolchain/semantics/fuzzer_corpus/1d5b8ef87c518dfd90dfaf7e98886a4ef791ab93
  47. 55 0
      toolchain/semantics/fuzzer_corpus/1d6d70723cfa13913d715a7ba2d7efa03d521df9
  48. 25 0
      toolchain/semantics/fuzzer_corpus/1dddc76f0ab71e0db413ccbd3eb8440ce69fe0e0
  49. 18 0
      toolchain/semantics/fuzzer_corpus/1e4c94040dcf313929b6e45bb96932198f296d9e
  50. 16 0
      toolchain/semantics/fuzzer_corpus/1ee86793bb703120496039d708f7562e9abfbc5c
  51. 13 0
      toolchain/semantics/fuzzer_corpus/1f287f6a07c7bf4e14bd2563f2877e1ca28c52c3
  52. 46 0
      toolchain/semantics/fuzzer_corpus/1fc793d170552ec217bfa6554c43444b5bc1a30d
  53. 18 0
      toolchain/semantics/fuzzer_corpus/2038a206d7fa99068235bb2ba54820e768b29cb9
  54. 13 0
      toolchain/semantics/fuzzer_corpus/20bbc444ffd3b0a688732fe0aa1eeff6969c33cc
  55. 12 0
      toolchain/semantics/fuzzer_corpus/21e0d305628d54204f02591a43b61527cda5d976
  56. 21 0
      toolchain/semantics/fuzzer_corpus/22d9a3333ee8d54f7e1233bf62920026ca8f3a1d
  57. 13 0
      toolchain/semantics/fuzzer_corpus/23e9f18ca5b5c85f4a44e3c472bbd23d1420013b
  58. 14 0
      toolchain/semantics/fuzzer_corpus/2464b8df7ccb3280edff4bce116483b5b165a953
  59. 31 0
      toolchain/semantics/fuzzer_corpus/25337ce57e0a62b2091a8b41a217cc54d65d0d80
  60. 13 0
      toolchain/semantics/fuzzer_corpus/25502eb01b8fec80bd8f99258c8e2c4db7ebd1dd
  61. 19 0
      toolchain/semantics/fuzzer_corpus/2552f1d3328f74b706d9138c53a14ff62b3b6bb3
  62. 16 0
      toolchain/semantics/fuzzer_corpus/26ce51c2c7f8a1d9f1b0c03722e8619f4e6eb1a5
  63. 44 0
      toolchain/semantics/fuzzer_corpus/27b81cef471374f0e9d02dcf2be5e79e45c0de2c
  64. 22 0
      toolchain/semantics/fuzzer_corpus/28720cdeeeba8921f97c137876b6dbe6e2a3225f
  65. 20 0
      toolchain/semantics/fuzzer_corpus/291af82d79bec74264cef40a43fcd6198593d0b5
  66. 16 0
      toolchain/semantics/fuzzer_corpus/292afba18cbb0ca2936ed77ebc79534ac76eeea4
  67. 19 0
      toolchain/semantics/fuzzer_corpus/29366dc2c3a372bec197172efb4c3b245a6b6e95
  68. 19 0
      toolchain/semantics/fuzzer_corpus/293b69131b73f32057424dee21a24ea04530399a
  69. 13 0
      toolchain/semantics/fuzzer_corpus/299dc67e6adcc047d41fb7c54c8733ae1f5a730f
  70. 13 0
      toolchain/semantics/fuzzer_corpus/2c68b43d8a3accf3dffde64ee1346170c321cf8a
  71. 20 0
      toolchain/semantics/fuzzer_corpus/2c8bd9d51c37b6e039d31465180dcd971e372a33
  72. 18 0
      toolchain/semantics/fuzzer_corpus/2cd24a29608035201b59f604b1c06ffd230df13e
  73. 75 0
      toolchain/semantics/fuzzer_corpus/2e7f4e15df56d8a05046d80c7a7ce01e6cb6779b
  74. 18 0
      toolchain/semantics/fuzzer_corpus/2f13aa997ff8ff9e53fa3e0d38fd27ff214319d9
  75. 16 0
      toolchain/semantics/fuzzer_corpus/2f1e5bc51212e421a902e31273599bea2ede8c62
  76. 21 0
      toolchain/semantics/fuzzer_corpus/2fb9acfa600396821f70f238b1c20f95e40a25b9
  77. 19 0
      toolchain/semantics/fuzzer_corpus/30243c0f830ca810070c9dc52e11026d673fd3de
  78. 30 0
      toolchain/semantics/fuzzer_corpus/3079f1de829d6dad1caef247d2d2965ab0a2233f
  79. 17 0
      toolchain/semantics/fuzzer_corpus/307b97c6b60b4f05d53a656201995e1fb502af02
  80. 15 0
      toolchain/semantics/fuzzer_corpus/3161b5f7fb9fc09982d28e2255f3d2ae27fc5ce1
  81. 13 0
      toolchain/semantics/fuzzer_corpus/31e0e6f587bdffffc37922b7b3f771680232bb31
  82. 56 0
      toolchain/semantics/fuzzer_corpus/31ef33085e7420998380c7dd66d8529ad975f7a4
  83. 43 0
      toolchain/semantics/fuzzer_corpus/3246530de7e46a174acd24fd87d38695fd5e36c9
  84. 17 0
      toolchain/semantics/fuzzer_corpus/326f616ba0e75fe934290f59801ffeecb97fad51
  85. 13 0
      toolchain/semantics/fuzzer_corpus/328768bbd4cee309586c935aa27bedf19202ef39
  86. 16 0
      toolchain/semantics/fuzzer_corpus/32ab1efa550be4f04cc3d07bf05a8804d09b754b
  87. 15 0
      toolchain/semantics/fuzzer_corpus/33346b680817ff4c2a003195a0a712daee297f8f
  88. 22 0
      toolchain/semantics/fuzzer_corpus/347494c3bd46b47f162b4abe214f5f71881dd126
  89. 25 0
      toolchain/semantics/fuzzer_corpus/34d5a979143e2dac42a721445d89d3681f13f4cd
  90. 52 0
      toolchain/semantics/fuzzer_corpus/34ff001dd827e172826dd1a040df88b4f7d15a01
  91. 27 0
      toolchain/semantics/fuzzer_corpus/35538f6224efb57c9edb0fa3da9f3679a1a1ceed
  92. 32 0
      toolchain/semantics/fuzzer_corpus/36717d4dda9919479b60d7150b62df44499a51fd
  93. 23 0
      toolchain/semantics/fuzzer_corpus/36b957f732d3b3eb30b528c109683f3ff3e738f9
  94. 16 0
      toolchain/semantics/fuzzer_corpus/374e96ca0653e9f238dad0aa53e6d8243460302e
  95. 17 0
      toolchain/semantics/fuzzer_corpus/3974726c6015a615360574cb1221200e183175c2
  96. 15 0
      toolchain/semantics/fuzzer_corpus/3a4ba37f94cf21edb7969ed61c1fea9a0f3eb56c
  97. 66 0
      toolchain/semantics/fuzzer_corpus/3bddb2be6780b792248656a086347171ecca2f1d
  98. 26 0
      toolchain/semantics/fuzzer_corpus/3def80179ffa13dd5984676ace7c0d8e9cac2031
  99. 23 0
      toolchain/semantics/fuzzer_corpus/3e51c009c54026d5e2cbbfe253b38765d4e71c63
  100. 13 0
      toolchain/semantics/fuzzer_corpus/3fa85a4f6a6e080e9c47b7de21848308a54fb12d

+ 12 - 0
toolchain/semantics/BUILD

@@ -2,6 +2,7 @@
 # Exceptions. See /LICENSE for license information.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+load("//bazel/fuzzing:rules.bzl", "cc_fuzz_test")
 load("//bazel/sh_run:rules.bzl", "glob_sh_run")
 load("//testing/file_test:rules.bzl", "file_test")
 
@@ -115,6 +116,17 @@ file_test(
     ],
 )
 
+cc_fuzz_test(
+    name = "semantics_fuzzer",
+    size = "small",
+    srcs = ["semantics_fuzzer.cpp"],
+    corpus = glob(["fuzzer_corpus/*"]),
+    deps = [
+        "//toolchain/driver",
+        "@llvm-project//llvm:Support",
+    ],
+)
+
 glob_sh_run(
     args = [
         "$(location //toolchain/driver:carbon)",

+ 19 - 0
toolchain/semantics/fuzzer_corpus/005cacf2254cee9c357347503a715e3b680b7284

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn CompareStr(s: String) -> i32 {
+  if (s == "str\n") {
+    return 0;
+  }
+  return 1;
+}
+
+fn Main() -> i32 {
+  return CompareStr("str\n");
+}

+ 15 - 0
toolchain/semantics/fuzzer_corpus/010856053137c0432260e9145d6f171ae227c715

@@ -0,0 +1,15 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var t2: {.x: i32, .y: i32} = {.x = 2, .y = 5};
+  t2.y = 3;
+  // 3 - 2 - 1
+  return t2.y - t2.x - 1;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/0112278cfd21507f5266dfd89b7dc51a6ea801b3

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  returned var x: i32;
+  x = 1;
+  return var;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/01cd4d9d3357b42f67e7b85e3b971ade1ab4a3d5

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 5
+
+package ExplorerTest api;
+
+class A {
+  var n: i32;
+  fn Get[self: Self]() -> i32 { return self.n; }
+}
+
+fn Main() -> i32 {
+  return ({.n = 5} as A).Get();
+}

+ 44 - 0
toolchain/semantics/fuzzer_corpus/03a9b31a0b80b5c661d405b654a51932bf3dabad

@@ -0,0 +1,44 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface HasTypes {
+  let A:! type;
+  let B:! type;
+  let C:! type;
+  let D:! type;
+  let E:! type;
+  let F:! type;
+}
+
+interface HasParams(A:! type, B:! type, C:! type, D:! type) {
+  let V:! HasTypes;
+}
+
+// Here we discover that there is a rewrite for `HasParams(...).V` only after
+// substitution converts each one to `HasParam(X, X, X, X).V`.
+fn F[X:! (HasTypes & HasParams(.Self, .Self, .Self, .Self)) where
+       .Self impls HasParams(.A, .A, .A, .A) and
+       .Self impls HasParams(.B, .B, .B, .B) and
+       .Self impls HasParams(.C, .C, .C, .C) and
+       .Self impls HasParams(.D, .D, .D, .D) and
+       .Self impls HasParams(.E, .E, .E, .E) and
+       .F = .Self.(HasParams(.E, .E, .E, .E).V).A and
+       .E = .Self.(HasParams(.D, .D, .D, .D).V).A and
+       .D = .Self.(HasParams(.C, .C, .C, .C).V).A and
+       .C = .Self.(HasParams(.B, .B, .B, .B).V).A and
+       .B = .Self.(HasParams(.A, .A, .A, .A).V).A and
+       .A = .Self and .V = .Self](x: X) -> X.F { return x; }
+
+impl i32 as HasTypes
+  where .A = .B and .B = .C and .C = .D and .D = .E and .E = .F and .F = i32 {}
+impl i32 as HasParams(i32, i32, i32, i32) where .V = i32 {}
+
+fn Main() -> i32 {
+  return F(0);
+}

+ 22 - 0
toolchain/semantics/fuzzer_corpus/0447b0030b48fa60d3d9f9c9163d05acd789796f

@@ -0,0 +1,22 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+package ExplorerTest api;
+
+__mixin M1 {
+  fn F1[self: Self](x: Self) -> Self{
+     return x;
+  }
+  // CHECK:STDERR: COMPILATION ERROR: fail_recursive_mixing.carbon:[[@LINE+1]]: incomplete mixin `M1` used in mix declaration
+  __mix M1;
+}
+
+class C {
+  __mix M1;
+}
+
+fn Main() -> i32 {
+  return 0;
+}

+ 26 - 0
toolchain/semantics/fuzzer_corpus/0686bcb78820140c8d024e5b7d35adaa5eec3621

@@ -0,0 +1,26 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+choice Ints {
+  None,
+  One(i32),
+  Two(i32, i32)
+}
+
+fn Main() -> i32 {
+  let (var Ints.Two(a1: auto, var a2: auto),
+       ((b: auto, var c: auto), var (d: auto, e: auto))) =
+      (Ints.Two(1, 10), ((2, 3), (4, 5)));
+  a1 = 0;
+  a2 = 0;
+  c = 0;
+  d = 0;
+  e = 0;
+  return 0;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/08187c797a711bdfbd1e48edcba3d9102766cb9d

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn ReturnSecond(_: i32, x: i32) -> i32 {
+  return x;
+}
+
+fn Main() -> i32 {
+  return ReturnSecond(1, 0);
+}

+ 22 - 0
toolchain/semantics/fuzzer_corpus/086087f87f7a0618c32aaf7e1d9fb0408e54a448

@@ -0,0 +1,22 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class Point(T:! type) {
+  fn Create(x: T, y: T) -> Point(T) {
+    return {.x = x, .y = y};
+  }
+
+  var x: T;
+  var y: T;
+}
+
+fn Main() -> i32 {
+  // CHECK:STDERR: COMPILATION ERROR: fail_generic_class_arg.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
+  var p: Point(i32) = Point(i32, i32).Create(0, 1);
+  return p.x;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/0896c31a99907299ead911e234074c472a70de30

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+// Test a global variable depending on another global.
+
+var x: i32 = 0;
+
+var y: i32 = x;
+
+fn Main() -> i32 {
+  return y;
+}

+ 15 - 0
toolchain/semantics/fuzzer_corpus/08ea37d96dee020359a3cd25344d9b33b23fbe8c

@@ -0,0 +1,15 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: SYNTAX ERROR: fail_newline.carbon:[[@LINE+2]]: missing closing quote in single-line string: "new
+  // CHECK:STDERR:
+  Print("new
+line");
+  return 0;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/091db65a1b8f6119b3ba148eccc667ac14e7b9b5

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn snd[T:! type](x: i32, y: T) -> T {
+  return y;
+}
+
+fn Main() -> i32 {
+  return snd(0, 1);
+}

+ 33 - 0
toolchain/semantics/fuzzer_corpus/0a16a746ed273e210abe5ee6cd3c63a475479a39

@@ -0,0 +1,33 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+interface Iface {
+  let T:! type;
+}
+
+fn F[T:! Iface where .T == i32](x: T) {}
+
+fn G[U:! Iface where .T == i32](x: U) {
+  F(x);
+}
+
+fn H[V:! Iface](x: V) {
+  // CHECK:STDERR: COMPILATION ERROR: fail_equal_to_dependent_type.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (V).(Iface.T)) == i32, which is not known to be true
+  F(x);
+}
+
+class Class {
+  extend impl as Iface where .T = i32 {}
+}
+
+fn Main() -> i32 {
+  var x: Class = {};
+  G(x);
+  H(x);
+  return 0;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/0ad9d1e319b4e0ff9813edf6706823127c78cca5

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  returned var x: i32 = 1;
+  if (true) {
+    var x: i32 = 2;
+    return var;
+  }
+  x = 3;
+  return var;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/0c6afa669d8b0036a28c74fa19c7370515938300

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class C {}
+
+// CHECK:STDERR: COMPILATION ERROR: fail_combine_rhs.carbon:[[@LINE+1]]: expected a constraint in second operand of `&`, found class C
+fn F[T:! type & C]();
+
+fn Main() -> i32 {
+  return 0;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/0d8919c02ea985fe0c9e02b75d4d01ac98e1ada7

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: COMPILATION ERROR: fail_no_impl.carbon:[[@LINE+1]]: i32 is not equality comparable with String (could not find implementation of interface EqWith(U = String) for i32)
+  Print("different types equal: {0}", if 1 == "1" then 1 else 0);
+  return 0;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/0e4dff74694458253dfba70df99260d46c4f7049

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: i32;
+  // CHECK:STDERR: COMPILATION ERROR: fail_compound_assign.carbon:[[@LINE+1]]: use of uninitialized variable x
+  x += 1;
+  return x;
+}

+ 42 - 0
toolchain/semantics/fuzzer_corpus/0f16578e125b372618b0f999fa14d20e64baa5c5

@@ -0,0 +1,42 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: A
+// CHECK:STDOUT: c.a: 1
+// CHECK:STDOUT: c.b: 2
+// CHECK:STDOUT: c.c: 3
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class A {
+  fn FunctionA() {}
+  var a: i32;
+  var aa: String;
+}
+
+base class B {
+  extend base: A;
+  fn FunctionB() {}
+  var b: i32;
+}
+
+class C {
+  extend base: B;
+  fn FunctionC() {}
+  var c: i32;
+}
+
+fn Main() -> i32 {
+  var c: C = {.base={.base={.aa="A", .a=1}, .b=2, }, .c=3};
+  c.FunctionA();
+  c.FunctionB();
+  c.FunctionC();
+  Print(c.aa);
+  Print("c.a: {0}", c.a);
+  Print("c.b: {0}", c.b);
+  Print("c.c: {0}", c.c);
+  return 0;
+}

+ 23 - 0
toolchain/semantics/fuzzer_corpus/0f51cb18d302c1493cbf5389ca74fa97a49090c5

@@ -0,0 +1,23 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+class Point(T:! type, V:! T) {
+  fn Get[self: Self]() -> T {
+    return V;
+  }
+}
+
+fn F(p: Point(i32, 1)) -> i32 {
+  return p.Get();
+}
+
+fn Main() -> i32 {
+  var v: Point(i32, 1) = {};
+  return F(v);
+}

+ 41 - 0
toolchain/semantics/fuzzer_corpus/1016cb8abba49330ca337c3c650f8b887a8eec56

@@ -0,0 +1,41 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface Vector {
+  fn Add[self: Self](b: Self) -> Self;
+  fn Scale[self: Self](v: i32) -> Self;
+}
+
+class Point {
+  var x: i32;
+  var y: i32;
+  extend impl as Vector {
+    fn Add[self: Point](b: Point) -> Point {
+      return {.x = self.x + b.x, .y = self.y + b.y};
+    }
+    fn Scale[self: Point](v: i32) -> Point {
+      return {.x = self.x * v, .y = self.y * v};
+    }
+  }
+}
+
+fn ScaleGeneric[U:! Vector](c: U, s: i32) -> U {
+  return c.Scale(s);
+}
+
+fn AddAndScaleGeneric[T:! Vector](a: T, b: T, s: i32) -> T {
+  return ScaleGeneric(a.Add(b), s);
+}
+
+fn Main() -> i32 {
+  var a: Point = {.x = 1, .y = 1};
+  var b: Point = {.x = 2, .y = 3};
+  var p: Point = AddAndScaleGeneric(a, b, 5);
+  return p.x - 15;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/105bf041eb0ec468660023a131981170036c4aa4

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn CompareStr(s: String) -> i32 {
+  if (s == ##"str"##) {
+    return 0;
+  }
+  return 1;
+}
+
+fn Main() -> i32 {
+  return CompareStr(#####"str"#####);
+}

+ 28 - 0
toolchain/semantics/fuzzer_corpus/10d1744fbabedd2d7b67aeeba5ccfad33dde54eb

@@ -0,0 +1,28 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+// TODO: Implement this with some kind of reflection?
+impl {.x: i32, .y: i32} as EqWith(Self) {
+  fn Equal[self: Self](other: Self) -> bool {
+    return self.x == other.x and self.y == other.y;
+  }
+  fn NotEqual[self: Self](other: Self) -> bool {
+    return self.x != other.x or self.y != other.y;
+  }
+}
+
+fn Main() -> i32 {
+  var t1: {.x: i32, .y: i32} = {.x = 5, .y = 2};
+  var t2: {.x: i32,} = {.x = 5,};
+  // CHECK:STDERR: COMPILATION ERROR: fail_equality_type.carbon:[[@LINE+1]]: {.x: i32, .y: i32} is not equality comparable with {.x: i32} (could not find implementation of interface EqWith(U = {.x: i32}) for {.x: i32, .y: i32})
+  if (t1 == t2) {
+    return 1;
+  } else {
+    return 0;
+  }
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/10ed248ac6874c3c6ee8fed1ffff5e2d4f0c5ec5

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn F() {}
+alias A = F;
+
+// CHECK:STDERR: COMPILATION ERROR: fail_wrong_fn_alias_use.carbon:[[@LINE+1]]: alias A cannot be used as a name qualifier
+fn A.Foo() {}
+
+fn Main() -> i32 {
+    return 0;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/1171a926d8aa677aec7042fe5f9e29c1632f5300

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package EmptyIdentifier impl;
+
+fn A() {
+  // CHECK:STDERR: RUNTIME ERROR: fail_function_recursion.carbon:[[@LINE+1]]: stack overflow: too many interpreter actions on stack
+  A();
+}
+
+fn Main() -> i32 {
+  A();
+  return 0;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/119ac0fd33bccc1f9d8d4c78f485db62b8261039

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: i32;
+  // CHECK:STDERR: COMPILATION ERROR: fail_rhs_def.carbon:[[@LINE+1]]: use of uninitialized variable x
+  var y: i32 = x;
+  return x;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/119e4e694e8b998c45200f2f9bba291c8f18de86

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var a: i32 = 1;
+  let a_pinned: i32 = a;
+  // OK: Value unused after being mutated.
+  a = 2;
+  return 0;
+}

+ 45 - 0
toolchain/semantics/fuzzer_corpus/1259d0decfb6c2fd6808fda42a9654bbad1640de

@@ -0,0 +1,45 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: DESTRUCTOR A 1
+// CHECK:STDOUT: DESTRUCTOR A 2
+// CHECK:STDOUT: DESTRUCTOR A 3
+// CHECK:STDOUT: DESTRUCTOR A 4
+// CHECK:STDOUT: result: 2
+
+package ExplorerTest api;
+
+class A{
+    destructor[self: Self]{
+        Print("DESTRUCTOR A {0}",self.n);
+    }
+    var n: i32;
+}
+
+fn ident(x: bool)-> bool{
+    return x;
+}
+
+fn ident_i32(x: i32)-> i32{
+    return x;
+}
+// It should be enforced that different runtime scopes are on the stack.
+//So that it can be tested that the wrong scopes are not removed from the stack.
+fn Main() -> i32 {
+  var i: i32 = 0;
+  var d: A = {.n = 4};
+  if(ident(true)){
+    var a: A = {.n = 3};
+    if(true){
+       var b: A = {.n = 2};
+       ident_i32(2);
+       if(ident_i32(0) == 0){
+         var c: A = {.n = 1};
+         return 2;
+       }
+    }
+  }
+  return 1;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/128de0e2a70878988fcd7bf60bdd862ef764b92f

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: SYNTAX ERROR: fail_raw_block_more_hash_tags_on_right.carbon:[[@LINE+1]]: invalid character '\x23' in source file.
+  var s: String = #'''
+    error: there are more #s on the right than the left.
+  '''##;
+
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/12b34eb2c07d14c7b6c964bed06d9cd9b295570a

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 2
+
+package ExplorerTest api;
+
+var call_count: i32 = 0;
+fn ReturnFalse() -> bool {
+  call_count = call_count + 1;
+  return false;
+}
+
+fn Main() -> i32 {
+  var result: bool = ReturnFalse() or ReturnFalse();
+  return if not result then call_count else -1;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/137565f0078baddcd33c03bcb752cd91e0c15195

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+abstract class B {
+}
+
+// CHECK:STDERR: COMPILATION ERROR: fail_instantiate_global_abstract.carbon:[[@LINE+1]]: Cannot instantiate abstract class B
+var b: B = {};
+
+fn Main() -> i32 {
+    return 0;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/13936e89e497ed4f7b0555ad0fe8142c71385208

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn add1(x: i32) -> i32 {
+  return x + 1;
+}
+
+fn Main() -> i32 {
+  var f: __Fn(i32)->i32 = add1;
+  return f(-1);
+}

+ 24 - 0
toolchain/semantics/fuzzer_corpus/1397a4fbdf1addb0892345321c7fbc14adf77b4c

@@ -0,0 +1,24 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface Has(T:! type) {
+  fn Get() -> T;
+}
+impl i32 as Has(type) {
+  fn Get() -> type { return Self; }
+}
+
+class WithType(T:! Has(type)) {
+  fn Get() -> type { return T.Get(); }
+}
+
+fn Main() -> i32 {
+  var v: WithType(i32).Get() = 0;
+  return v;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/14bf3c7665fe5282a469b474df3d2485550adbd4

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+constraint X {
+  // CHECK:STDERR: COMPILATION ERROR: fail_associated_constant.carbon:[[@LINE+1]]: associated constant not permitted in named constraint
+  let N:! type;
+}
+
+fn Main() -> i32 { return 0; }

+ 19 - 0
toolchain/semantics/fuzzer_corpus/1554c1eb73ff3932ad2e83351d6b0c98fca9492c

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn CompareStr(s: String) -> i32 {
+  if (s == "str;\x07") {
+    return 0;
+  }
+  return 1;
+}
+
+fn Main() -> i32 {
+  return CompareStr("\x73\x74\x72\x3B\x07");
+}

+ 12 - 0
toolchain/semantics/fuzzer_corpus/164cd743faa60d9495a35aeeaaac5ebcbaaed5c8

@@ -0,0 +1,12 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: COMPILATION ERROR: fail_destination_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
+  return 4 as 7;
+}

+ 22 - 0
toolchain/semantics/fuzzer_corpus/17ec5002557db4205de08c6daad9a3f6cb529076

@@ -0,0 +1,22 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn IntDiff(a: i32, b: i32) -> i32 {
+  if (a == b) {
+    returned var ret: i32 = a - b;
+    return var;
+  } else {
+    returned var ret2: i32 = b - a;
+    return var;
+  }
+}
+
+fn Main() -> i32 {
+  return IntDiff(1, 2);
+}

+ 46 - 0
toolchain/semantics/fuzzer_corpus/188ed5d12d9c374702dfc38ab438dfe4b8cbabfd

@@ -0,0 +1,46 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: c.Foo() -> 1
+// CHECK:STDOUT: c.Bar() -> 2
+// CHECK:STDOUT: d.Foo() -> 3
+// CHECK:STDOUT: d.Bar() -> 4
+// CHECK:STDOUT: cc.Foo() -> 3
+// CHECK:STDOUT: cc.Bar() -> 2
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class C {
+  virtual fn Foo[self: Self]() -> i32 {
+    return 1;
+  }
+  fn Bar[self: Self]() -> i32 {
+    return 2;
+  }
+}
+
+class D {
+  extend base: C;
+  impl fn Foo[self: Self]() -> i32 {
+    return 3;
+  }
+  fn Bar[self: Self]() -> i32 {
+    return 4;
+  }
+}
+
+fn Main() -> i32 {
+  var c: C = {};
+  Print("c.Foo() -> {0}", c.Foo());
+  Print("c.Bar() -> {0}", c.Bar());
+  var d: D = {.base = {}};
+  Print("d.Foo() -> {0}", d.Foo());
+  Print("d.Bar() -> {0}", d.Bar());
+  var cc: C* = &d;
+  Print("cc.Foo() -> {0}", (*cc).Foo());
+  Print("cc.Bar() -> {0}", (*cc).Bar());
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/18ec728eade91679104b23c3a949271089132321

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class Point {
+  var x: i32;
+  var y: i32;
+}
+
+var p: Point = {.x = 1, .y = 2};
+
+fn Main() -> i32 {
+  return p.y - p.x - 1;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/1913a5458321a159544fff949d3f7b0f9d52065a

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn fst[T:! type](x: T, y: T) -> T {
+  return x;
+}
+
+fn Main() -> i32 {
+  return fst(0, 1);
+}

+ 21 - 0
toolchain/semantics/fuzzer_corpus/19d6f8cf04b59808515a78af96abc89cd4c2583e

@@ -0,0 +1,21 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class C {
+  fn F() {}
+  fn G[self: Self]() {}
+}
+
+fn H[T:! type](x: T) {}
+
+fn Main() -> i32 {
+  H(C.F);
+  // CHECK:STDERR: COMPILATION ERROR: fail_method_deduced.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
+  H(C.G);
+  return 0;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/1ad7c0030d4448143955e4e047868426e46a08e6

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: i32;
+  // CHECK:STDERR: COMPILATION ERROR: fail_field_value.carbon:[[@LINE+1]]: use of uninitialized variable x
+  var p: auto = {.x = x,};
+  return 0;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/1af0cf0cfeabefdff968d557c1b67a32a424f357

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: i32;
+  x = 1;
+  return x;
+}

+ 44 - 0
toolchain/semantics/fuzzer_corpus/1b5911a616ba8ae35eb39f855270fa9b766c3afc

@@ -0,0 +1,44 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: Foo(c1): 1
+// CHECK:STDOUT: Foo(c2): 1
+// CHECK:STDOUT: Foo(d): 1
+// CHECK:STDOUT: Foo(&e): 1
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class C {
+  var val: i32;
+}
+
+base class D {
+  extend base: C;
+  var val: i32;
+}
+
+class E {
+  extend base: D;
+  var val: i32;
+}
+
+fn Foo(c: C*) -> i32 {
+  return (*c).val;
+}
+
+fn Main() -> i32 {
+  var e: E = { .val = 3, .base = {.val = 2,.base = {.val = 1}}};
+  var d: D* = &e;
+  var c1: C* = &e;
+  var c2: C* = d;
+
+  Print("Foo(c1): {0}", Foo(c1));
+  Print("Foo(c2): {0}", Foo(c2));
+  Print("Foo(d): {0}", Foo(d));
+  Print("Foo(&e): {0}", Foo(&e));
+
+  return 0;
+}

+ 34 - 0
toolchain/semantics/fuzzer_corpus/1c939f5777f53aaf53300f4e54c1f2380b8b4f6a

@@ -0,0 +1,34 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: 1
+// CHECK:STDOUT: 2
+// CHECK:STDOUT: 3
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class A {
+  var a: i32;
+}
+
+base class B {
+  extend base: A;
+  var b: i32;
+}
+
+class C {
+  extend base: B;
+  var c: i32;
+}
+
+fn Main() -> i32 {
+  var c: C = {.base = {.base = {.a = 1}, .b = 2}, .c = 3};
+  let (pa: A*, pb: B*, pc: C*) = (&c, &c, &c);
+  Print("{0}", pa->a);
+  Print("{0}", pb->b);
+  Print("{0}", pc->c);
+  return 0;
+}

+ 37 - 0
toolchain/semantics/fuzzer_corpus/1d5b8ef87c518dfd90dfaf7e98886a4ef791ab93

@@ -0,0 +1,37 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: Class 1
+// CHECK:STDOUT: Class 2
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class C {
+  fn BasePrint(v: i32) {
+    Print("Class {0}", v);
+  }
+  fn Method1[self: Self]() {
+    self.BasePrint(self.value_c);
+  }
+
+  var value_c: i32;
+}
+
+class D {
+  extend base: C;
+  fn Method2[self: Self]() {
+    self.BasePrint(self.value_d);
+  }
+
+  var value_d: i32;
+}
+
+fn Main() -> i32 {
+  var d: D = {.base = {.value_c = 1}, .value_d = 2};
+  d.Method1();
+  d.Method2();
+  return 0;
+}

+ 55 - 0
toolchain/semantics/fuzzer_corpus/1d6d70723cfa13913d715a7ba2d7efa03d521df9

@@ -0,0 +1,55 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface Vector {
+  fn Add[self: Self](b: Self) -> Self;
+  fn Scale[self: Self](v: i32) -> Self;
+}
+
+class Point1 {
+  var x: i32;
+  var y: i32;
+  extend impl as Vector {
+    fn Add[self: Point1](b: Point1) -> Point1 {
+      return {.x = self.x + b.x, .y = self.y + b.y};
+    }
+    fn Scale[self: Point1](v: i32) -> Point1 {
+      return {.x = self.x * v, .y = self.y * v};
+    }
+  }
+}
+
+class Point2 {
+  var x: i32;
+  var y: i32;
+  extend impl as Vector {
+    fn Add[self: Point2](b: Point2) -> Point2 {
+      return {.x = self.x + b.x + 1, .y = self.y + b.y + 1};
+    }
+    fn Scale[self: Point2](v: i32) -> Point2 {
+      return {.x = self.x * v * 2, .y = self.y * v * 2};
+    }
+  }
+}
+
+fn ScaleGeneric[U:! Vector](c: U, s: i32) -> U {
+  return c.Scale(s);
+}
+
+fn AddAndScaleGeneric[T:! Vector, V:! Vector](a: T, b: V, s: i32) -> (T, V) {
+  return (ScaleGeneric(a.Add(a), s),
+  	  ScaleGeneric(b.Add(b), s));
+}
+
+fn Main() -> i32 {
+  var a: Point1 = {.x = 1, .y = 1};
+  var b: Point2 = {.x = 2, .y = 3};
+  var (p: Point1, q: Point2) = AddAndScaleGeneric(a, b, 5);
+  return q.x - p.x - 40;
+}

+ 25 - 0
toolchain/semantics/fuzzer_corpus/1dddc76f0ab71e0db413ccbd3eb8440ce69fe0e0

@@ -0,0 +1,25 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+interface Iface {
+  let N:! i32;
+}
+
+fn F(T:! Iface where .N == 5) {}
+
+class Good {}
+class Bad {}
+impl Good as Iface where .N = 5 {}
+impl Bad as Iface where .N = 4 {}
+
+fn Main() -> i32 {
+  F(Good);
+  // CHECK:STDERR: COMPILATION ERROR: fail_different_value.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.N) (with value 4) == 5, which is not known to be true
+  F(Bad);
+  return 0;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/1e4c94040dcf313929b6e45bb96932198f296d9e

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 4
+
+package ExplorerTest api;
+
+alias TypeAlias = i32;
+
+fn Main() -> TypeAlias {
+  var n: TypeAlias = 1;
+  var m: i32 = n;
+  var p: i32* = &n;
+  var q: TypeAlias* = &m;
+  return *p + *q + m + n;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/1ee86793bb703120496039d708f7562e9abfbc5c

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn F() {}
+
+// CHECK:STDERR: COMPILATION ERROR: fail_qualifier_not_namespace.carbon:[[@LINE+1]]: fn F cannot be used as a name qualifier
+fn F.G() {}
+
+fn Main() -> i32 {
+  return 0;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/1f287f6a07c7bf4e14bd2563f2877e1ca28c52c3

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  Assert(true, "HALLO WELT");
+  return 0;
+}

+ 46 - 0
toolchain/semantics/fuzzer_corpus/1fc793d170552ec217bfa6554c43444b5bc1a30d

@@ -0,0 +1,46 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: 6
+// CHECK:STDOUT: 5
+// CHECK:STDOUT: 6
+// CHECK:STDOUT: 5
+// CHECK:STDOUT: 6
+// CHECK:STDOUT: 5
+// CHECK:STDOUT: 6
+// CHECK:STDOUT: 5
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class A { var n: i32; }
+
+impl A as Inc {
+  fn Op[addr self: Self*]() { ++self->n; }
+}
+impl A as Dec {
+  fn Op[addr self: Self*]() { --self->n; }
+}
+
+fn Main() -> i32 {
+  var a: A = {.n = 5};
+  ++a.n;
+  Print("{0}", a.n);
+  --a.n;
+  Print("{0}", a.n);
+  ++a;
+  Print("{0}", a.n);
+  --a;
+  Print("{0}", a.n);
+  a.n.(Inc.Op)();
+  Print("{0}", a.n);
+  a.n.(Dec.Op)();
+  Print("{0}", a.n);
+  a.(Inc.Op)();
+  Print("{0}", a.n);
+  a.(Dec.Op)();
+  Print("{0}", a.n);
+  return 0;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/2038a206d7fa99068235bb2ba54820e768b29cb9

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package Foo api;
+interface A { fn F[self: Self]() -> i32; }
+class X {
+  extend impl as A {
+    fn F[self: Self]() -> i32 { return 1; }
+  }
+}
+fn Main() -> i32 {
+  var a: X = {};
+  return a.(X.(A.F))();
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/20bbc444ffd3b0a688732fe0aa1eeff6969c33cc

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest impl;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: RUNTIME ERROR: fail_single_brace.carbon:[[@LINE+1]]: `{` must be followed by a second `{` or index in `{`
+  Print("{");
+  return 0;
+}

+ 12 - 0
toolchain/semantics/fuzzer_corpus/21e0d305628d54204f02591a43b61527cda5d976

@@ -0,0 +1,12 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+// CHECK:STDERR: COMPILATION ERROR: fail_nontype_tuple_as_type.carbon:[[@LINE+1]]: type error in type of name binding: '(i32, i32)' is not implicitly convertible to 'type'
+fn F[T:! (i32, i32)](x: T);
+
+fn Main() -> i32;

+ 21 - 0
toolchain/semantics/fuzzer_corpus/22d9a3333ee8d54f7e1233bf62920026ca8f3a1d

@@ -0,0 +1,21 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface X { fn F(); }
+impl i32 as X { fn F() {} }
+
+fn G[T:! X](v: T) -> type {
+  v.F();
+  return i32;
+}
+
+fn Main() -> i32 {
+  var v: G(0) = 0;
+  return v;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/23e9f18ca5b5c85f4a44e3c472bbd23d1420013b

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest impl;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: RUNTIME ERROR: fail_index_bounds1.carbon:[[@LINE+1]]: Index invalid with argument count of 1 at offset 12 in `Print: {0} {1}`
+  Print("Print: {0} {1}", 1);
+  return 0;
+}

+ 14 - 0
toolchain/semantics/fuzzer_corpus/2464b8df7ccb3280edff4bce116483b5b165a953

@@ -0,0 +1,14 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn add(x: i32, y: i32) -> auto { return x + y; }
+
+fn Main() -> i32 {
+  return add(1, 2) - 3;
+}

+ 31 - 0
toolchain/semantics/fuzzer_corpus/25337ce57e0a62b2091a8b41a217cc54d65d0d80

@@ -0,0 +1,31 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: 8
+// CHECK:STDOUT: 4
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  if (1 << 0 != 1) { return 1; }
+  if (1 << 3 != 8) { return 2; }
+  if (0 << 3 != 0) { return 3; }
+  if (3 << 1 != 6) { return 4; }
+  if (-1 << 2 != -4) { return 5; }
+  if (1 >> 0 != 1) { return 6; }
+  if (1 >> 1 != 0) { return 7; }
+  if (3 >> 1 != 1) { return 8; }
+  if (-1 >> 1 != -1) { return 9; }
+  if (-2 >> 1 != -1) { return 10; }
+
+  var n: i32 = 1;
+  n <<= 3;
+  Print("{0}", n);
+  n >>= 1;
+  Print("{0}", n);
+
+  return 0;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/25502eb01b8fec80bd8f99258c8e2c4db7ebd1dd

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: RUNTIME ERROR: fail_overflow_add.carbon:[[@LINE+1]]: integer overflow
+  var a: auto = 2147483647 + 1;
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/2552f1d3328f74b706d9138c53a14ff62b3b6bb3

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn CompareStr(s: String) -> i32 {
+  if (s == "HELLO WORLD!!") {
+    return 0;
+  }
+  return 1;
+}
+
+fn Main() -> i32 {
+  return CompareStr("\u{0048}\u{0045}\u{004C}\u{004C}\u{004F} \u{0057}\u{004F}\u{0052}\u{004C}\u{0044}\u{0021}\u{21}");
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/26ce51c2c7f8a1d9f1b0c03722e8619f4e6eb1a5

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class C {}
+
+// CHECK:STDERR: SYNTAX ERROR: fail_type_only.carbon:[[@LINE+1]]: syntax error, unexpected RIGHT_SQUARE_BRACKET, expecting COLON
+fn f[x:! i32, addr C]() {}
+
+fn Main() -> i32 {
+  return 0;
+}

+ 44 - 0
toolchain/semantics/fuzzer_corpus/27b81cef471374f0e9d02dcf2be5e79e45c0de2c

@@ -0,0 +1,44 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+interface Vector {
+  fn Zero() -> Self;
+  fn Add[self: Self](b: Self) -> Self;
+  fn Scale[self: Self](v: i32) -> Self;
+}
+
+class Point(T:! type) {
+  var x: T;
+  var y: T;
+}
+
+impl Point(i32) as Vector {
+  // Allowed: `Self` means `Point(i32)` here.
+  fn Zero() -> Self {
+    return {.x = 0, .y = 0};
+  }
+
+  fn Add[self: Self](b: Self) -> Self {
+    return {.x = self.x + b.x, .y = self.y + b.y};
+  }
+
+  fn Scale[self: Self](v: i32) -> Self {
+    return {.x = self.x * v, .y = self.y * v};
+  }
+}
+
+fn AddAndScaleGeneric[T:! Vector](a: T, s: i32) -> T {
+  return a.Add(T.Zero()).Scale(s);
+}
+
+fn Main() -> i32 {
+  var a: Point(i32) = {.x = 2, .y = 1};
+  var p: Point(i32) = AddAndScaleGeneric(a, 5);
+  return p.x - 10;
+}

+ 22 - 0
toolchain/semantics/fuzzer_corpus/28720cdeeeba8921f97c137876b6dbe6e2a3225f

@@ -0,0 +1,22 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 2
+
+package ExplorerTest api;
+
+interface Vector {
+  let Dim:! i32;
+}
+
+class Point {
+  var x: i32;
+  var y: i32;
+  extend impl as Vector where .Dim = 2 {}
+}
+
+fn Main() -> i32 {
+  return Point.(Vector.Dim);
+}

+ 20 - 0
toolchain/semantics/fuzzer_corpus/291af82d79bec74264cef40a43fcd6198593d0b5

@@ -0,0 +1,20 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 3
+
+package ExplorerTest api;
+
+class TypeLike {
+  extend impl as ImplicitAs(type) {
+    fn Convert[self: Self]() -> type { return i32; }
+  }
+  fn Make() -> Self { return {}; }
+}
+
+fn Main() -> TypeLike.Make() {
+  var x: {.a: TypeLike.Make(), .b: TypeLike.Make()} = {.a = 1, .b = 2};
+  return x.a + x.b;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/292afba18cbb0ca2936ed77ebc79534ac76eeea4

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  if (0 == 1) {
+    return 1;
+  }
+
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/29366dc2c3a372bec197172efb4c3b245a6b6e95

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package EmptyIdentifier impl;
+
+fn Main() -> i32 {
+  while (true) {
+    // Ideally we would hit an OOM here, but it's too difficult to OOM from heap
+    // allocations before hitting max steps. Maybe with string operations we
+    // could trigger actual excessive memory allocations by just doubling the
+    // size of the string each time.
+    // CHECK:STDERR: RUNTIME ERROR: fail_allocate.carbon:[[@LINE+1]]: possible infinite loop: too many interpreter steps executed
+    heap.New((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0));
+  }
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/293b69131b73f32057424dee21a24ea04530399a

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn CompareStr(s: String) -> i32 {
+  // CHECK:STDERR: SYNTAX ERROR: fail_raw_block_single_line.carbon:[[@LINE+1]]: Invalid block string: Too few lines
+  if (s == #'''raw string literal starting with '''#) {
+    return 0;
+  }
+  return 1;
+}
+
+fn Main() -> i32 {
+  return CompareStr("\"\"raw string literal starting with \"\"");
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/299dc67e6adcc047d41fb7c54c8733ae1f5a730f

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: i32;
+  return 1;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/2c68b43d8a3accf3dffde64ee1346170c321cf8a

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: RUNTIME ERROR: fail_div_by_zero.carbon:[[@LINE+1]]: division by zero
+  var a: auto = 5 / 0;
+  return 0;
+}

+ 20 - 0
toolchain/semantics/fuzzer_corpus/2c8bd9d51c37b6e039d31465180dcd971e372a33

@@ -0,0 +1,20 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn ReturnIndirectly[T:! type](direct: bool, x: T) -> type {
+  if (direct) {
+    return T;
+  } else {
+    return ReturnIndirectly(true, x);
+  }
+}
+
+fn Main() -> ReturnIndirectly(false, 0) {
+  return 0;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/2cd24a29608035201b59f604b1c06ffd230df13e

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+class A(T:! type) {
+  var v: T;
+}
+fn F(T:! type, x: T) -> T {
+  var v: A(T) = {.v = x};
+  return v.v;
+}
+fn Main() -> i32 {
+  return F(i32, 1);
+}

+ 75 - 0
toolchain/semantics/fuzzer_corpus/2e7f4e15df56d8a05046d80c7a7ce01e6cb6779b

@@ -0,0 +1,75 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: MemberF.F
+// CHECK:STDOUT: ImplF.(HasF.F)
+// CHECK:STDOUT: BothFs.(HasF.F)
+// CHECK:STDOUT: BothFs.F
+// CHECK:STDOUT: BothFs.F
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+choice ImplKind {
+  Checked,
+  ConstrainedTemplate,
+  UnconstrainedTemplate
+}
+
+interface CallF(K:! ImplKind) {
+  fn DoIt[self: Self]();
+}
+
+interface HasF {
+  fn F[self: Self]();
+}
+
+impl forall [T:! HasF] T as CallF(ImplKind.Checked) {
+  fn DoIt[self: Self]() { self.F(); }
+}
+
+impl forall [template T:! HasF] T as CallF(ImplKind.ConstrainedTemplate) {
+  fn DoIt[self: Self]() { self.F(); }
+}
+
+impl forall [template T:! type] T as CallF(ImplKind.UnconstrainedTemplate) {
+  fn DoIt[self: Self]() { self.F(); }
+}
+
+class MemberF {
+  fn F[self: Self]() { Print("MemberF.F"); }
+}
+
+class ImplF {}
+impl ImplF as HasF {
+  fn F[self: Self]() { Print("ImplF.(HasF.F)"); }
+}
+
+class BothFs {
+  fn F[self: Self]() { Print("BothFs.F"); }
+}
+impl BothFs as HasF {
+  fn F[self: Self]() { Print("BothFs.(HasF.F)"); }
+}
+
+fn Main() -> i32 {
+  var mem: MemberF = {};
+  var imp: ImplF = {};
+  var both: BothFs = {};
+
+  mem.(CallF(ImplKind.UnconstrainedTemplate).DoIt)();
+
+  imp.(CallF(ImplKind.Checked).DoIt)();
+  // TODO: Should be valid, but currently fails during instantiation.
+  //imp.(CallF(ImplKind.ConstrainedTemplate).DoIt)();
+
+  both.(CallF(ImplKind.Checked).DoIt)();
+  // TODO: Should be rejected, but currently incorrectly accepted.
+  // This line can be deleted once it starts failing; we test that this is
+  // rejected in fail_name_lookup.carbon.
+  both.(CallF(ImplKind.ConstrainedTemplate).DoIt)();
+  both.(CallF(ImplKind.UnconstrainedTemplate).DoIt)();
+  return 0;
+}

+ 18 - 0
toolchain/semantics/fuzzer_corpus/2f13aa997ff8ff9e53fa3e0d38fd27ff214319d9

@@ -0,0 +1,18 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  if (0 == 1) {
+    return 1;
+  } else if (0 == 0) {
+    return 0;
+  }
+
+  return 1;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/2f1e5bc51212e421a902e31273599bea2ede8c62

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var n: i32 = 0;
+  match (n) {
+    case 1 => { return 0; }
+  }
+  return 1;
+}

+ 21 - 0
toolchain/semantics/fuzzer_corpus/2fb9acfa600396821f70f238b1c20f95e40a25b9

@@ -0,0 +1,21 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+interface I {}
+impl i32 as I {}
+
+fn F(A:! i32, B:! i32, C:! i32, D:! i32, E:! i32,
+     T:! I where A == B and C == D and C == E and B == D) {
+  // CHECK:STDERR: COMPILATION ERROR: fail_combine_equality.carbon:[[@LINE+1]]: member access, F not in interface I where T impls interface I and A == B and C == D and C == E and B == D
+  T.F();
+}
+
+fn Main() -> i32 {
+  F(1, 1, 1, 1, 1, i32);
+  return 0;
+}

+ 19 - 0
toolchain/semantics/fuzzer_corpus/30243c0f830ca810070c9dc52e11026d673fd3de

@@ -0,0 +1,19 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 6
+
+package ExplorerTest api;
+
+namespace N;
+
+fn OuterI32() -> type { return i32; }
+fn One() -> i32 { return 1; }
+
+fn N.I32() -> type { return i32; }
+fn N.Five() -> I32() { return 5; }
+fn N.Six() -> OuterI32() { return Five() + One(); }
+
+fn Main() -> i32 { return N.Six(); }

+ 30 - 0
toolchain/semantics/fuzzer_corpus/3079f1de829d6dad1caef247d2d2965ab0a2233f

@@ -0,0 +1,30 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+__mixin M1 {
+  fn Scale10[self: Self](x:i32) -> i32{
+     return x * 10;
+  }
+}
+
+__mixin M2 {
+  __mix M1;
+  fn Square[self: Self](x:i32) -> i32{
+    return x * x;
+  }
+}
+
+class C {
+  __mix M2;
+}
+
+fn Main() -> i32 {
+  var c: C = {};
+  return c.Square(11) - c.Scale10(10) - 21;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/307b97c6b60b4f05d53a656201995e1fb502af02

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class C {
+  // CHECK:STDERR: COMPILATION ERROR: fail_use_before_typecheck.carbon:[[@LINE+1]]: incomplete type `class C` used in member access
+  var n: if not C.WrapInStruct() then i32 else {.n: i32};
+  fn WrapInStruct() -> bool { return true; }
+}
+
+fn Main() -> i32 {
+  return 0;
+}

+ 15 - 0
toolchain/semantics/fuzzer_corpus/3161b5f7fb9fc09982d28e2255f3d2ae27fc5ce1

@@ -0,0 +1,15 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+var x: i32;
+
+fn Main() -> i32 {
+  x = 1;
+  return x;
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/31e0e6f587bdffffc37922b7b3f771680232bb31

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var x: [[i32; 3]; 2] = ((0, 1, 2), (3, 4, 5));
+  return x[1][2] - 5;
+}

+ 56 - 0
toolchain/semantics/fuzzer_corpus/31ef33085e7420998380c7dd66d8529ad975f7a4

@@ -0,0 +1,56 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: bool: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: string: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: int: 1
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn CompareEqualValues[T:! EqWith(.Self)](format: String, a: T, b: T) {
+  Print(format, if a == b then 1 else 0);
+  Print(format, if a != b then 0 else 1);
+}
+
+fn CompareDifferentValues[U:! EqWith(.Self)](format: String, a: U, b: U) {
+  Print(format, if a == b then 0 else 1);
+  Print(format, if a != b then 1 else 0);
+}
+
+fn CompareAll[V:! EqWith(.Self)](format: String, a: V, b: V) {
+  CompareEqualValues(format, a, a);
+  CompareEqualValues(format, b, b);
+  CompareDifferentValues(format, a, b);
+  CompareDifferentValues(format, b, a);
+}
+
+fn Main() -> i32 {
+  CompareAll("bool: {0}", false, true);
+  CompareAll("string: {0}", "hello", "world");
+  CompareAll("int: {0}", 1, 2);
+  return 0;
+}

+ 43 - 0
toolchain/semantics/fuzzer_corpus/3246530de7e46a174acd24fd87d38695fd5e36c9

@@ -0,0 +1,43 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: DESTRUCTOR A 1
+// CHECK:STDOUT: DESTRUCTOR B 2
+// CHECK:STDOUT: DESTRUCTOR A 3
+// CHECK:STDOUT: DESTRUCTOR A 4
+// CHECK:STDOUT: DESTRUCTOR A 5
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+class A{
+    destructor[self: Self]{
+        Print("DESTRUCTOR A {0}",self.n);
+    }
+    fn Create(x: i32) -> A{
+        return {.n = x};
+    }
+    var n: i32;
+}
+
+class B{
+    destructor[self: Self]{
+        Print("DESTRUCTOR B {0}",self.n);
+    }
+    fn Create(x: i32) -> B{
+       return {.n = x, .a1 = A.Create(4),.a2 = A.Create(3) };
+    }
+    var a1: A;
+    var n: i32;
+    var a2: A;
+}
+
+
+fn Main() -> i32 {
+  var a: A = A.Create(5);
+  var b: B = B.Create(2);
+  var c: A = A.Create(1);
+  return 1;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/326f616ba0e75fe934290f59801ffeecb97fad51

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+class A {
+  fn F[self: Self]() -> i32;
+}
+
+fn Main() -> i32 {
+  var a: A = {};
+  // CHECK:STDERR: RUNTIME ERROR: fail_call_undefined_method.carbon:[[@LINE+1]]: attempt to call function `F` that has not been defined
+  return a.F();
+}

+ 13 - 0
toolchain/semantics/fuzzer_corpus/328768bbd4cee309586c935aa27bedf19202ef39

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: SYNTAX ERROR: fail_octal.carbon:[[@LINE+1]]: Invalid escaping in string: "str\01"
+  Print("str\01");
+  return 0;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/32ab1efa550be4f04cc3d07bf05a8804d09b754b

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var (x: i32, y: i32);
+  // CHECK:STDERR: COMPILATION ERROR: fail_while_cond.carbon:[[@LINE+1]]: use of uninitialized variable x
+  while (x == 0) {
+    y = 1;
+  }
+  return 1;
+}

+ 15 - 0
toolchain/semantics/fuzzer_corpus/33346b680817ff4c2a003195a0a712daee297f8f

@@ -0,0 +1,15 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package Foo api;
+fn F[self: i32]() {}
+fn Main() -> i32 {
+  // TODO: It's unclear whether this is valid per the current rules. See
+  // https://github.com/carbon-language/carbon-lang/pull/1122
+  // CHECK:STDERR: COMPILATION ERROR: fail_qualified_non_member.carbon:[[@LINE+1]]: expected name of instance member or interface member in compound member access, found fn [self: i32]() -> ()
+  42.(F)();
+  return 0;
+}

+ 22 - 0
toolchain/semantics/fuzzer_corpus/347494c3bd46b47f162b4abe214f5f71881dd126

@@ -0,0 +1,22 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class Point {
+  fn Origin() -> Point {
+    return {.x = 0, .y = 0};
+  }
+
+  var x: i32;
+  var y: i32;
+}
+
+fn Main() -> i32 {
+  var p: Point = Point.Origin();
+  return p.x;
+}

+ 25 - 0
toolchain/semantics/fuzzer_corpus/34d5a979143e2dac42a721445d89d3681f13f4cd

@@ -0,0 +1,25 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+interface Container {
+  let Element:! type;
+  fn Front[self: Self]() -> Element;
+}
+
+fn A[T:! Container where .Element = i32](x: T) -> T.Element {
+  return x.Front();
+}
+
+fn B[T:! Container](x: T) -> i32 {
+  // CHECK:STDERR: COMPILATION ERROR: fail_missing_rewrite.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
+  return A(x);
+}
+
+fn Main() -> i32 {
+  return 0;
+}

+ 52 - 0
toolchain/semantics/fuzzer_corpus/34ff001dd827e172826dd1a040df88b4f7d15a01

@@ -0,0 +1,52 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: Initialize c1 from initializing expression (returned var)
+// CHECK:STDOUT: Before nested init
+// CHECK:STDOUT: 0: Heap{}, 1: !Uninit<class C>
+// CHECK:STDOUT: Nested call return
+// CHECK:STDOUT: 0: Heap{}, 1: C{}
+// CHECK:STDOUT: First call return
+// CHECK:STDOUT: 0: Heap{}, 1: C{}
+// CHECK:STDOUT: Declaration scope
+// CHECK:STDOUT: 0: Heap{}, 1: C{}
+// CHECK:STDOUT: c destroyed
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class C {
+  destructor[self: Self] {
+    Print("c destroyed");
+  }
+}
+
+fn CallWithReturnedVar2() -> C {
+  Print("Before nested init");
+  heap.PrintAllocs();
+  returned var c: C = {};
+  Print("Nested call return");
+  heap.PrintAllocs();
+  return var;
+}
+
+fn CallWithReturnedVar() -> C {
+  returned var c: C = CallWithReturnedVar2();
+  Print("First call return");
+  heap.PrintAllocs();
+  return var;
+}
+
+fn FromInitializingExpression_ReturnedVar() {
+  Print("Initialize c1 from initializing expression (returned var)");
+  let c: C = CallWithReturnedVar();
+  Print("Declaration scope");
+  heap.PrintAllocs();
+}
+
+fn Main() -> i32 {
+  FromInitializingExpression_ReturnedVar();
+  return 0;
+}

+ 27 - 0
toolchain/semantics/fuzzer_corpus/35538f6224efb57c9edb0fa3da9f3679a1a1ceed

@@ -0,0 +1,27 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: 6
+// CHECK:STDOUT: 3
+// CHECK:STDOUT: 1
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class A { var n: i32; }
+
+impl A as DivWith(i32) where .Result = A {
+  fn Op[self: Self](rhs: i32) -> A { return {.n = self.n / rhs}; }
+}
+
+fn Main() -> i32 {
+  var a: A = {.n = 19};
+  a = a / 3;
+  Print("{0}", a.n);
+  a /= 2;
+  Print("{0}", a.n);
+  Print("{0}", (a / 2).n);
+  return 0;
+}

+ 32 - 0
toolchain/semantics/fuzzer_corpus/36717d4dda9919479b60d7150b62df44499a51fd

@@ -0,0 +1,32 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: DESTRUCTOR A 1
+// CHECK:STDOUT: DESTRUCTOR A 2
+// CHECK:STDOUT: DESTRUCTOR A 3
+// CHECK:STDOUT: DESTRUCTOR A 1
+// CHECK:STDOUT: DESTRUCTOR A 2
+// CHECK:STDOUT: DESTRUCTOR A 3
+// CHECK:STDOUT: result: 1
+
+package ExplorerTest api;
+
+class A{
+    destructor[self: Self]{
+        Print("DESTRUCTOR A {0}",self.n);
+    }
+    var n: i32;
+}
+
+fn Main() -> i32 {
+  var i: i32 = 0;
+  while( i < 2){
+    var a: A = {.n = 3};
+    var b: A = {.n = 2};
+    var c: A = {.n = 1};
+    i = i + 1;
+  }
+  return 1;
+}

+ 23 - 0
toolchain/semantics/fuzzer_corpus/36b957f732d3b3eb30b528c109683f3ff3e738f9

@@ -0,0 +1,23 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: 3
+// CHECK:STDOUT: 4
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var a: (i32, i32) = (1, 2);
+  var p: (i32, i32)* = &a;
+
+  a[0] = 3;
+  Print("{0}", (*p)[0]);
+
+  (*p)[1] = 4;
+  Print("{0}", a[1]);
+
+  return 0;
+}

+ 16 - 0
toolchain/semantics/fuzzer_corpus/374e96ca0653e9f238dad0aa53e6d8243460302e

@@ -0,0 +1,16 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32{
+  var x: Optional(String) = Optional(String).CreateEmpty();
+  if(x.HasValue()){
+    return -1;
+  }
+  return 0;
+}

+ 17 - 0
toolchain/semantics/fuzzer_corpus/3974726c6015a615360574cb1221200e183175c2

@@ -0,0 +1,17 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 12
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var cond: if true then bool else i32 = true;
+  if (if cond then true else false) {}
+  while (if cond then false else true) {}
+  return if if cond then true or false else false and true
+         then if not cond then 1 + 2 else 3 * 4
+         else if not cond then 5 + 6 else 7 * 8;
+}

+ 15 - 0
toolchain/semantics/fuzzer_corpus/3a4ba37f94cf21edb7969ed61c1fea9a0f3eb56c

@@ -0,0 +1,15 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  var p: i32* = __intrinsic_new(0);
+  var y: i32 = *p;
+  __intrinsic_delete(p);
+  return y;
+}

+ 66 - 0
toolchain/semantics/fuzzer_corpus/3bddb2be6780b792248656a086347171ecca2f1d

@@ -0,0 +1,66 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: Allocate D
+// CHECK:STDOUT: DESTRUCTOR B
+// CHECK:STDOUT: DESTRUCTOR A
+// CHECK:STDOUT: DESTRUCTOR D
+// CHECK:STDOUT: DESTRUCTOR C
+// CHECK:STDOUT: Delete B from A*
+// CHECK:STDOUT: DESTRUCTOR B
+// CHECK:STDOUT: DESTRUCTOR A
+// CHECK:STDOUT: Delete D from C*
+// CHECK:STDOUT: DESTRUCTOR D
+// CHECK:STDOUT: DESTRUCTOR C
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+base class A {
+  virtual destructor[self: Self] {
+    Print("DESTRUCTOR A");
+  }
+}
+
+class B {
+  extend base: A;
+  fn Create() -> Self{
+    return {.base={}};
+  }
+  impl destructor[self: Self] {
+    Print("DESTRUCTOR B");
+  }
+}
+
+base class C {
+  virtual destructor[self: Self] {
+    Print("DESTRUCTOR C");
+  }
+}
+
+class D {
+  extend base: C;
+  fn Create() -> Self{
+    return {.base={}, .d_pa=heap.New(B.Create())};
+  }
+  impl destructor[self: Self] {
+    Print("DESTRUCTOR D");
+  }
+  var d_pa: A*;
+}
+
+fn Main() -> i32 {
+  Print("Allocate D");
+  var pd: D* = heap.New(D.Create());
+  var pc: C* = pd;
+
+  Print("Delete B from A*");
+  heap.Delete(pd->d_pa);
+
+  Print("Delete D from C*");
+  heap.Delete(pc);
+
+  return 0;
+}

+ 26 - 0
toolchain/semantics/fuzzer_corpus/3def80179ffa13dd5984676ace7c0d8e9cac2031

@@ -0,0 +1,26 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+class Point(T:! type) {
+  fn Origin(zero: T) -> Point(T) {
+    return {.x = zero, .y = zero};
+  }
+
+  fn GetX[self: Point(T)]() -> T {
+    return self.x;
+  }
+
+  var x: T;
+  var y: T;
+}
+
+fn Main() -> i32 {
+  var p: Point(i32) = Point(i32).Origin(0);
+  return p.GetX();
+}

+ 23 - 0
toolchain/semantics/fuzzer_corpus/3e51c009c54026d5e2cbbfe253b38765d4e71c63

@@ -0,0 +1,23 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+// CHECK:STDOUT: result: 0
+
+package ExplorerTest api;
+
+// Check that even generic parameters are looked up in the namespace of an
+// entity.
+namespace N;
+
+interface N.Interface {}
+
+class N.A(T:! Interface) {}
+interface N.B(T:! Interface) {}
+constraint N.C(T:! Interface) {}
+__mixin N.D(T:! Interface) {}
+choice N.E(T:! Interface) {}
+fn N.F[T:! Interface](a: A(T)) {}
+
+fn Main() -> i32 { return 0; }

+ 13 - 0
toolchain/semantics/fuzzer_corpus/3fa85a4f6a6e080e9c47b7de21848308a54fb12d

@@ -0,0 +1,13 @@
+// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// AUTOUPDATE
+
+package ExplorerTest api;
+
+fn Main() -> i32 {
+  // CHECK:STDERR: RUNTIME ERROR: fail_overflow_multiply.carbon:[[@LINE+1]]: integer overflow
+  var a: auto = 1000000000 * 1000000000;
+  return 0;
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است