mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 12:45:48 +01:00
Add a `NameId` that is effectively just a wrapper around a `StringId`, with some additional predefined values for names that don't correspond to strings, such as the name of `self` or the function's return slot.
30 lines
992 B
Plaintext
30 lines
992 B
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
|
|
fn Run() {
|
|
// CHECK:STDERR: fail_not_callable.carbon:[[@LINE+3]]:23: ERROR: Value of type `String` is not callable.
|
|
// CHECK:STDERR: var x: i32 = "hello"();
|
|
// CHECK:STDERR: ^
|
|
var x: i32 = "hello"();
|
|
}
|
|
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %.1: type = ptr_type String
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file "fail_not_callable.carbon" {
|
|
// CHECK:STDOUT: %Run: <function> = fn_decl @Run
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Run() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %x.var: ref i32 = var x
|
|
// CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var
|
|
// CHECK:STDOUT: %.loc11: String = string_literal "hello"
|
|
// CHECK:STDOUT: assign %x.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|