fail_not_callable.carbon 992 B

1234567891011121314151617181920212223242526272829
  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]]:23: 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: constants {
  13. // CHECK:STDOUT: %.1: type = ptr_type String
  14. // CHECK:STDOUT: }
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: file "fail_not_callable.carbon" {
  17. // CHECK:STDOUT: %Run: <function> = fn_decl @Run
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: fn @Run() {
  21. // CHECK:STDOUT: !entry:
  22. // CHECK:STDOUT: %x.var: ref i32 = var x
  23. // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var
  24. // CHECK:STDOUT: %.loc11: String = string_literal "hello"
  25. // CHECK:STDOUT: assign %x.var, <error>
  26. // CHECK:STDOUT: return
  27. // CHECK:STDOUT: }