generic.carbon 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/generic.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/generic.carbon
  14. // --- fail_todo_type.carbon
  15. library "[[@TEST_NAME]]";
  16. fn F() {
  17. // CHECK:STDERR: fail_todo_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `local `let :!` bindings are currently unsupported` [SemanticsTodo]
  18. // CHECK:STDERR: let T:! type = i32;
  19. // CHECK:STDERR: ^~~~~~~~
  20. // CHECK:STDERR:
  21. let T:! type = i32;
  22. var p: T*;
  23. let a: T = *p;
  24. }
  25. // --- fail_todo_assignment.carbon
  26. library "[[@TEST_NAME]]";
  27. fn F(a: i32) -> i32 {
  28. // CHECK:STDERR: fail_todo_assignment.carbon:[[@LINE+4]]:7: error: semantics TODO: `local `let :!` bindings are currently unsupported` [SemanticsTodo]
  29. // CHECK:STDERR: let T:! type = i32;
  30. // CHECK:STDERR: ^~~~~~~~
  31. // CHECK:STDERR:
  32. let T:! type = i32;
  33. let x: T = 5;
  34. return x;
  35. }
  36. // CHECK:STDOUT: --- fail_todo_type.carbon
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: constants {
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @F();
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: --- fail_todo_assignment.carbon
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: constants {
  46. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  47. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: fn @F(%a.param: %i32) -> %i32;
  51. // CHECK:STDOUT: