Files
carbon-lang/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
T
Jon Ross-Perkins 30155dbb72 Add support for 'package' in expressions. (#3445)
This creates a namespace for `package` scope.

It looks like names of class_decls in namespaces lead to an unexpected
instref. This is already true, as best as I can tell. I'm not sure if
there's a preferred approach to address that, so I've left a TODO for
now.
2023-12-04 21:05:41 +00:00

25 lines
923 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
var x: i32;
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:15: ERROR: Type `i32` does not support qualified expressions.
// CHECK:STDERR: var y: i32 = x.b;
// CHECK:STDERR: ^
var y: i32 = x.b;
// CHECK:STDOUT: --- fail_qualifier_unsupported.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {.x = %x, .y = %y}
// CHECK:STDOUT: %x.var: ref i32 = var x
// CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var
// CHECK:STDOUT: %y.var: ref i32 = var y
// CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var
// CHECK:STDOUT: %x.ref: ref i32 = name_ref x, %x
// CHECK:STDOUT: assign %y.var, <error>
// CHECK:STDOUT: }
// CHECK:STDOUT: