mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
- Adds an empty prelude.carbon file - Imports that file in any non-Core package file - Adds --disable-prelude-import to avoid that - Adds --exclude-dump-file-prefix to be able to hide files from dumping - Used to hide core files (we can't do this by package name due to lex dumps, for example) - Restructures some tests to not rely on `i32`, particularly `alias` tests (which rely on a name ref) and tests with no prelude. I'm adding the framework for switching i32 to calling Int32 in the prelude, but I'm running into a separate error actually switching over. So that *mostly* works, but isn't quite ready for prime time. However, maybe the current state of this PR is still useful to review since it does a lot of the infrastructure work and adds the %Core everywhere?
60 lines
2.7 KiB
Plaintext
60 lines
2.7 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
|
|
|
|
class Incomplete;
|
|
|
|
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:8: ERROR: Variable has incomplete type `[Incomplete; 1]`.
|
|
// CHECK:STDERR: var a: [Incomplete; 1];
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: Class was forward declared here.
|
|
// CHECK:STDERR: class Incomplete;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
|
var a: [Incomplete; 1];
|
|
|
|
var p: Incomplete* = &a[0];
|
|
|
|
// CHECK:STDOUT: --- fail_incomplete_element.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
|
|
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
|
|
// CHECK:STDOUT: %.2: type = array_type %.1, Incomplete [template]
|
|
// CHECK:STDOUT: %.3: type = ptr_type Incomplete [template]
|
|
// CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .Incomplete = %Incomplete.decl
|
|
// CHECK:STDOUT: .a = %a
|
|
// CHECK:STDOUT: .p = %p
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {}
|
|
// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
|
|
// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 [template = constants.%.1]
|
|
// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete [template = constants.%.2]
|
|
// CHECK:STDOUT: %a.var: ref <error> = var a
|
|
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
|
|
// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
|
|
// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3]
|
|
// CHECK:STDOUT: %p.var: ref Incomplete* = var p
|
|
// CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Incomplete;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: ref <error> = name_ref a, file.%a
|
|
// CHECK:STDOUT: %.loc17_25: i32 = int_literal 0 [template = constants.%.4]
|
|
// CHECK:STDOUT: %.loc17_22: <error> = addr_of <error> [template = <error>]
|
|
// CHECK:STDOUT: assign file.%p.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|