fail_exhaustive_exponential_9x.carbon 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. choice AB {
  8. A(),
  9. B()
  10. }
  11. fn F() -> AB { return AB.A(); }
  12. fn Main() -> i32 {
  13. // Note, this match is exhaustive, but it exceeds our depth limit.
  14. match ((F(), F(), F(), F(), F(), F(), F(), F(), F())) {
  15. case (AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 0; }
  16. case (AB.B(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 1; }
  17. case (_: AB, AB.B(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 2; }
  18. case (_: AB, _: AB, AB.B(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 3; }
  19. case (_: AB, _: AB, _: AB, AB.B(), AB.A(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 4; }
  20. case (_: AB, _: AB, _: AB, _: AB, AB.B(), AB.A(), AB.A(), AB.A(), AB.A()) => { return 5; }
  21. case (_: AB, _: AB, _: AB, _: AB, _: AB, AB.B(), AB.A(), AB.A(), AB.A()) => { return 6; }
  22. case (_: AB, _: AB, _: AB, _: AB, _: AB, _: AB, AB.B(), AB.A(), AB.A()) => { return 7; }
  23. case (_: AB, _: AB, _: AB, _: AB, _: AB, _: AB, _: AB, AB.B(), AB.A()) => { return 8; }
  24. case (_: AB, _: AB, _: AB, _: AB, _: AB, _: AB, _: AB, _: AB, AB.B()) => { return 9; }
  25. }
  26. // CHECK:STDERR: COMPILATION ERROR: fail_exhaustive_exponential_9x.carbon:[[@LINE+1]]: non-exhaustive match may allow control-flow to reach the end of a function that provides a `->` return type
  27. }