mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 22:02:41 +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?
143 lines
4.4 KiB
Plaintext
143 lines
4.4 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
|
|
|
|
// --- basic.carbon
|
|
|
|
library "basic" api;
|
|
|
|
fn A();
|
|
|
|
// --- basic.impl.carbon
|
|
|
|
library "basic" impl;
|
|
|
|
fn A();
|
|
|
|
// --- extern_api.carbon
|
|
|
|
library "extern_api" api;
|
|
|
|
extern fn A();
|
|
|
|
// --- fail_extern_api.impl.carbon
|
|
|
|
library "extern_api" impl;
|
|
|
|
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+10]]:1: ERROR: Redeclarations in the same library must match use of `extern`.
|
|
// CHECK:STDERR: fn A();
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:1: In import.
|
|
// CHECK:STDERR: library "extern_api" impl;
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR: extern_api.carbon:4:1: Previously declared here.
|
|
// CHECK:STDERR: extern fn A();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn A();
|
|
|
|
// --- extern_impl.carbon
|
|
|
|
library "extern_impl" api;
|
|
|
|
fn A();
|
|
|
|
// --- fail_extern_impl.impl.carbon
|
|
|
|
library "extern_impl" impl;
|
|
|
|
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+9]]:1: ERROR: Redeclarations in the same library must match use of `extern`.
|
|
// CHECK:STDERR: extern fn A();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:1: In import.
|
|
// CHECK:STDERR: library "extern_impl" impl;
|
|
// CHECK:STDERR: ^~~~~~~
|
|
// CHECK:STDERR: extern_impl.carbon:4:1: Previously declared here.
|
|
// CHECK:STDERR: fn A();
|
|
// CHECK:STDERR: ^~~~~~~
|
|
extern fn A();
|
|
|
|
// CHECK:STDOUT: --- basic.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @A();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- basic.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %import_ref: <function> = import_ref ir1, inst+2, loaded [template = imports.%A]
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @A();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- extern_api.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: extern fn @A();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_api.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %import_ref: <function> = import_ref ir1, inst+2, loaded [template = imports.%A]
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @A();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- extern_impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @A();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_impl.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .A = %A
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %import_ref: <function> = import_ref ir1, inst+2, loaded [template = imports.%A]
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: extern fn @A();
|
|
// CHECK:STDOUT:
|