fail_symbolic.carbon 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/fail_symbolic.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/fail_symbolic.carbon
  10. // TODO: This should work.
  11. fn G(N:! i32) {
  12. // CHECK:STDERR: fail_symbolic.carbon:[[@LINE+3]]:16: ERROR: Semantics TODO: `symbolic array bound`.
  13. // CHECK:STDERR: var k: [i32; N];
  14. // CHECK:STDERR: ^
  15. var k: [i32; N];
  16. }
  17. // CHECK:STDOUT: --- fail_symbolic.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  21. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  22. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  23. // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic]
  24. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  25. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: file {
  29. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  30. // CHECK:STDOUT: .Core = %Core
  31. // CHECK:STDOUT: .G = %G.decl
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  34. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  35. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  36. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  37. // CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  38. // CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32]
  39. // CHECK:STDOUT: %N.loc12_6.1: i32 = param N
  40. // CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N 0, %N.loc12_6.1 [symbolic = constants.%N]
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @G(%N: i32)
  48. // CHECK:STDOUT: generic [%N: i32] {
  49. // CHECK:STDOUT: !entry:
  50. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  51. // CHECK:STDOUT: %N.ref: i32 = name_ref N, %N [symbolic = constants.%N]
  52. // CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
  53. // CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32, %.loc16_11.1 [template = i32]
  54. // CHECK:STDOUT: %.loc16_17: type = array_type %N.ref, i32 [template = <error>]
  55. // CHECK:STDOUT: %k.var: ref <error> = var k
  56. // CHECK:STDOUT: %k: ref <error> = bind_name k, %k.var
  57. // CHECK:STDOUT: return
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: