mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 23:20:28 +00:00
Adds `BindAlias` with a hybrid of `BindName` and `NameRef` semantics. I think it's slightly closer to `BindName` because it introduces a name, so I'm going more in that direction. This also matches the need for `bind_name_id` with imports on enclosing scopes. Note, only things that look like a name reference are being allowed on the RHS of `alias`. This includes builtins that look like name references, such as `bool`, but not ones that turn into values underneath, such as `false`.
43 lines
2.1 KiB
Plaintext
43 lines
2.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
|
|
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:1: ERROR: `abstract` not allowed on `alias` declaration.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:10: ERROR: `base` not allowed on declaration with `abstract`.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: `abstract` previously appeared here.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+12]]:15: ERROR: `default` not allowed on declaration with `abstract`.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+9]]:1: `abstract` previously appeared here.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+6]]:23: ERROR: `final` not allowed on declaration with `abstract`.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: `abstract` previously appeared here.
|
|
// CHECK:STDERR: abstract base default final alias A = i32;
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
abstract base default final alias A = i32;
|
|
|
|
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `impl` not allowed on `alias` declaration.
|
|
// CHECK:STDERR: impl alias B = i32;
|
|
// CHECK:STDERR: ^~~~
|
|
impl alias B = i32;
|
|
|
|
// CHECK:STDOUT: --- fail_modifiers.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace {.A = %A, .B = %B} [template]
|
|
// CHECK:STDOUT: %A: type = bind_alias A, i32 [template = i32]
|
|
// CHECK:STDOUT: %B: type = bind_alias B, i32 [template = i32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|