mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Replace form insts with actions (#7100)
See [here](https://docs.google.com/document/d/1rWcueFwIfZox6GKVGxiUG4cBzjrZ6djXiIDGyJDtrE4/edit?tab=t.0) for the design doc. This also removes the default value of the `result_type_inst_id` parameter of `HandleAction`, moves it before the action in the parameter list, and documents it. This solves two problems: - The default made it easy to forget, leading to unnecessary `TypeOfInst` instructions. - When it was present, putting it after the fairly "bulky" action argument tended to make the callsite harder to read.
This commit is contained in:
+8
-8
@@ -31,9 +31,9 @@ fn Call() {
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-12]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class C;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-11]]:21: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-11]]:18: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnCUsed() -> C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
ReturnCUsed();
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+10]]:3: error: function returns incomplete type `D` [IncompleteTypeInFunctionReturnType]
|
||||
@@ -42,9 +42,9 @@ fn Call() {
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-22]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class D;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-20]]:21: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-20]]:18: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnDUsed() -> D;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
ReturnDUsed();
|
||||
}
|
||||
@@ -66,9 +66,9 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDERR: class C;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_use_imported.carbon:[[@LINE-10]]:1: in import [InImport]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:7:23: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:7:20: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnCUnused() -> C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
ReturnCUnused();
|
||||
// CHECK:STDERR: fail_use_imported.carbon:[[@LINE+12]]:3: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType]
|
||||
@@ -79,9 +79,9 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDERR: class C;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_use_imported.carbon:[[@LINE-23]]:1: in import [InImport]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:8:21: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fail_incomplete_return.carbon:8:18: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnCUsed() -> C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
ReturnCUsed();
|
||||
ReturnDUnused();
|
||||
|
||||
@@ -53,14 +53,14 @@ fn G() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
||||
// CHECK:STDOUT: %.loc4_8.1: %pattern_type.7ce = ref_return_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern %.loc4_8.1, %i32 [concrete]
|
||||
// CHECK:STDOUT: %.loc4_11.1: %pattern_type.7ce = ref_return_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern %.loc4_11.1, %i32 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc4_11.1: type = ref_tag %i32
|
||||
// CHECK:STDOUT: %.loc4_11.2: Core.Form = ref_form %i32 [concrete = constants.%.1da]
|
||||
// CHECK:STDOUT: %.loc4_8.2: ref %i32 = ref_return
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %.loc4_8.2
|
||||
// CHECK:STDOUT: %.loc4_11.2: type = ref_tag %i32
|
||||
// CHECK:STDOUT: %.loc4_11.3: Core.Form = ref_form %i32 [concrete = constants.%.1da]
|
||||
// CHECK:STDOUT: %.loc4_11.4: ref %i32 = ref_return
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %.loc4_11.4
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user