fail_not_callable.carbon 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 Run() {
  7. // CHECK:STDERR: fail_not_callable.carbon:[[@LINE+3]]:16: ERROR: Value of type `String` is not callable.
  8. // CHECK:STDERR: var x: i32 = "hello"();
  9. // CHECK:STDERR: ^~~~~~~~
  10. var x: i32 = "hello"();
  11. }
  12. // CHECK:STDOUT: --- fail_not_callable.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %Run: type = fn_type @Run [template]
  16. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  17. // CHECK:STDOUT: %struct: Run = struct_value () [template]
  18. // CHECK:STDOUT: %.2: type = ptr_type String [template]
  19. // CHECK:STDOUT: %.3: String = string_literal "hello" [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .Core = %Core
  25. // CHECK:STDOUT: .Run = %Run.decl
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  28. // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {}
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: fn @Run() {
  32. // CHECK:STDOUT: !entry:
  33. // CHECK:STDOUT: %x.var: ref i32 = var x
  34. // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var
  35. // CHECK:STDOUT: %.loc11: String = string_literal "hello" [template = constants.%.3]
  36. // CHECK:STDOUT: assign %x.var, <error>
  37. // CHECK:STDOUT: return
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: