Split apart some tests which don't need the prelude. (#3904)

This could probably go further, but I'm just trying to get the ability
to run some significant tests without the prelude. This already requires
some migration of `i32` and `bool` to non-prelude-dependent types
(technically not at the moment, but I'm trying to stick with the
philosophical model of the prelude).

Note this undoes part of #3895 which had made all lex/parse tests depend
on the prelude -- I don't think that was a necessary change. Rather, it
seems better to isolate individual lex/parse tests from the prelude. I'd
been on the fence in that PR (it was fixing one of the issues that
contributed to wanting to not include the prelude), but now it feels
more consistent. The prelude could have a parse error and we shouldn't
break every parse test on that.
This commit is contained in:
Jon Ross-Perkins
2024-04-24 20:16:48 +00:00
committed by GitHub
parent 8f8277b450
commit de4c32beb5
104 changed files with 1586 additions and 1176 deletions
@@ -56,10 +56,8 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -69,10 +67,8 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F.loc4
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.loc4: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.loc12: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: }
@@ -83,10 +79,8 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F.loc12
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F.loc4: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: %F.loc12: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: }
@@ -102,10 +96,8 @@ class C {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -81,7 +81,6 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: .D = %D.decl.loc5
// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused
@@ -90,7 +89,6 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed
// CHECK:STDOUT: .Call = %Call
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %D.decl.loc5: type = class_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %ReturnCUnused: <function> = fn_decl @ReturnCUnused [template] {
@@ -156,19 +154,17 @@ fn CallFAndGIncomplete() {
// CHECK:STDOUT: .ReturnDUnused = %import_ref.5
// CHECK:STDOUT: .ReturnDUsed = %import_ref.6
// CHECK:STDOUT: .Call = %import_ref.7
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+4, unloaded
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+8, loc_14 [template = imports.%ReturnCUnused]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+11, loc_18 [template = imports.%ReturnCUsed]
// CHECK:STDOUT: %import_ref.5: <function> = import_ref ir1, inst+14, loc_22 [template = imports.%ReturnDUnused]
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+17, loc_26 [template = imports.%ReturnDUsed]
// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+18, unloaded
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unloaded
// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unloaded
// CHECK:STDOUT: %import_ref.3: <function> = import_ref ir1, inst+7, loc_14 [template = imports.%ReturnCUnused]
// CHECK:STDOUT: %import_ref.4: <function> = import_ref ir1, inst+10, loc_18 [template = imports.%ReturnCUsed]
// CHECK:STDOUT: %import_ref.5: <function> = import_ref ir1, inst+13, loc_22 [template = imports.%ReturnDUnused]
// CHECK:STDOUT: %import_ref.6: <function> = import_ref ir1, inst+16, loc_26 [template = imports.%ReturnDUsed]
// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+17, unloaded
// CHECK:STDOUT: %CallFAndGIncomplete: <function> = fn_decl @CallFAndGIncomplete [template] {}
// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+5, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+4, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @C;
@@ -98,7 +98,6 @@ extern private fn ExternOrderAndConflict() {}
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .WrongOrder = %WrongOrder
// CHECK:STDOUT: .DuplicateVirtual = %DuplicateVirtual
// CHECK:STDOUT: .TwoAccess = %TwoAccess
@@ -107,7 +106,6 @@ extern private fn ExternOrderAndConflict() {}
// CHECK:STDOUT: .ModifiersConflict2 = %ModifiersConflict2
// CHECK:STDOUT: .ExternOrderAndConflict = %ExternOrderAndConflict
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %WrongOrder: <function> = fn_decl @WrongOrder [template] {}
// CHECK:STDOUT: %DuplicateVirtual: <function> = fn_decl @DuplicateVirtual [template] {}
// CHECK:STDOUT: %TwoAccess: <function> = fn_decl @TwoAccess [template] {}
@@ -14,25 +14,25 @@ fn A();
// CHECK:STDERR:
fn A();
fn B(x: i32);
fn B(x: ());
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn B` is redundant.
// CHECK:STDERR: fn B(x: i32);
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fn B(x: ());
// CHECK:STDERR: ^~~~~~~~~~~~
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared here.
// CHECK:STDERR: fn B(x: i32);
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fn B(x: ());
// CHECK:STDERR: ^~~~~~~~~~~~
// CHECK:STDERR:
fn B(x: i32);
fn B(x: ());
fn C();
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Function redeclaration differs because of parameter count of 1.
// CHECK:STDERR: fn C(x: i32);
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fn C(x: ());
// CHECK:STDERR: ^~~~~~~~~~~~
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared with parameter count of 0.
// CHECK:STDERR: fn C();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
fn C(x: i32);
fn C(x: ());
fn D() {}
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn D` is redundant.
@@ -55,30 +55,38 @@ fn E() {}
// CHECK:STDOUT: --- fail_redecl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A.loc7
// CHECK:STDOUT: .B = %B.loc17
// CHECK:STDOUT: .C = %C
// CHECK:STDOUT: .D = %D.loc37
// CHECK:STDOUT: .E = %E.loc47
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.loc7: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %A.loc15: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: %B.loc17: <function> = fn_decl @B [template] {
// CHECK:STDOUT: %x.loc17_6.1: i32 = param x
// CHECK:STDOUT: @B.%x: i32 = bind_name x, %x.loc17_6.1
// CHECK:STDOUT: %.loc17_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc17_6.1: () = param x
// CHECK:STDOUT: @B.%x: () = bind_name x, %x.loc17_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %B.loc25: <function> = fn_decl @B [template] {
// CHECK:STDOUT: %x.loc25_6.1: i32 = param x
// CHECK:STDOUT: %x.loc25_6.2: i32 = bind_name x, %x.loc25_6.1
// CHECK:STDOUT: %.loc25_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc25_10.2: type = converted %.loc25_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc25_6.1: () = param x
// CHECK:STDOUT: %x.loc25_6.2: () = bind_name x, %x.loc25_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %C: <function> = fn_decl @C [template] {}
// CHECK:STDOUT: %.loc35: <function> = fn_decl @.1 [template] {
// CHECK:STDOUT: %x.loc35_6.1: i32 = param x
// CHECK:STDOUT: @.1.%x: i32 = bind_name x, %x.loc35_6.1
// CHECK:STDOUT: %.loc35_12: <function> = fn_decl @.1 [template] {
// CHECK:STDOUT: %.loc35_10.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc35_10.2: type = converted %.loc35_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.loc35_6.1: () = param x
// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc35_6.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %D.loc37: <function> = fn_decl @D [template] {}
// CHECK:STDOUT: %D.loc45: <function> = fn_decl @D [template] {}
@@ -88,11 +96,11 @@ fn E() {}
// CHECK:STDOUT:
// CHECK:STDOUT: fn @A();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @B(%x: i32);
// CHECK:STDOUT: fn @B(%x: ());
// CHECK:STDOUT:
// CHECK:STDOUT: fn @C();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @.1(%x: i32);
// CHECK:STDOUT: fn @.1(%x: ());
// CHECK:STDOUT:
// CHECK:STDOUT: fn @D() {
// CHECK:STDOUT: !entry:
@@ -13,10 +13,8 @@ private fn F();
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -63,10 +63,8 @@ extern fn A();
// 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:
@@ -76,11 +74,9 @@ extern fn A();
// 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 ir0, inst+2, loaded [template = imports.%A]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -90,10 +86,8 @@ extern fn A();
// 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:
@@ -103,11 +97,9 @@ extern fn A();
// 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 ir0, inst+2, loaded [template = imports.%A]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -117,10 +109,8 @@ extern fn A();
// 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:
@@ -130,11 +120,9 @@ extern fn A();
// 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 ir0, inst+2, loaded [template = imports.%A]
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %import_ref: <function> = import_ref ir0, inst+1, loaded [template = imports.%A]
// CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -16,11 +16,9 @@ fn G() { F(); }
// 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: %G: <function> = fn_decl @G [template] {}
// CHECK:STDOUT: }