fail_redundant_int.carbon 567 B

1234567891011121314151617181920
  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. fn A(n: i32) -> i32 {
  8. match (n) {
  9. case 1 => { return 1; }
  10. // CHECK:STDERR: COMPILATION ERROR: fail_redundant_int.carbon:[[@LINE+1]]: unreachable case: all values matched by this case are matched by earlier cases
  11. case 1 => { return 2; }
  12. case (_: i32) => { return 3; }
  13. }
  14. }
  15. fn Main() -> i32 {
  16. return A(1);
  17. }