mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Reduce use of the prelude in tests (#5683)
Remove use of i32/bool when a builtin type or test-define class type can work. Make `Sub` user-defines in a test that is testing builtin functions and not trying to test the prelude, in the same way that it defines its own Negate. Reduce use of the + operator when it isn't contributing to the test's coverage, since the + operator needs the full prelude. Remove use of Core.Print when it's not required for the test. Move `deduce_nested_facet_value.carbon` to its own file since it uses TypeAnd, and the rest of deduce.carbon does not, but uses i32. This means they can each use a different min-prelude. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
fd0f62f980
commit
19d59b2a8d
@@ -78,7 +78,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
fn Negate(n: i32) -> i32 = "int.snegate";
|
||||
fn Negate(a: IntLiteral()) -> IntLiteral() = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: var n: Int(Negate(1));
|
||||
|
||||
+3
-2
@@ -30,14 +30,15 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn Negate(a: Core.IntLiteral()) -> Core.IntLiteral() = "int.snegate";
|
||||
fn Sub(a: Core.IntLiteral(), b: Core.IntLiteral()) -> Core.IntLiteral() = "int.ssub";
|
||||
|
||||
class Expect(N:! Core.IntLiteral()) {}
|
||||
fn Test(N:! Core.IntLiteral()) -> Expect(N) { return {}; }
|
||||
|
||||
fn F() {
|
||||
Test(Negate(0)) as Expect(0);
|
||||
Test(Negate(1)) as Expect(0 - 1);
|
||||
Test(Negate(0 - 0x8000_0000_0000_0000)) as Expect(0x8000_0000_0000_0000);
|
||||
Test(Negate(1)) as Expect(Sub(0, 1));
|
||||
Test(Negate(Sub(0, 0x8000_0000_0000_0000))) as Expect(0x8000_0000_0000_0000);
|
||||
}
|
||||
|
||||
// --- fail_too_few.carbon
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon
|
||||
@@ -20,63 +17,5 @@ class C {
|
||||
}
|
||||
|
||||
fn Make() -> C {
|
||||
return {.a = 123};
|
||||
return {.a = ()};
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- fail_convert_to_invalid.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete]
|
||||
// CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: Core.IntLiteral} [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .C = %C.decl
|
||||
// CHECK:STDOUT: .NoSuchType = <poisoned>
|
||||
// CHECK:STDOUT: .Make = %Make.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %Make.decl: %Make.type = fn_decl @Make [concrete = constants.%Make] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %return.param: ref %C = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @C {
|
||||
// CHECK:STDOUT: %NoSuchType.ref: <error> = name_ref NoSuchType, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19: <error> = field_decl a, element0 [concrete]
|
||||
// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: <error>} [concrete = <error>]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.a [concrete = <error>]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%C
|
||||
// CHECK:STDOUT: .NoSuchType = <poisoned>
|
||||
// CHECK:STDOUT: .a = %.loc19
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Make() -> %return.param: %C {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123]
|
||||
// CHECK:STDOUT: %.loc23: %struct_type.a = struct_literal (%int_123)
|
||||
// CHECK:STDOUT: return <error> to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+11
-157
@@ -2,15 +2,14 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_generic_method.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_generic_method.carbon
|
||||
|
||||
class I {}
|
||||
|
||||
class Class(T:! type) {
|
||||
var a: T;
|
||||
fn F[self: Self](n: T);
|
||||
@@ -18,164 +17,19 @@ class Class(T:! type) {
|
||||
|
||||
// TODO: The follow-on errors here aren't great. Investigate whether we can
|
||||
// enter the scope anyway if the parameters don't match.
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+15]]:10: error: type `<pattern for i32>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+15]]:10: error: type `<pattern for I>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
|
||||
// CHECK:STDERR: fn Class(N:! I).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-10]]:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: class Class(T:! type) {
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+8]]:27: error: name `Self` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+8]]:25: error: name `Self` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! I).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:36: error: name `T` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:34: error: name `T` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! I).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
|
||||
// CHECK:STDOUT: --- fail_generic_method.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
|
||||
// CHECK:STDOUT: %Class.type: type = generic_class_type @Class [concrete]
|
||||
// CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic]
|
||||
// CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
|
||||
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.3c1: type = pattern_type %Class [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
|
||||
// CHECK:STDOUT: %F.type.6d6: type = fn_type @F.1, @Class(%T) [symbolic]
|
||||
// CHECK:STDOUT: %F.cca: %F.type.6d6 = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %T} [symbolic]
|
||||
// CHECK:STDOUT: %complete_type.f1b: <witness> = complete_type_witness %struct_type.a [symbolic]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [concrete]
|
||||
// CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Class = %Class.decl
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %T.loc14_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_13.2 (constants.%T)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [concrete = constants.%F.c41] {
|
||||
// CHECK:STDOUT: %self.patt: <error> = binding_pattern self [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt: <error> = value_param_pattern %self.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %n.patt: <error> = binding_pattern n [concrete]
|
||||
// CHECK:STDOUT: %n.param_patt: <error> = value_param_pattern %n.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc36: type = splice_block %i32 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %N.loc36_10.1: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc36_10.2 (constants.%N.51e)]
|
||||
// CHECK:STDOUT: %self.param: <error> = value_param call_param0
|
||||
// CHECK:STDOUT: %Self.ref: <error> = name_ref Self, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %self: <error> = bind_name self, %self.param [concrete = <error>]
|
||||
// CHECK:STDOUT: %n.param: <error> = value_param call_param1
|
||||
// CHECK:STDOUT: %T.ref: <error> = name_ref T, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %n: <error> = bind_name n, %n.param [concrete = <error>]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @Class(%T.loc14_13.1: type) {
|
||||
// CHECK:STDOUT: %T.loc14_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_13.2 (constants.%T)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc14_13.2 [symbolic = %require_complete (constants.%require_complete.4ae)]
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc14_13.2) [symbolic = %Class (constants.%Class)]
|
||||
// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.loc14_13.2 [symbolic = %Class.elem (constants.%Class.elem)]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F.1, @Class(%T.loc14_13.2) [symbolic = %F.type (constants.%F.type.6d6)]
|
||||
// CHECK:STDOUT: %F: @Class.%F.type (%F.type.6d6) = struct_value () [symbolic = %F (constants.%F.cca)]
|
||||
// CHECK:STDOUT: %struct_type.a.loc17_1.2: type = struct_type {.a: @Class.%T.loc14_13.2 (%T)} [symbolic = %struct_type.a.loc17_1.2 (constants.%struct_type.a)]
|
||||
// CHECK:STDOUT: %complete_type.loc17_1.2: <witness> = complete_type_witness %struct_type.a.loc17_1.2 [symbolic = %complete_type.loc17_1.2 (constants.%complete_type.f1b)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_13.1 [symbolic = %T.loc14_13.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %.loc15: @Class.%Class.elem (%Class.elem) = field_decl a, element0 [concrete]
|
||||
// CHECK:STDOUT: %F.decl: @Class.%F.type (%F.type.6d6) = fn_decl @F.1 [symbolic = @Class.%F (constants.%F.cca)] {
|
||||
// CHECK:STDOUT: %self.patt: @F.1.%pattern_type.loc16_8 (%pattern_type.3c1) = binding_pattern self [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt: @F.1.%pattern_type.loc16_8 (%pattern_type.3c1) = value_param_pattern %self.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %n.patt: @F.1.%pattern_type.loc16_20 (%pattern_type.7dc) = binding_pattern n [concrete]
|
||||
// CHECK:STDOUT: %n.param_patt: @F.1.%pattern_type.loc16_20 (%pattern_type.7dc) = value_param_pattern %n.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: @F.1.%Class (%Class) = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc16_14.1: type = splice_block %Self.ref [symbolic = %Class (constants.%Class)] {
|
||||
// CHECK:STDOUT: %.loc16_14.2: type = specific_constant constants.%Class, @Class(constants.%T) [symbolic = %Class (constants.%Class)]
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc16_14.2 [symbolic = %Class (constants.%Class)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %self: @F.1.%Class (%Class) = bind_name self, %self.param
|
||||
// CHECK:STDOUT: %n.param: @F.1.%T (%T) = value_param call_param1
|
||||
// CHECK:STDOUT: %T.ref: type = name_ref T, @Class.%T.loc14_13.1 [symbolic = %T (constants.%T)]
|
||||
// CHECK:STDOUT: %n: @F.1.%T (%T) = bind_name n, %n.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %struct_type.a.loc17_1.1: type = struct_type {.a: %T} [symbolic = %struct_type.a.loc17_1.2 (constants.%struct_type.a)]
|
||||
// CHECK:STDOUT: %complete_type.loc17_1.1: <witness> = complete_type_witness %struct_type.a.loc17_1.1 [symbolic = %complete_type.loc17_1.2 (constants.%complete_type.f1b)]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type.loc17_1.1
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%Class
|
||||
// CHECK:STDOUT: .T = <poisoned>
|
||||
// CHECK:STDOUT: .a = %.loc15
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic fn @F.1(@Class.%T.loc14_13.1: type) {
|
||||
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class)]
|
||||
// CHECK:STDOUT: %pattern_type.loc16_8: type = pattern_type %Class [symbolic = %pattern_type.loc16_8 (constants.%pattern_type.3c1)]
|
||||
// CHECK:STDOUT: %pattern_type.loc16_20: type = pattern_type %T [symbolic = %pattern_type.loc16_20 (constants.%pattern_type.7dc)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%self.param: @F.1.%Class (%Class), %n.param: @F.1.%T (%T));
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic fn @F.2(%N.loc36_10.1: %i32) {
|
||||
// CHECK:STDOUT: %N.loc36_10.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc36_10.2 (constants.%N.51e)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%self.param: <error>, %n.param: <error>) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @Class(constants.%T) {
|
||||
// CHECK:STDOUT: %T.loc14_13.2 => constants.%T
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @F.1(constants.%T) {
|
||||
// CHECK:STDOUT: %T => constants.%T
|
||||
// CHECK:STDOUT: %Class => constants.%Class
|
||||
// CHECK:STDOUT: %pattern_type.loc16_8 => constants.%pattern_type.3c1
|
||||
// CHECK:STDOUT: %pattern_type.loc16_20 => constants.%pattern_type.7dc
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @F.2(constants.%N.51e) {
|
||||
// CHECK:STDOUT: %N.loc36_10.2 => constants.%N.51e
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
fn Class(N:! I).F[self: Self](n: T) {}
|
||||
|
||||
+2
-348
@@ -2,9 +2,6 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_incomplete.carbon
|
||||
@@ -55,7 +52,7 @@ var global_var: Class;
|
||||
// CHECK:STDERR:
|
||||
fn ConvertFromStruct() -> Class { return {}; }
|
||||
|
||||
fn G(p: Class*) -> i32 {
|
||||
fn G(p: Class*) -> () {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess]
|
||||
// CHECK:STDERR: return p->n;
|
||||
// CHECK:STDERR: ^~~~
|
||||
@@ -66,7 +63,7 @@ fn G(p: Class*) -> i32 {
|
||||
return p->n;
|
||||
}
|
||||
|
||||
fn MemberAccess(p: Class*) -> i32 {
|
||||
fn MemberAccess(p: Class*) -> () {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:11: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess]
|
||||
// CHECK:STDERR: return (*p).n;
|
||||
// CHECK:STDERR: ^~
|
||||
@@ -176,346 +173,3 @@ class C {
|
||||
// CHECK:STDERR:
|
||||
var c: C;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- fail_forward_decl.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class [concrete]
|
||||
// CHECK:STDOUT: %Function.type: type = fn_type @Function [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Function: %Function.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %CallClassFunction.type: type = fn_type @CallClassFunction [concrete]
|
||||
// CHECK:STDOUT: %CallClassFunction: %CallClassFunction.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.761: type = pattern_type %Class [concrete]
|
||||
// CHECK:STDOUT: %ConvertFromStruct.type: type = fn_type @ConvertFromStruct [concrete]
|
||||
// CHECK:STDOUT: %ConvertFromStruct: %ConvertFromStruct.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
|
||||
// CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %MemberAccess.type: type = fn_type @MemberAccess [concrete]
|
||||
// CHECK:STDOUT: %MemberAccess: %MemberAccess.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Copy.type: type = fn_type @Copy [concrete]
|
||||
// CHECK:STDOUT: %Copy: %Copy.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Let.type: type = fn_type @Let [concrete]
|
||||
// CHECK:STDOUT: %Let: %Let.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %TakeIncomplete.type: type = fn_type @TakeIncomplete [concrete]
|
||||
// CHECK:STDOUT: %TakeIncomplete: %TakeIncomplete.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ReturnIncomplete.type: type = fn_type @ReturnIncomplete [concrete]
|
||||
// CHECK:STDOUT: %ReturnIncomplete: %ReturnIncomplete.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %CallTakeIncomplete.type: type = fn_type @CallTakeIncomplete [concrete]
|
||||
// CHECK:STDOUT: %CallTakeIncomplete: %CallTakeIncomplete.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %CallReturnIncomplete.type: type = fn_type @CallReturnIncomplete [concrete]
|
||||
// CHECK:STDOUT: %CallReturnIncomplete: %CallReturnIncomplete.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %IncompleteAddrSelf: type = class_type @IncompleteAddrSelf [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %CallIncompleteAddrSelf.type: type = fn_type @CallIncompleteAddrSelf [concrete]
|
||||
// CHECK:STDOUT: %CallIncompleteAddrSelf: %CallIncompleteAddrSelf.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Class = %Class.decl
|
||||
// CHECK:STDOUT: .CallClassFunction = %CallClassFunction.decl
|
||||
// CHECK:STDOUT: .global_var = %global_var
|
||||
// CHECK:STDOUT: .ConvertFromStruct = %ConvertFromStruct.decl
|
||||
// CHECK:STDOUT: .G = %G.decl
|
||||
// CHECK:STDOUT: .MemberAccess = %MemberAccess.decl
|
||||
// CHECK:STDOUT: .Copy = %Copy.decl
|
||||
// CHECK:STDOUT: .Let = %Let.decl
|
||||
// CHECK:STDOUT: .TakeIncomplete = %TakeIncomplete.decl
|
||||
// CHECK:STDOUT: .ReturnIncomplete = %ReturnIncomplete.decl
|
||||
// CHECK:STDOUT: .CallTakeIncomplete = %CallTakeIncomplete.decl
|
||||
// CHECK:STDOUT: .CallReturnIncomplete = %CallReturnIncomplete.decl
|
||||
// CHECK:STDOUT: .IncompleteAddrSelf = %IncompleteAddrSelf.decl
|
||||
// CHECK:STDOUT: .CallIncompleteAddrSelf = %CallIncompleteAddrSelf.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {}
|
||||
// CHECK:STDOUT: %Function.decl: %Function.type = fn_decl @Function [concrete = constants.%Function] {} {}
|
||||
// CHECK:STDOUT: %CallClassFunction.decl: %CallClassFunction.type = fn_decl @CallClassFunction [concrete = constants.%CallClassFunction] {} {}
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %global_var.patt: <error> = binding_pattern global_var [concrete]
|
||||
// CHECK:STDOUT: %global_var.var_patt: <error> = var_pattern %global_var.patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %global_var.var: ref <error> = var %global_var.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %global_var: <error> = bind_name global_var, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %ConvertFromStruct.decl: %ConvertFromStruct.type = fn_decl @ConvertFromStruct [concrete = constants.%ConvertFromStruct] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.761 = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.761 = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %return.param: ref %Class = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %Class = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc44: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %MemberAccess.decl: %MemberAccess.type = fn_decl @MemberAccess [concrete = constants.%MemberAccess] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc55: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Copy.decl: %Copy.type = fn_decl @Copy [concrete = constants.%Copy] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.761 = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.761 = out_param_pattern %return.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Class.ref.loc73_23: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc73: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref.loc73_12: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref.loc73_12 [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %return.param: ref %Class = out_param call_param1
|
||||
// CHECK:STDOUT: %return: ref %Class = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Let.decl: %Let.type = fn_decl @Let [concrete = constants.%Let] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc77: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref.loc77: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref.loc77 [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %TakeIncomplete.decl: %TakeIncomplete.type = fn_decl @TakeIncomplete [concrete = constants.%TakeIncomplete] {
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.761 = binding_pattern c [concrete]
|
||||
// CHECK:STDOUT: %c.param_patt: %pattern_type.761 = value_param_pattern %c.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %c.param: %Class = value_param call_param0
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %c: %Class = bind_name c, %c.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ReturnIncomplete.decl: %ReturnIncomplete.type = fn_decl @ReturnIncomplete [concrete = constants.%ReturnIncomplete] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.761 = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.761 = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %return.param: ref %Class = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %Class = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %CallTakeIncomplete.decl: %CallTakeIncomplete.type = fn_decl @CallTakeIncomplete [concrete = constants.%CallTakeIncomplete] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc92: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %CallReturnIncomplete.decl: %CallReturnIncomplete.type = fn_decl @CallReturnIncomplete [concrete = constants.%CallReturnIncomplete] {} {}
|
||||
// CHECK:STDOUT: %IncompleteAddrSelf.decl: type = class_decl @IncompleteAddrSelf [concrete = constants.%IncompleteAddrSelf] {} {}
|
||||
// CHECK:STDOUT: %CallIncompleteAddrSelf.decl: %CallIncompleteAddrSelf.type = fn_decl @CallIncompleteAddrSelf [concrete = constants.%CallIncompleteAddrSelf] {
|
||||
// CHECK:STDOUT: %p.patt: %pattern_type.796 = binding_pattern p [concrete]
|
||||
// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc136: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: %ptr.e71 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @Class;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @IncompleteAddrSelf {
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.796 = binding_pattern self [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.796 = value_param_pattern %self.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %.loc133_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param: %ptr.e71 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc133_24: type = splice_block %ptr [concrete = constants.%ptr.e71] {
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref [concrete = constants.%ptr.e71]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %self: %ptr.e71 = bind_name self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%IncompleteAddrSelf
|
||||
// CHECK:STDOUT: .Class = <poisoned>
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Function() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallClassFunction() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %Function.ref: <error> = name_ref Function, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @ConvertFromStruct() -> %Class {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %.loc42: %empty_struct_type = struct_literal ()
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G(%p.param: %ptr.e71) -> %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc52: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MemberAccess(%p.param: %ptr.e71) -> %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc63: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Copy(%p.param: %ptr.e71) -> %Class {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc74: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Let(%p.param: %ptr.e71) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c.patt: <error> = binding_pattern c [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc85: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: %Class.ref.loc85: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %c: <error> = bind_name c, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @TakeIncomplete(%c.param: %Class);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @ReturnIncomplete() -> %Class;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallTakeIncomplete(%p.param: %ptr.e71) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %TakeIncomplete.ref.loc103: %TakeIncomplete.type = name_ref TakeIncomplete, file.%TakeIncomplete.decl [concrete = constants.%TakeIncomplete]
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc103: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: %TakeIncomplete.call.loc103: init %empty_tuple.type = call %TakeIncomplete.ref.loc103(<error>)
|
||||
// CHECK:STDOUT: %TakeIncomplete.ref.loc115: %TakeIncomplete.type = name_ref TakeIncomplete, file.%TakeIncomplete.decl [concrete = constants.%TakeIncomplete]
|
||||
// CHECK:STDOUT: %.loc115: %empty_struct_type = struct_literal ()
|
||||
// CHECK:STDOUT: %TakeIncomplete.call.loc115: init %empty_tuple.type = call %TakeIncomplete.ref.loc115(<error>)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallReturnIncomplete() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ReturnIncomplete.ref: %ReturnIncomplete.type = name_ref ReturnIncomplete, file.%ReturnIncomplete.decl [concrete = constants.%ReturnIncomplete]
|
||||
// CHECK:STDOUT: %ReturnIncomplete.call: init <error> = call %ReturnIncomplete.ref()
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%self.param: %ptr.e71);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallIncompleteAddrSelf(%p.param: %ptr.e71) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p
|
||||
// CHECK:STDOUT: %IncompleteAddrSelf.ref: type = name_ref IncompleteAddrSelf, file.%IncompleteAddrSelf.decl [concrete = constants.%IncompleteAddrSelf]
|
||||
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, @IncompleteAddrSelf.%F.decl [concrete = constants.%F]
|
||||
// CHECK:STDOUT: %.loc148: ref %Class = deref %p.ref
|
||||
// CHECK:STDOUT: %F.bound: <bound method> = bound_method %.loc148, %F.ref
|
||||
// CHECK:STDOUT: %addr: <error> = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.bound(<error>)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_in_definition.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .C = %C.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @C {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %.loc12: <error> = field_decl c, element0 [concrete]
|
||||
// CHECK:STDOUT: %struct_type.c: type = struct_type {.c: <error>} [concrete = <error>]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.c [concrete = <error>]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%C
|
||||
// CHECK:STDOUT: .C = <poisoned>
|
||||
// CHECK:STDOUT: .c = %.loc12
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+1
-79
@@ -2,9 +2,6 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon
|
||||
@@ -12,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon
|
||||
|
||||
class Class {
|
||||
fn F() -> i32;
|
||||
fn F() -> ();
|
||||
}
|
||||
|
||||
// TODO: Use `:!` here once it is available.
|
||||
@@ -28,78 +25,3 @@ let T: type = Class;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn T.F() {}
|
||||
|
||||
// CHECK:STDOUT: --- fail_member_of_let.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %F.type.f1b: type = fn_type @F.1 [concrete]
|
||||
// CHECK:STDOUT: %F.1f2: %F.type.f1b = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
|
||||
// CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [concrete]
|
||||
// CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Class = %Class.decl
|
||||
// CHECK:STDOUT: .T = %T
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {}
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = binding_pattern T [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %T: type = bind_name T, @__global_init.%Class.ref
|
||||
// CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [concrete = constants.%F.c41] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @Class {
|
||||
// CHECK:STDOUT: %F.decl: %F.type.f1b = fn_decl @F.1 [concrete = constants.%F.1f2] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%Class
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F.1() -> %i32;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F.2() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+3
-112
@@ -2,9 +2,6 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_scope.carbon
|
||||
@@ -12,121 +9,15 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_scope.carbon
|
||||
|
||||
class Class {
|
||||
fn F() -> i32 {
|
||||
return 1;
|
||||
fn F() -> () {
|
||||
return ();
|
||||
}
|
||||
}
|
||||
|
||||
fn G() -> i32 {
|
||||
fn G() -> () {
|
||||
// CHECK:STDERR: fail_scope.carbon:[[@LINE+4]]:10: error: name `F` not found [NameNotFound]
|
||||
// CHECK:STDERR: return F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
return F();
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- fail_scope.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.3, @impl.4f9(%To.c80) [symbolic]
|
||||
// CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.3, @impl.4f9(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
|
||||
// CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete]
|
||||
// CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
|
||||
// CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.3(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
|
||||
// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
|
||||
// CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
|
||||
// CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
|
||||
// CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Class = %Class.decl
|
||||
// CHECK:STDOUT: .G = %G.decl
|
||||
// CHECK:STDOUT: .F = <poisoned>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {}
|
||||
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @Class {
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
||||
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
||||
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%Class
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() -> %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
|
||||
// CHECK:STDOUT: %bound_method.loc16_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc16_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc16_13.2(%int_1) [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc16_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc16_13.2: %i32 = converted %int_1, %.loc16_13.1 [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: return %.loc16_13.2
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G() -> %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %F.ref: <error> = name_ref F, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+1
-62
@@ -2,9 +2,6 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_self_param.carbon
|
||||
@@ -16,62 +13,4 @@
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class C[self:! type](x:! self) {}
|
||||
var v: C(0);
|
||||
|
||||
// CHECK:STDOUT: --- fail_self_param.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
|
||||
// CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .C = %C.decl
|
||||
// CHECK:STDOUT: .v = %v
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
|
||||
// CHECK:STDOUT: %x.patt: <error> = symbolic_binding_pattern x, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.ref: <error> = name_ref self, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %x: <error> = bind_symbolic_name x, 0 [concrete = <error>]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %v.patt: <error> = binding_pattern v [concrete]
|
||||
// CHECK:STDOUT: %v.var_patt: <error> = var_pattern %v.patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v.var: ref <error> = var %v.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
|
||||
// CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [concrete = constants.%C.generic]
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: <error> = bind_name v, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @C(%x: <error>) {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @C(<error>) {}
|
||||
// CHECK:STDOUT:
|
||||
var v: C(());
|
||||
|
||||
+119
-104
@@ -38,13 +38,15 @@ class A(T:! type) {}
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class B(N:! i32);
|
||||
class A {}
|
||||
|
||||
class B(N:! A);
|
||||
// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers]
|
||||
// CHECK:STDERR: class B[T:! type](N:! T) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-4]]:1: note: previously declared without implicit parameter list [RedeclParamListPrevious]
|
||||
// CHECK:STDERR: class B(N:! i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: class B(N:! A);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class B[T:! type](N:! T) {}
|
||||
|
||||
@@ -52,29 +54,33 @@ class B[T:! type](N:! T) {}
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class A {}
|
||||
|
||||
class C(T:! type);
|
||||
// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers]
|
||||
// CHECK:STDERR: class C(T:! type, U:! i32) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: class C(T:! type, U:! A) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
|
||||
// CHECK:STDERR: class C(T:! type);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class C(T:! type, U:! i32) {}
|
||||
class C(T:! type, U:! A) {}
|
||||
|
||||
// --- fail_mismatch_param_type.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class A {}
|
||||
|
||||
class D(T:! type);
|
||||
// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+7]]:9: error: type `<pattern for i32>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
|
||||
// CHECK:STDERR: class D(T:! i32) {}
|
||||
// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+7]]:9: error: type `<pattern for A>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
|
||||
// CHECK:STDERR: class D(T:! A) {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: class D(T:! type);
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
class D(T:! i32) {}
|
||||
class D(T:! A) {}
|
||||
|
||||
// --- fail_mismatch_param_name.carbon
|
||||
|
||||
@@ -204,12 +210,11 @@ class E(U:! type) {}
|
||||
// CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %A: type = class_type @A [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %N.9e6: %A = bind_symbolic_name N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
|
||||
// CHECK:STDOUT: %B.type.844c0f.1: type = generic_class_type @B.1 [concrete]
|
||||
// CHECK:STDOUT: %B.generic.ba299b.1: %B.type.844c0f.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
||||
@@ -219,60 +224,64 @@ class E(U:! type) {}
|
||||
// CHECK:STDOUT: %B.type.844c0f.2: type = generic_class_type @B.2 [concrete]
|
||||
// CHECK:STDOUT: %B.generic.ba299b.2: %B.type.844c0f.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %B.828: type = class_type @B.2, @B.2(%T, %N.f22) [symbolic]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .B = %B.decl.loc4
|
||||
// CHECK:STDOUT: .A = %A.decl
|
||||
// CHECK:STDOUT: .B = %B.decl.loc6
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %B.decl.loc4: %B.type.844c0f.1 = class_decl @B.1 [concrete = constants.%B.generic.ba299b.1] {
|
||||
// CHECK:STDOUT: %N.patt: %pattern_type.7ce = symbolic_binding_pattern N, 0 [concrete]
|
||||
// CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
|
||||
// CHECK:STDOUT: %B.decl.loc6: %B.type.844c0f.1 = class_decl @B.1 [concrete = constants.%B.generic.ba299b.1] {
|
||||
// CHECK:STDOUT: %N.patt: %pattern_type.c10 = symbolic_binding_pattern N, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc4: type = splice_block %i32 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %N.loc4_9.1: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_9.2 (constants.%N.51e)]
|
||||
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %N.loc6_9.1: %A = bind_symbolic_name N, 0 [symbolic = %N.loc6_9.2 (constants.%N.9e6)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %B.decl.loc12: %B.type.844c0f.2 = class_decl @B.2 [concrete = constants.%B.generic.ba299b.2] {
|
||||
// CHECK:STDOUT: %B.decl.loc14: %B.type.844c0f.2 = class_decl @B.2 [concrete = constants.%B.generic.ba299b.2] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: %N.patt: @B.2.%pattern_type (%pattern_type.7dc) = symbolic_binding_pattern N, 1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %T.loc12_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_9.1 [symbolic = %T.loc12_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %N.loc12_19.1: @B.2.%T.loc12_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc12_19.2 (constants.%N.f22)]
|
||||
// CHECK:STDOUT: %T.loc14_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_9.1 [symbolic = %T.loc14_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %N.loc14_19.1: @B.2.%T.loc14_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc14_19.2 (constants.%N.f22)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @B.1(%N.loc4_9.1: %i32) {
|
||||
// CHECK:STDOUT: %N.loc4_9.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_9.2 (constants.%N.51e)]
|
||||
// CHECK:STDOUT: class @A {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%A
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @B.1(%N.loc6_9.1: %A) {
|
||||
// CHECK:STDOUT: %N.loc6_9.2: %A = bind_symbolic_name N, 0 [symbolic = %N.loc6_9.2 (constants.%N.9e6)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class;
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @B.2(%T.loc12_9.1: type, %N.loc12_19.1: @B.2.%T.loc12_9.2 (%T)) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %N.loc12_19.2: @B.2.%T.loc12_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc12_19.2 (constants.%N.f22)]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc12_9.2 [symbolic = %pattern_type (constants.%pattern_type.7dc)]
|
||||
// CHECK:STDOUT: generic class @B.2(%T.loc14_9.1: type, %N.loc14_19.1: @B.2.%T.loc14_9.2 (%T)) {
|
||||
// CHECK:STDOUT: %T.loc14_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %N.loc14_19.2: @B.2.%T.loc14_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc14_19.2 (constants.%N.f22)]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc14_9.2 [symbolic = %pattern_type (constants.%pattern_type.7dc)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
@@ -280,178 +289,184 @@ class E(U:! type) {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @B.1(constants.%N.51e) {
|
||||
// CHECK:STDOUT: %N.loc4_9.2 => constants.%N.51e
|
||||
// CHECK:STDOUT: specific @B.1(constants.%N.9e6) {
|
||||
// CHECK:STDOUT: %N.loc6_9.2 => constants.%N.9e6
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @B.2(constants.%T, constants.%N.f22) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2 => constants.%T
|
||||
// CHECK:STDOUT: %N.loc12_19.2 => constants.%N.f22
|
||||
// CHECK:STDOUT: %T.loc14_9.2 => constants.%T
|
||||
// CHECK:STDOUT: %N.loc14_19.2 => constants.%N.f22
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_mismatch_param_count.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %A: type = class_type @A [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
|
||||
// CHECK:STDOUT: %C.type.e6e560.1: type = generic_class_type @C.1 [concrete]
|
||||
// CHECK:STDOUT: %C.generic.965b12.1: %C.type.e6e560.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %U: %i32 = bind_symbolic_name U, 1 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %U: %A = bind_symbolic_name U, 1 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
|
||||
// CHECK:STDOUT: %C.type.e6e560.2: type = generic_class_type @C.2 [concrete]
|
||||
// CHECK:STDOUT: %C.generic.965b12.2: %C.type.e6e560.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %C.9d5: type = class_type @C.2, @C.2(%T, %U) [symbolic]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %C.3d8: type = class_type @C.2, @C.2(%T, %U) [symbolic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .C = %C.decl.loc4
|
||||
// CHECK:STDOUT: .A = %A.decl
|
||||
// CHECK:STDOUT: .C = %C.decl.loc6
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %C.decl.loc4: %C.type.e6e560.1 = class_decl @C.1 [concrete = constants.%C.generic.965b12.1] {
|
||||
// CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
|
||||
// CHECK:STDOUT: %C.decl.loc6: %C.type.e6e560.1 = class_decl @C.1 [concrete = constants.%C.generic.965b12.1] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %T.loc4_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %T.loc6_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl.loc12: %C.type.e6e560.2 = class_decl @C.2 [concrete = constants.%C.generic.965b12.2] {
|
||||
// CHECK:STDOUT: %C.decl.loc14: %C.type.e6e560.2 = class_decl @C.2 [concrete = constants.%C.generic.965b12.2] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: %U.patt: %pattern_type.7ce = symbolic_binding_pattern U, 1 [concrete]
|
||||
// CHECK:STDOUT: %U.patt: %pattern_type.c10 = symbolic_binding_pattern U, 1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %T.loc12_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %.loc12: type = splice_block %i32 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %U.loc12_19.1: %i32 = bind_symbolic_name U, 1 [symbolic = %U.loc12_19.2 (constants.%U)]
|
||||
// CHECK:STDOUT: %T.loc14_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %U.loc14_19.1: %A = bind_symbolic_name U, 1 [symbolic = %U.loc14_19.2 (constants.%U)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @C.1(%T.loc4_9.1: type) {
|
||||
// CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: class @A {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%A
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @C.1(%T.loc6_9.1: type) {
|
||||
// CHECK:STDOUT: %T.loc6_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class;
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @C.2(%T.loc12_9.1: type, %U.loc12_19.1: %i32) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %U.loc12_19.2: %i32 = bind_symbolic_name U, 1 [symbolic = %U.loc12_19.2 (constants.%U)]
|
||||
// CHECK:STDOUT: generic class @C.2(%T.loc14_9.1: type, %U.loc14_19.1: %A) {
|
||||
// CHECK:STDOUT: %T.loc14_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
|
||||
// CHECK:STDOUT: %U.loc14_19.2: %A = bind_symbolic_name U, 1 [symbolic = %U.loc14_19.2 (constants.%U)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%C.9d5
|
||||
// CHECK:STDOUT: .Self = constants.%C.3d8
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @C.1(constants.%T) {
|
||||
// CHECK:STDOUT: %T.loc4_9.2 => constants.%T
|
||||
// CHECK:STDOUT: %T.loc6_9.2 => constants.%T
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @C.2(constants.%T, constants.%U) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2 => constants.%T
|
||||
// CHECK:STDOUT: %U.loc12_19.2 => constants.%U
|
||||
// CHECK:STDOUT: %T.loc14_9.2 => constants.%T
|
||||
// CHECK:STDOUT: %U.loc14_19.2 => constants.%U
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_mismatch_param_type.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %A: type = class_type @A [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
|
||||
// CHECK:STDOUT: %D.type.bbd080.1: type = generic_class_type @D.1 [concrete]
|
||||
// CHECK:STDOUT: %D.generic.4e2319.1: %D.type.bbd080.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %T.51e: %i32 = bind_symbolic_name T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %T.9e6: %A = bind_symbolic_name T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
|
||||
// CHECK:STDOUT: %D.type.bbd080.2: type = generic_class_type @D.2 [concrete]
|
||||
// CHECK:STDOUT: %D.generic.4e2319.2: %D.type.bbd080.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %D.022: type = class_type @D.2, @D.2(%T.51e) [symbolic]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %D.384: type = class_type @D.2, @D.2(%T.9e6) [symbolic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Int = %Core.Int
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .D = %D.decl.loc4
|
||||
// CHECK:STDOUT: .A = %A.decl
|
||||
// CHECK:STDOUT: .D = %D.decl.loc6
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %D.decl.loc4: %D.type.bbd080.1 = class_decl @D.1 [concrete = constants.%D.generic.4e2319.1] {
|
||||
// CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
|
||||
// CHECK:STDOUT: %D.decl.loc6: %D.type.bbd080.1 = class_decl @D.1 [concrete = constants.%D.generic.4e2319.1] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %T.loc4_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T.8b3)]
|
||||
// CHECK:STDOUT: %T.loc6_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T.8b3)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %D.decl.loc12: %D.type.bbd080.2 = class_decl @D.2 [concrete = constants.%D.generic.4e2319.2] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.7ce = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: %D.decl.loc14: %D.type.bbd080.2 = class_decl @D.2 [concrete = constants.%D.generic.4e2319.2] {
|
||||
// CHECK:STDOUT: %T.patt: %pattern_type.c10 = symbolic_binding_pattern T, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc12: type = splice_block %i32 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %T.loc12_9.1: %i32 = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T.51e)]
|
||||
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
|
||||
// CHECK:STDOUT: %T.loc14_9.1: %A = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T.9e6)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @D.1(%T.loc4_9.1: type) {
|
||||
// CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T.8b3)]
|
||||
// CHECK:STDOUT: class @A {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%A
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @D.1(%T.loc6_9.1: type) {
|
||||
// CHECK:STDOUT: %T.loc6_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T.8b3)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class;
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @D.2(%T.loc12_9.1: %i32) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2: %i32 = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T.51e)]
|
||||
// CHECK:STDOUT: generic class @D.2(%T.loc14_9.1: %A) {
|
||||
// CHECK:STDOUT: %T.loc14_9.2: %A = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T.9e6)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%D.022
|
||||
// CHECK:STDOUT: .Self = constants.%D.384
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @D.1(constants.%T.8b3) {
|
||||
// CHECK:STDOUT: %T.loc4_9.2 => constants.%T.8b3
|
||||
// CHECK:STDOUT: %T.loc6_9.2 => constants.%T.8b3
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @D.2(constants.%T.51e) {
|
||||
// CHECK:STDOUT: %T.loc12_9.2 => constants.%T.51e
|
||||
// CHECK:STDOUT: specific @D.2(constants.%T.9e6) {
|
||||
// CHECK:STDOUT: %T.loc14_9.2 => constants.%T.9e6
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_mismatch_param_name.carbon
|
||||
|
||||
+19
-24
@@ -14,19 +14,18 @@
|
||||
class Class;
|
||||
|
||||
class Class {
|
||||
fn F[self: Self](b: bool);
|
||||
fn F[self: Self](b: ());
|
||||
}
|
||||
|
||||
fn Class.F[self: Self](b: bool) {}
|
||||
fn Class.F[self: Self](b: ()) {}
|
||||
|
||||
// CHECK:STDOUT: --- redeclaration.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.761: type = pattern_type %Class [concrete]
|
||||
// CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete]
|
||||
// CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
@@ -35,11 +34,9 @@ fn Class.F[self: Self](b: bool) {}
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .Bool = %Core.Bool
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Bool: %Bool.type = import_ref Core//prelude/types/bool, Bool, loaded [concrete = constants.%Bool]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -53,19 +50,18 @@ fn Class.F[self: Self](b: bool) {}
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.761 = binding_pattern self [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.831 = binding_pattern b [concrete]
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.cb1 = binding_pattern b [concrete]
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.cb1 = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param.loc20: %Class = value_param call_param0
|
||||
// CHECK:STDOUT: %Self.ref.loc20: type = name_ref Self, constants.%Class [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %self.loc20: %Class = bind_name self, %self.param.loc20
|
||||
// CHECK:STDOUT: %b.param.loc20: bool = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc20_27.1: type = splice_block %.loc20_27.3 [concrete = bool] {
|
||||
// CHECK:STDOUT: %bool.make_type.loc20: init type = call constants.%Bool() [concrete = bool]
|
||||
// CHECK:STDOUT: %.loc20_27.2: type = value_of_initializer %bool.make_type.loc20 [concrete = bool]
|
||||
// CHECK:STDOUT: %.loc20_27.3: type = converted %bool.make_type.loc20, %.loc20_27.2 [concrete = bool]
|
||||
// CHECK:STDOUT: %b.param.loc20: %empty_tuple.type = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc20_28.1: type = splice_block %.loc20_28.3 [concrete = constants.%empty_tuple.type] {
|
||||
// CHECK:STDOUT: %.loc20_28.2: %empty_tuple.type = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc20_28.3: type = converted %.loc20_28.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b.loc20: bool = bind_name b, %b.param.loc20
|
||||
// CHECK:STDOUT: %b.loc20: %empty_tuple.type = bind_name b, %b.param.loc20
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -73,19 +69,18 @@ fn Class.F[self: Self](b: bool) {}
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
||||
// CHECK:STDOUT: %self.patt: %pattern_type.761 = binding_pattern self [concrete]
|
||||
// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.patt, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.831 = binding_pattern b [concrete]
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: %b.patt: %pattern_type.cb1 = binding_pattern b [concrete]
|
||||
// CHECK:STDOUT: %b.param_patt: %pattern_type.cb1 = value_param_pattern %b.patt, call_param1 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %self.param.loc17: %Class = value_param call_param0
|
||||
// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [concrete = constants.%Class]
|
||||
// CHECK:STDOUT: %self.loc17: %Class = bind_name self, %self.param.loc17
|
||||
// CHECK:STDOUT: %b.param.loc17: bool = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc17_23.1: type = splice_block %.loc17_23.3 [concrete = bool] {
|
||||
// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%Bool() [concrete = bool]
|
||||
// CHECK:STDOUT: %.loc17_23.2: type = value_of_initializer %bool.make_type.loc17 [concrete = bool]
|
||||
// CHECK:STDOUT: %.loc17_23.3: type = converted %bool.make_type.loc17, %.loc17_23.2 [concrete = bool]
|
||||
// CHECK:STDOUT: %b.param.loc17: %empty_tuple.type = value_param call_param1
|
||||
// CHECK:STDOUT: %.loc17_24.1: type = splice_block %.loc17_24.3 [concrete = constants.%empty_tuple.type] {
|
||||
// CHECK:STDOUT: %.loc17_24.2: %empty_tuple.type = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc17_24.3: type = converted %.loc17_24.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %b.loc17: bool = bind_name b, %b.param.loc17
|
||||
// CHECK:STDOUT: %b.loc17: %empty_tuple.type = bind_name b, %b.param.loc17
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
@@ -96,7 +91,7 @@ fn Class.F[self: Self](b: bool) {}
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%self.param.loc20: %Class, %b.param.loc20: bool) {
|
||||
// CHECK:STDOUT: fn @F(%self.param.loc20: %Class, %b.param.loc20: %empty_tuple.type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -212,31 +212,6 @@ fn F() {
|
||||
CC(DD(EE)) as Z;
|
||||
}
|
||||
|
||||
// --- deduce_nested_facet_value.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
interface Y {}
|
||||
interface W {}
|
||||
|
||||
// DD implements both Y and W.
|
||||
class DD {}
|
||||
impl DD as Y {}
|
||||
impl DD as W {}
|
||||
|
||||
// CC requires D to implement Y.
|
||||
class CC(D:! Y) {}
|
||||
|
||||
interface Z {}
|
||||
|
||||
// The `D` interface provides `Y` but not `W`, so we need to see that the
|
||||
// parameter to `CC` is `DD` which provides `Y & W`, not just a FacetValue
|
||||
// abstractly providing `Y.
|
||||
impl forall [E:! Y & W] CC(E) as Z {}
|
||||
|
||||
fn F() {
|
||||
(CC(DD)) as Z;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- deduce_explicit.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -1808,241 +1783,3 @@ fn F() {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- deduce_nested_facet_value.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
|
||||
// CHECK:STDOUT: %Self.b29: %Y.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %W.type: type = facet_type <@W> [concrete]
|
||||
// CHECK:STDOUT: %Self.f12: %W.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %DD: type = class_type @DD [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness file.%Y.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness file.%W.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %D: %Y.type = bind_symbolic_name D, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.667: type = pattern_type %Y.type [concrete]
|
||||
// CHECK:STDOUT: %CC.type: type = generic_class_type @CC [concrete]
|
||||
// CHECK:STDOUT: %CC.generic: %CC.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %CC.3ba: type = class_type @CC, @CC(%D) [symbolic]
|
||||
// CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
|
||||
// CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %BitAndWith.type.f2e: type = generic_interface_type @BitAndWith [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.generic: %BitAndWith.type.f2e = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.type.e8c: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete]
|
||||
// CHECK:STDOUT: %Op.type.9a3: type = fn_type @Op.1, @BitAndWith(type) [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.impl_witness: <witness> = impl_witness imports.%BitAndWith.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.e8c = facet_value type, (%BitAndWith.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %.da0: type = fn_type_with_self_type %Op.type.9a3, %BitAndWith.facet [concrete]
|
||||
// CHECK:STDOUT: %Op.type.c6f: type = fn_type @Op.6 [concrete]
|
||||
// CHECK:STDOUT: %Op.a92: %Op.type.c6f = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Op.bound: <bound method> = bound_method %Y.type, %Op.a92 [concrete]
|
||||
// CHECK:STDOUT: %facet_type: type = facet_type <@Y & @W> [concrete]
|
||||
// CHECK:STDOUT: %E: %facet_type = bind_symbolic_name E, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.122: type = pattern_type %facet_type [concrete]
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E, @Y [symbolic]
|
||||
// CHECK:STDOUT: %E.as_type: type = facet_access_type %E [symbolic]
|
||||
// CHECK:STDOUT: %Y.facet.7ec: %Y.type = facet_value %E.as_type, (%Y.lookup_impl_witness) [symbolic]
|
||||
// CHECK:STDOUT: %CC.d02: type = class_type @CC, @CC(%Y.facet.7ec) [symbolic]
|
||||
// CHECK:STDOUT: %Z.impl_witness.741: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%E) [symbolic]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Y.facet.268: %Y.type = facet_value %DD, (%Y.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %CC.7bf: type = class_type @CC, @CC(%Y.facet.268) [concrete]
|
||||
// CHECK:STDOUT: %facet_value: %facet_type = facet_value %DD, (%Y.impl_witness, %W.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %Z.impl_witness.3b0: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %CC.7bf, (%Z.impl_witness.3b0) [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .BitAndWith = %Core.BitAndWith
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude/operators/bitwise, BitAndWith, loaded [concrete = constants.%BitAndWith.generic]
|
||||
// CHECK:STDOUT: %Core.import_ref.ad2 = import_ref Core//prelude/operators/bitwise, loc113_52, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.0f9: %Op.type.c6f = import_ref Core//prelude/operators/bitwise, loc114_42, loaded [concrete = constants.%Op.a92]
|
||||
// CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.ad2, %Core.import_ref.0f9), @impl.ee8 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Y = %Y.decl
|
||||
// CHECK:STDOUT: .W = %W.decl
|
||||
// CHECK:STDOUT: .DD = %DD.decl
|
||||
// CHECK:STDOUT: .CC = %CC.decl
|
||||
// CHECK:STDOUT: .Z = %Z.decl
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Y.decl: type = interface_decl @Y [concrete = constants.%Y.type] {} {}
|
||||
// CHECK:STDOUT: %W.decl: type = interface_decl @W [concrete = constants.%W.type] {} {}
|
||||
// CHECK:STDOUT: %DD.decl: type = class_decl @DD [concrete = constants.%DD] {} {}
|
||||
// CHECK:STDOUT: impl_decl @impl.3d7 [concrete] {} {
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @impl.3d7 [concrete]
|
||||
// CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness %Y.impl_witness_table [concrete = constants.%Y.impl_witness]
|
||||
// CHECK:STDOUT: impl_decl @impl.e11 [concrete] {} {
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %W.impl_witness_table = impl_witness_table (), @impl.e11 [concrete]
|
||||
// CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness %W.impl_witness_table [concrete = constants.%W.impl_witness]
|
||||
// CHECK:STDOUT: %CC.decl: %CC.type = class_decl @CC [concrete = constants.%CC.generic] {
|
||||
// CHECK:STDOUT: %D.patt: %pattern_type.667 = symbolic_binding_pattern D, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: %D.loc12_10.1: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.2 (constants.%D)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
|
||||
// CHECK:STDOUT: impl_decl @impl.562 [concrete] {
|
||||
// CHECK:STDOUT: %E.patt: %pattern_type.122 = symbolic_binding_pattern E, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
|
||||
// CHECK:STDOUT: %E.ref: %facet_type = name_ref E, %E.loc19_14.1 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.1: type = facet_access_type constants.%E [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.1: %Y.type = facet_value %E.as_type.loc19_29.1, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %.loc19_29: %Y.type = converted %E.ref, %Y.facet.loc19_29.1 [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %CC.loc19_29.1: type = class_type @CC, @CC(constants.%Y.facet.7ec) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
|
||||
// CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
|
||||
// CHECK:STDOUT: %.loc19_20.1: type = splice_block %.loc19_20.3 [concrete = constants.%facet_type] {
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
|
||||
// CHECK:STDOUT: %impl.elem1: %.da0 = impl_witness_access constants.%BitAndWith.impl_witness, element1 [concrete = constants.%Op.a92]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %Y.ref, %impl.elem1 [concrete = constants.%Op.bound]
|
||||
// CHECK:STDOUT: %type.and: init type = call %bound_method(%Y.ref, %W.ref) [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: %.loc19_20.2: type = value_of_initializer %type.and [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: %.loc19_20.3: type = converted %type.and, %.loc19_20.2 [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %E.loc19_14.1: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @impl.562 [concrete]
|
||||
// CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness %Z.impl_witness_table, @impl.562(constants.%E) [symbolic = @impl.562.%Z.impl_witness (constants.%Z.impl_witness.741)]
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @Y {
|
||||
// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b29]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @W {
|
||||
// CHECK:STDOUT: %Self: %W.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.f12]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @Z {
|
||||
// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.3d7: %DD.ref as %Y.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%Y.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.e11: %DD.ref as %W.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%W.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic impl @impl.562(%E.loc19_14.1: %facet_type) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E.loc19_14.2, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2: type = facet_access_type %E.loc19_14.2 [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2: %Y.type = facet_value %E.as_type.loc19_29.2, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %CC.loc19_29.2: type = class_type @CC, @CC(%Y.facet.loc19_29.2) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
|
||||
// CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%E.loc19_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.741)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl: %CC.loc19_29.1 as %Z.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%Z.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @DD {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%DD
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @CC(%D.loc12_10.1: %Y.type) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.2 (constants.%D)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%CC.3ba
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%DD, (constants.%Y.impl_witness) [concrete = constants.%Y.facet.268]
|
||||
// CHECK:STDOUT: %.loc22_9: %Y.type = converted %DD.ref, %Y.facet [concrete = constants.%Y.facet.268]
|
||||
// CHECK:STDOUT: %CC: type = class_type @CC, @CC(constants.%Y.facet.268) [concrete = constants.%CC.7bf]
|
||||
// CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
|
||||
// CHECK:STDOUT: %facet_value: %facet_type = facet_value constants.%DD, (constants.%Y.impl_witness, constants.%W.impl_witness) [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %.loc22_12.1: %facet_type = converted constants.%DD, %facet_value [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%CC.7bf, (constants.%Z.impl_witness.3b0) [concrete = constants.%Z.facet]
|
||||
// CHECK:STDOUT: %.loc22_12.2: %Z.type = converted %CC, %Z.facet [concrete = constants.%Z.facet]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%D) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%D
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%Y.facet.7ec) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%Y.facet.7ec
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @impl.562(constants.%E) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2 => constants.%E
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.lookup_impl_witness
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%E.as_type
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.7ec
|
||||
// CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.d02
|
||||
// CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.741
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%Y.facet.268) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%Y.facet.268
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @impl.562(constants.%facet_value) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2 => constants.%facet_value
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.impl_witness
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%DD
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.268
|
||||
// CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.7bf
|
||||
// CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.3b0
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
// 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
|
||||
//
|
||||
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/facet_types.carbon
|
||||
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
||||
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon
|
||||
|
||||
// --- deduce_nested_facet_value.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
interface Y {}
|
||||
interface W {}
|
||||
|
||||
// DD implements both Y and W.
|
||||
class DD {}
|
||||
impl DD as Y {}
|
||||
impl DD as W {}
|
||||
|
||||
// CC requires D to implement Y.
|
||||
class CC(D:! Y) {}
|
||||
|
||||
interface Z {}
|
||||
|
||||
// The `D` interface provides `Y` but not `W`, so we need to see that the
|
||||
// parameter to `CC` is `DD` which provides `Y & W`, not just a FacetValue
|
||||
// abstractly providing `Y.
|
||||
impl forall [E:! Y & W] CC(E) as Z {}
|
||||
|
||||
fn F() {
|
||||
(CC(DD)) as Z;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- deduce_nested_facet_value.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
|
||||
// CHECK:STDOUT: %Self.b29: %Y.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %W.type: type = facet_type <@W> [concrete]
|
||||
// CHECK:STDOUT: %Self.f12: %W.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %DD: type = class_type @DD [concrete]
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
||||
// CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness file.%Y.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness file.%W.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %D: %Y.type = bind_symbolic_name D, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.667: type = pattern_type %Y.type [concrete]
|
||||
// CHECK:STDOUT: %CC.type: type = generic_class_type @CC [concrete]
|
||||
// CHECK:STDOUT: %CC.generic: %CC.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %CC.3ba: type = class_type @CC, @CC(%D) [symbolic]
|
||||
// CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
|
||||
// CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic]
|
||||
// CHECK:STDOUT: %BitAndWith.type.f2e: type = generic_interface_type @BitAndWith [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.generic: %BitAndWith.type.f2e = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.type.e8c: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete]
|
||||
// CHECK:STDOUT: %Op.type.9a3: type = fn_type @Op.1, @BitAndWith(type) [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.impl_witness: <witness> = impl_witness imports.%BitAndWith.impl_witness_table [concrete]
|
||||
// CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.e8c = facet_value type, (%BitAndWith.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %.2af: type = fn_type_with_self_type %Op.type.9a3, %BitAndWith.facet [concrete]
|
||||
// CHECK:STDOUT: %Op.type.1cc: type = fn_type @Op.2 [concrete]
|
||||
// CHECK:STDOUT: %Op.ff4: %Op.type.1cc = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Op.bound: <bound method> = bound_method %Y.type, %Op.ff4 [concrete]
|
||||
// CHECK:STDOUT: %facet_type: type = facet_type <@Y & @W> [concrete]
|
||||
// CHECK:STDOUT: %E: %facet_type = bind_symbolic_name E, 0 [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.122: type = pattern_type %facet_type [concrete]
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E, @Y [symbolic]
|
||||
// CHECK:STDOUT: %E.as_type: type = facet_access_type %E [symbolic]
|
||||
// CHECK:STDOUT: %Y.facet.7ec: %Y.type = facet_value %E.as_type, (%Y.lookup_impl_witness) [symbolic]
|
||||
// CHECK:STDOUT: %CC.d02: type = class_type @CC, @CC(%Y.facet.7ec) [symbolic]
|
||||
// CHECK:STDOUT: %Z.impl_witness.741: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%E) [symbolic]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Y.facet.268: %Y.type = facet_value %DD, (%Y.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %CC.7bf: type = class_type @CC, @CC(%Y.facet.268) [concrete]
|
||||
// CHECK:STDOUT: %facet_value: %facet_type = facet_value %DD, (%Y.impl_witness, %W.impl_witness) [concrete]
|
||||
// CHECK:STDOUT: %Z.impl_witness.3b0: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%facet_value) [concrete]
|
||||
// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %CC.7bf, (%Z.impl_witness.3b0) [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
||||
// CHECK:STDOUT: .BitAndWith = %Core.BitAndWith
|
||||
// CHECK:STDOUT: import Core//prelude
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude, BitAndWith, loaded [concrete = constants.%BitAndWith.generic]
|
||||
// CHECK:STDOUT: %Core.import_ref.012: %Op.type.1cc = import_ref Core//prelude, loc13_42, loaded [concrete = constants.%Op.ff4]
|
||||
// CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.012), @impl.865 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
||||
// CHECK:STDOUT: .Core = imports.%Core
|
||||
// CHECK:STDOUT: .Y = %Y.decl
|
||||
// CHECK:STDOUT: .W = %W.decl
|
||||
// CHECK:STDOUT: .DD = %DD.decl
|
||||
// CHECK:STDOUT: .CC = %CC.decl
|
||||
// CHECK:STDOUT: .Z = %Z.decl
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Y.decl: type = interface_decl @Y [concrete = constants.%Y.type] {} {}
|
||||
// CHECK:STDOUT: %W.decl: type = interface_decl @W [concrete = constants.%W.type] {} {}
|
||||
// CHECK:STDOUT: %DD.decl: type = class_decl @DD [concrete = constants.%DD] {} {}
|
||||
// CHECK:STDOUT: impl_decl @impl.3d7 [concrete] {} {
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @impl.3d7 [concrete]
|
||||
// CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness %Y.impl_witness_table [concrete = constants.%Y.impl_witness]
|
||||
// CHECK:STDOUT: impl_decl @impl.e11 [concrete] {} {
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %W.impl_witness_table = impl_witness_table (), @impl.e11 [concrete]
|
||||
// CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness %W.impl_witness_table [concrete = constants.%W.impl_witness]
|
||||
// CHECK:STDOUT: %CC.decl: %CC.type = class_decl @CC [concrete = constants.%CC.generic] {
|
||||
// CHECK:STDOUT: %D.patt: %pattern_type.667 = symbolic_binding_pattern D, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: %D.loc12_10.1: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.2 (constants.%D)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
|
||||
// CHECK:STDOUT: impl_decl @impl.562 [concrete] {
|
||||
// CHECK:STDOUT: %E.patt: %pattern_type.122 = symbolic_binding_pattern E, 0 [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
|
||||
// CHECK:STDOUT: %E.ref: %facet_type = name_ref E, %E.loc19_14.1 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.1: type = facet_access_type constants.%E [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.1: %Y.type = facet_value %E.as_type.loc19_29.1, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %.loc19_29: %Y.type = converted %E.ref, %Y.facet.loc19_29.1 [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %CC.loc19_29.1: type = class_type @CC, @CC(constants.%Y.facet.7ec) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
|
||||
// CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
|
||||
// CHECK:STDOUT: %.loc19_20.1: type = splice_block %.loc19_20.3 [concrete = constants.%facet_type] {
|
||||
// CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
|
||||
// CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
|
||||
// CHECK:STDOUT: %impl.elem0: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%Op.ff4]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %Y.ref, %impl.elem0 [concrete = constants.%Op.bound]
|
||||
// CHECK:STDOUT: %type.and: init type = call %bound_method(%Y.ref, %W.ref) [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: %.loc19_20.2: type = value_of_initializer %type.and [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: %.loc19_20.3: type = converted %type.and, %.loc19_20.2 [concrete = constants.%facet_type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %E.loc19_14.1: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @impl.562 [concrete]
|
||||
// CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness %Z.impl_witness_table, @impl.562(constants.%E) [symbolic = @impl.562.%Z.impl_witness (constants.%Z.impl_witness.741)]
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @Y {
|
||||
// CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b29]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @W {
|
||||
// CHECK:STDOUT: %Self: %W.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.f12]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @Z {
|
||||
// CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = %Self
|
||||
// CHECK:STDOUT: witness = ()
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.3d7: %DD.ref as %Y.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%Y.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl @impl.e11: %DD.ref as %W.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%W.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic impl @impl.562(%E.loc19_14.1: %facet_type) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E.loc19_14.2, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2: type = facet_access_type %E.loc19_14.2 [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2: %Y.type = facet_value %E.as_type.loc19_29.2, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
|
||||
// CHECK:STDOUT: %CC.loc19_29.2: type = class_type @CC, @CC(%Y.facet.loc19_29.2) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
|
||||
// CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness file.%Z.impl_witness_table, @impl.562(%E.loc19_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.741)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: impl: %CC.loc19_29.1 as %Z.ref {
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: witness = file.%Z.impl_witness
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @DD {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%DD
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic class @CC(%D.loc12_10.1: %Y.type) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.2 (constants.%D)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%CC.3ba
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
|
||||
// CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
|
||||
// CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%DD, (constants.%Y.impl_witness) [concrete = constants.%Y.facet.268]
|
||||
// CHECK:STDOUT: %.loc22_9: %Y.type = converted %DD.ref, %Y.facet [concrete = constants.%Y.facet.268]
|
||||
// CHECK:STDOUT: %CC: type = class_type @CC, @CC(constants.%Y.facet.268) [concrete = constants.%CC.7bf]
|
||||
// CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
|
||||
// CHECK:STDOUT: %facet_value: %facet_type = facet_value constants.%DD, (constants.%Y.impl_witness, constants.%W.impl_witness) [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %.loc22_12.1: %facet_type = converted constants.%DD, %facet_value [concrete = constants.%facet_value]
|
||||
// CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%CC.7bf, (constants.%Z.impl_witness.3b0) [concrete = constants.%Z.facet]
|
||||
// CHECK:STDOUT: %.loc22_12.2: %Z.type = converted %CC, %Z.facet [concrete = constants.%Z.facet]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%D) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%D
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%Y.facet.7ec) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%Y.facet.7ec
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @impl.562(constants.%E) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2 => constants.%E
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.lookup_impl_witness
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%E.as_type
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.7ec
|
||||
// CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.d02
|
||||
// CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.741
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @CC(constants.%Y.facet.268) {
|
||||
// CHECK:STDOUT: %D.loc12_10.2 => constants.%Y.facet.268
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @impl.562(constants.%facet_value) {
|
||||
// CHECK:STDOUT: %E.loc19_14.2 => constants.%facet_value
|
||||
// CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.impl_witness
|
||||
// CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%DD
|
||||
// CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.268
|
||||
// CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.7bf
|
||||
// CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.3b0
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
+302
-417
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,6 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/generic/call_impl_function.carbon
|
||||
|
||||
import Core library "io";
|
||||
|
||||
interface SomeInterface(T:! type) {
|
||||
fn F(x: T) -> T;
|
||||
@@ -19,7 +18,7 @@ class SomeParam {}
|
||||
class ImplsSomeInterface {}
|
||||
impl ImplsSomeInterface as SomeInterface(i32) {
|
||||
fn F(x: i32) -> i32 {
|
||||
return x + x;
|
||||
return -x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +35,7 @@ fn CallGenericMethod(T:! type, U:! SomeInterface(T), x: T) -> T {
|
||||
}
|
||||
|
||||
fn G() {
|
||||
var out : i32 = CallGenericMethod(i32, ImplsSomeInterface, 10);
|
||||
Core.Print(out);
|
||||
|
||||
CallGenericMethod(i32, ImplsSomeInterface, 10);
|
||||
// TODO: Fix above
|
||||
// CallGenericMethod(SomeParam, ImplsSomeInterface, {});
|
||||
}
|
||||
@@ -47,38 +44,24 @@ fn G() {
|
||||
// CHECK:STDOUT: ; ModuleID = 'call_impl_function.carbon'
|
||||
// CHECK:STDOUT: source_filename = "call_impl_function.carbon"
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x) !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %int.sadd = add i32 %x, %x, !dbg !7
|
||||
// CHECK:STDOUT: ret i32 %int.sadd, !dbg !8
|
||||
// CHECK:STDOUT: %int.snegate = sub i32 0, %x, !dbg !7
|
||||
// CHECK:STDOUT: ret i32 %int.snegate, !dbg !8
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define void @_CG.Main() !dbg !9 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %out.var = alloca i32, align 4, !dbg !10
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %out.var), !dbg !10
|
||||
// CHECK:STDOUT: %CallGenericMethod.call = call i32 @_CCallGenericMethod.Main.b330a91dfda257ee(i32 10), !dbg !11
|
||||
// CHECK:STDOUT: store i32 %CallGenericMethod.call, ptr %out.var, align 4, !dbg !10
|
||||
// CHECK:STDOUT: %.loc40 = load i32, ptr %out.var, align 4, !dbg !12
|
||||
// CHECK:STDOUT: %print.int = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 %.loc40), !dbg !13
|
||||
// CHECK:STDOUT: ret void, !dbg !14
|
||||
// CHECK:STDOUT: %CallGenericMethod.call = call i32 @_CCallGenericMethod.Main.b330a91dfda257ee(i32 10), !dbg !10
|
||||
// CHECK:STDOUT: ret void, !dbg !11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #0
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.b330a91dfda257ee(i32 %x) !dbg !15 {
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.b330a91dfda257ee(i32 %x) !dbg !12 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %.loc35_15 = call i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x), !dbg !16
|
||||
// CHECK:STDOUT: ret i32 %.loc35_15, !dbg !17
|
||||
// CHECK:STDOUT: %.loc34_15 = call i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x), !dbg !13
|
||||
// CHECK:STDOUT: ret i32 %.loc34_15, !dbg !14
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: declare i32 @printf(ptr, ...)
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
||||
// CHECK:STDOUT:
|
||||
@@ -86,17 +69,14 @@ fn G() {
|
||||
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
||||
// CHECK:STDOUT: !3 = !DIFile(filename: "call_impl_function.carbon", directory: "")
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.ImplsSomeInterface.Main:SomeInterface.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.ImplsSomeInterface.Main:SomeInterface.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 22, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 22, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !3, line: 38, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 39, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 39, column: 19, scope: !9)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 40, column: 14, scope: !9)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 40, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 38, column: 1, scope: !9)
|
||||
// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "CallGenericMethod", linkageName: "_CCallGenericMethod.Main.b330a91dfda257ee", scope: null, file: !3, line: 34, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !16 = !DILocation(line: 35, column: 10, scope: !15)
|
||||
// CHECK:STDOUT: !17 = !DILocation(line: 35, column: 3, scope: !15)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 21, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 21, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !3, line: 37, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 38, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 37, column: 1, scope: !9)
|
||||
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "CallGenericMethod", linkageName: "_CCallGenericMethod.Main.b330a91dfda257ee", scope: null, file: !3, line: 33, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 34, column: 10, scope: !12)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 34, column: 3, scope: !12)
|
||||
|
||||
+12
-11
@@ -37,14 +37,16 @@ fn Lib2CallF[T:! type](a: T, b: T) -> T {
|
||||
|
||||
// --- todo_use.carbon
|
||||
|
||||
// TODO: This should call the `F` from lib1 and the `F` from lib2, and return 3.
|
||||
// Currently it calls the same function twice.
|
||||
// TODO: This should call the `F` from lib1 and the `F` from lib2. Currently
|
||||
// it calls the same function in both (hashes match for both instances of
|
||||
// `call i32 @_CF.Main.<hash>`).
|
||||
|
||||
import library "lib1";
|
||||
import library "lib2";
|
||||
|
||||
fn Run() -> i32 {
|
||||
return Lib1CallF(1 as i32, 2 as i32) + Lib2CallF(1 as i32, 2 as i32);
|
||||
fn Run() {
|
||||
let a: i32 = Lib1CallF(1 as i32, 2 as i32);
|
||||
let b: i32 = Lib2CallF(1 as i32, 2 as i32);
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: ; ModuleID = 'lib1.carbon'
|
||||
@@ -70,12 +72,11 @@ fn Run() -> i32 {
|
||||
// CHECK:STDOUT: ; ModuleID = 'todo_use.carbon'
|
||||
// CHECK:STDOUT: source_filename = "todo_use.carbon"
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @main() !dbg !4 {
|
||||
// CHECK:STDOUT: define void @main() !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %Lib1CallF.call = call i32 @_CLib1CallF.Main.b88d1103f417c6d4(i32 1, i32 2), !dbg !7
|
||||
// CHECK:STDOUT: %Lib2CallF.call = call i32 @_CLib2CallF.Main.b88d1103f417c6d4(i32 1, i32 2), !dbg !8
|
||||
// CHECK:STDOUT: %int.sadd = add i32 %Lib1CallF.call, %Lib2CallF.call, !dbg !7
|
||||
// CHECK:STDOUT: ret i32 %int.sadd, !dbg !9
|
||||
// CHECK:STDOUT: ret void, !dbg !9
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CLib1CallF.Main.b88d1103f417c6d4(i32 %a, i32 %b) !dbg !10 {
|
||||
@@ -102,12 +103,12 @@ fn Run() -> i32 {
|
||||
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
||||
// CHECK:STDOUT: !3 = !DIFile(filename: "todo_use.carbon", directory: "")
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 9, column: 10, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 9, column: 42, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 9, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 10, column: 16, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 11, column: 16, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 9, column: 1, scope: !4)
|
||||
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Lib1CallF", linkageName: "_CLib1CallF.Main.b88d1103f417c6d4", scope: null, file: !11, line: 8, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !11 = !DIFile(filename: "lib1.carbon", directory: "")
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 9, column: 10, scope: !10)
|
||||
|
||||
Reference in New Issue
Block a user