collapse.carbon 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. // OK, `const (const i32)` is the same type as `const i32`.
  7. // CHECK:STDERR: collapse.carbon:[[@LINE+3]]:25: `const` applied repeatedly to the same type has no additional effect.
  8. // CHECK:STDERR: fn F(p: const i32**) -> const (const i32)** {
  9. // CHECK:STDERR: ^
  10. fn F(p: const i32**) -> const (const i32)** {
  11. return p;
  12. }
  13. // CHECK:STDOUT: cross_reference_irs_size: 1
  14. // CHECK:STDOUT: functions: [
  15. // CHECK:STDOUT: {name: str0, param_refs: block2, return_type: type3, body: [block4]},
  16. // CHECK:STDOUT: ]
  17. // CHECK:STDOUT: integer_literals: [
  18. // CHECK:STDOUT: ]
  19. // CHECK:STDOUT: real_literals: [
  20. // CHECK:STDOUT: ]
  21. // CHECK:STDOUT: strings: [
  22. // CHECK:STDOUT: F,
  23. // CHECK:STDOUT: p,
  24. // CHECK:STDOUT: ]
  25. // CHECK:STDOUT: types: [
  26. // CHECK:STDOUT: nodeIntegerType,
  27. // CHECK:STDOUT: node+0,
  28. // CHECK:STDOUT: node+1,
  29. // CHECK:STDOUT: node+2,
  30. // CHECK:STDOUT: ]
  31. // CHECK:STDOUT: type_blocks: [
  32. // CHECK:STDOUT: ]
  33. // CHECK:STDOUT: nodes: [
  34. // CHECK:STDOUT: {kind: ConstType, arg0: type0, type: typeTypeType},
  35. // CHECK:STDOUT: {kind: PointerType, arg0: type1, type: typeTypeType},
  36. // CHECK:STDOUT: {kind: PointerType, arg0: type2, type: typeTypeType},
  37. // CHECK:STDOUT: {kind: VarStorage, arg0: str1, type: type3},
  38. // CHECK:STDOUT: {kind: ConstType, arg0: type0, type: typeTypeType},
  39. // CHECK:STDOUT: {kind: ConstType, arg0: type1, type: typeTypeType},
  40. // CHECK:STDOUT: {kind: PointerType, arg0: type1, type: typeTypeType},
  41. // CHECK:STDOUT: {kind: PointerType, arg0: type2, type: typeTypeType},
  42. // CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0},
  43. // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+3},
  44. // CHECK:STDOUT: ]
  45. // CHECK:STDOUT: node_blocks: [
  46. // CHECK:STDOUT: [
  47. // CHECK:STDOUT: ],
  48. // CHECK:STDOUT: [
  49. // CHECK:STDOUT: node+0,
  50. // CHECK:STDOUT: node+1,
  51. // CHECK:STDOUT: node+2,
  52. // CHECK:STDOUT: node+3,
  53. // CHECK:STDOUT: ],
  54. // CHECK:STDOUT: [
  55. // CHECK:STDOUT: node+3,
  56. // CHECK:STDOUT: ],
  57. // CHECK:STDOUT: [
  58. // CHECK:STDOUT: node+4,
  59. // CHECK:STDOUT: node+5,
  60. // CHECK:STDOUT: node+6,
  61. // CHECK:STDOUT: node+7,
  62. // CHECK:STDOUT: node+8,
  63. // CHECK:STDOUT: ],
  64. // CHECK:STDOUT: [
  65. // CHECK:STDOUT: node+9,
  66. // CHECK:STDOUT: ],
  67. // CHECK:STDOUT: ]
  68. // CHECK:STDOUT:
  69. // CHECK:STDOUT: package {
  70. // CHECK:STDOUT: %.loc11_32: type = const_type i32
  71. // CHECK:STDOUT: %.loc11_25: type = const_type const i32
  72. // CHECK:STDOUT: %.loc11_42: type = ptr_type const i32
  73. // CHECK:STDOUT: %.loc11_43: type = ptr_type const i32*
  74. // CHECK:STDOUT: %.loc11_1 = fn_decl @F
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: fn @F(%p: const i32**) -> const i32** {
  78. // CHECK:STDOUT: !entry:
  79. // CHECK:STDOUT: return %p
  80. // CHECK:STDOUT: }