mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Start including the prelude for testing. (#3861)
- 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?
This commit is contained in:
@@ -26,9 +26,11 @@ fn G() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .G = %G
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32)
|
||||
// CHECK:STDOUT: %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2]
|
||||
|
||||
@@ -28,8 +28,10 @@ fn G() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .G = %G
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %G: <function> = fn_decl @G [template] {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -24,9 +24,11 @@ fn Run() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .Run = %Run
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32)
|
||||
// CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2]
|
||||
|
||||
@@ -24,9 +24,11 @@ var b: [i32; 3] = a;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .b = %b
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc7_22.1: (type, type, type) = tuple_literal (i32, i32, i32)
|
||||
// CHECK:STDOUT: %.loc7_22.2: type = converted %.loc7_22.1, constants.%.2 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref (i32, i32, i32) = var a
|
||||
|
||||
+2
@@ -37,10 +37,12 @@ var c: [(); 5] = ((), (), (), (), (),);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .b = %b
|
||||
// CHECK:STDOUT: .c = %c
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
|
||||
|
||||
@@ -24,9 +24,11 @@ let b: [i32; 3]* = &a;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .Add = %Add
|
||||
// CHECK:STDOUT: .a = %a.loc9
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %Add: <function> = fn_decl @Add [template] {
|
||||
// CHECK:STDOUT: %a.loc7_8.1: i32 = param a
|
||||
// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1
|
||||
|
||||
@@ -20,9 +20,11 @@ var a: [i32; Negate(1)];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .Negate = %Negate
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %Negate: <function> = fn_decl @Negate [template] {
|
||||
// CHECK:STDOUT: %n.loc7_11.1: i32 = param n
|
||||
// CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc7_11.1
|
||||
|
||||
@@ -30,9 +30,11 @@ var b: [1; 39999999999999999993];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .b = %b
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc14: type = array_type <error>, i32 [template = <error>]
|
||||
// CHECK:STDOUT: %a.var: ref <error> = var a
|
||||
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
|
||||
|
||||
@@ -28,10 +28,12 @@ var p: Incomplete* = &a[0];
|
||||
// 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]
|
||||
|
||||
@@ -17,8 +17,10 @@ var a: [1; 1];
|
||||
// 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: %.loc10_9: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, <error> [template = <error>]
|
||||
|
||||
@@ -22,8 +22,10 @@ var a: [i32; 1] = (1, 2, 3);
|
||||
// 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: %.loc10_14: i32 = int_literal 1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 1] = var a
|
||||
|
||||
@@ -27,9 +27,11 @@ var b: i32 = a[{.index = 3}.index];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .b = %b
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
|
||||
|
||||
@@ -52,6 +52,7 @@ var d: [i32; 3] = t2;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .t1 = %t1
|
||||
// CHECK:STDOUT: .b = %b
|
||||
@@ -59,6 +60,7 @@ var d: [i32; 3] = t2;
|
||||
// CHECK:STDOUT: .t2 = %t2
|
||||
// CHECK:STDOUT: .d = %d
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
|
||||
|
||||
@@ -27,9 +27,11 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .F = %F
|
||||
// CHECK:STDOUT: .G = %G
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
|
||||
// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2]
|
||||
|
||||
@@ -24,9 +24,11 @@ var b: i32 = a[{.index = 2}.index];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
||||
// CHECK:STDOUT: .Core = %Core
|
||||
// CHECK:STDOUT: .a = %a
|
||||
// CHECK:STDOUT: .b = %b
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 3] = var a
|
||||
|
||||
@@ -27,8 +27,10 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
// 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: %.loc7_14: i32 = int_literal 9 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %a.var: ref [i32; 9] = var a
|
||||
|
||||
Reference in New Issue
Block a user