mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 07:48:13 +00:00
This replaces the use of `VarStorage` in this case. Add an `UnboundFieldType` type as the type of a field, in cases where it's referenced without an accompanying object. Add a `BindName` node to describe the name binding performed for both variables and fields so that we can handle them more uniformly.
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
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+6]]:24: ERROR: Semantics TODO: `Not a callable name`.
|
|
// CHECK:STDERR: var x: i32 = "hello"();
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR: fail_not_callable.carbon:[[@LINE+3]]:25: ERROR: Cannot implicitly convert from `String` to `i32`.
|
|
// CHECK:STDERR: var x: i32 = "hello"();
|
|
// CHECK:STDERR: ^
|
|
var x: i32 = "hello"();
|
|
}
|
|
|
|
// 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: %.1: type = ptr_type String
|
|
// CHECK:STDOUT: %.loc14: String = string_literal "hello"
|
|
// CHECK:STDOUT: assign %x.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|