fail_params.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/alias/no_prelude/fail_params.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_params.carbon
  10. // CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: ERROR: `alias` declaration cannot have parameters.
  11. // CHECK:STDERR: alias A(T:! type) = T*;
  12. // CHECK:STDERR: ^~~~~~~~~~
  13. // CHECK:STDERR:
  14. // CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:21: ERROR: Alias initializer must be a name reference.
  15. // CHECK:STDERR: alias A(T:! type) = T*;
  16. // CHECK:STDERR: ^~
  17. alias A(T:! type) = T*;
  18. // CHECK:STDOUT: --- fail_params.carbon
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  22. // CHECK:STDOUT: %.1: type = ptr_type %T [symbolic]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  27. // CHECK:STDOUT: .A = %A
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %T.loc18_9.1: type = param T
  30. // CHECK:STDOUT: %T.loc18_9.2: type = bind_symbolic_name T 0, %T.loc18_9.1 [symbolic = constants.%T]
  31. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_9.2 [symbolic = constants.%T]
  32. // CHECK:STDOUT: %.loc18: type = ptr_type %T [symbolic = constants.%.1]
  33. // CHECK:STDOUT: %A: <error> = bind_alias A, <error> [template = <error>]
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: