fail_storage_is_literal.carbon 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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. fn Main() {
  7. // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:10: ERROR: Cannot implicitly convert from `i32` to `type`.
  8. // CHECK:STDERR: var x: 1 = 1;
  9. // CHECK:STDERR: ^
  10. var x: 1 = 1;
  11. }
  12. // CHECK:STDOUT: --- fail_storage_is_literal.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
  16. // CHECK:STDOUT: }
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: file {
  19. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  20. // CHECK:STDOUT: .Main = %Main
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT: %Main: <function> = fn_decl @Main [template] {}
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: fn @Main() {
  26. // CHECK:STDOUT: !entry:
  27. // CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 [template = constants.%.1]
  28. // CHECK:STDOUT: %x.var: ref <error> = var x
  29. // CHECK:STDOUT: %x: ref <error> = bind_name x, %x.var
  30. // CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.1]
  31. // CHECK:STDOUT: assign %x.var, <error>
  32. // CHECK:STDOUT: return
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: