fail_symbolic.carbon 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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` [SemanticsTodo]
  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: %int_32: Core.IntLiteral = int_value 32 [template]
  21. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  22. // CHECK:STDOUT: %N.2: %i32 = bind_symbolic_name N, 0 [symbolic]
  23. // CHECK:STDOUT: %N.patt.2: %i32 = symbolic_binding_pattern 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: %Convert.type.9: type = fn_type @Convert.3, @impl.2(%int_32) [template]
  27. // CHECK:STDOUT: %Convert.9: %Convert.type.9 = struct_value () [template]
  28. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.2, %Convert.9 [symbolic]
  29. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(%int_32) [symbolic]
  30. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.2) [symbolic]
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: imports {
  34. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  35. // CHECK:STDOUT: .Int = %import_ref.1
  36. // CHECK:STDOUT: .ImplicitAs = %import_ref.5
  37. // CHECK:STDOUT: import Core//prelude
  38. // CHECK:STDOUT: import Core//prelude/...
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: file {
  43. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  44. // CHECK:STDOUT: .Core = imports.%Core
  45. // CHECK:STDOUT: .G = %G.decl
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: %Core.import = import Core
  48. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  49. // CHECK:STDOUT: %N.patt.loc12_6.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc12_6.2 (constants.%N.patt.2)]
  50. // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc12_6.1, runtime_param<invalid> [symbolic = %N.patt.loc12_6.2 (constants.%N.patt.2)]
  51. // CHECK:STDOUT: } {
  52. // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<invalid>
  53. // CHECK:STDOUT: %.loc12: type = splice_block %i32 [template = constants.%i32] {
  54. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  55. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: %N.loc12_6.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc12_6.2 (constants.%N.2)]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: generic fn @G(%N.loc12_6.1: %i32) {
  62. // CHECK:STDOUT: %N.loc12_6.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc12_6.2 (constants.%N.2)]
  63. // CHECK:STDOUT: %N.patt.loc12_6.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc12_6.2 (constants.%N.patt.2)]
  64. // CHECK:STDOUT:
  65. // CHECK:STDOUT: !definition:
  66. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc12_6.2, constants.%Convert.9 [symbolic = %Convert.bound (constants.%Convert.bound)]
  67. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn)]
  68. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.loc12_6.2) [symbolic = %int.convert_checked (constants.%int.convert_checked)]
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: fn(%N.param_patt: %i32) {
  71. // CHECK:STDOUT: !entry:
  72. // CHECK:STDOUT: %k.var: ref <error> = var k
  73. // CHECK:STDOUT: %k: ref <error> = bind_name k, %k.var
  74. // CHECK:STDOUT: return
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: specific @G(constants.%N.2) {
  79. // CHECK:STDOUT: %N.loc12_6.2 => constants.%N.2
  80. // CHECK:STDOUT: %N.patt.loc12_6.2 => constants.%N.2
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT: