mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-10 12:28:25 +00:00
Determining that a type has trivial destruction requires checking whether all of its subobjects have trivial destruction and whether its type has a custom witness for `Destroy.Op`. This isn't possible when `Destroy` is the custodian for `Destroy.Op` and `SubobjectDestroy.Op`, so we need to make `SubobjectDestroy` its own interface. `Destroy.SelfDestruct` becomes a standalone function because it depends on `SubobjectDestroy` and `Destroy` being implemented, and is also responsible for generating any custom witnesses for both interfaces. Making `SelfDestruct` an interface was experimented with, but this required a blanket impl that caused issues for facet types. `Destroy` depends on `SubobjectDestroy` to be implemented. We'd ideally use `require impls SubobjectDestroy`, but it isn't complete yet, and it also causes problems when `Destroy` is implemented inside the class definition. We work around this by temporarily renaming the `Destroy` interface to `DestroyImpl`, and introducing a constraint called `Destroy` so that user code doesn't need to write `Core.SubobjectDestroy & Core.Destroy`.
586 lines
30 KiB
Plaintext
586 lines
30 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.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/class/abstract/fail_abstract_in_tuple.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon
|
|
|
|
// --- fail_abstract_field.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract1 {}
|
|
|
|
class Contains {
|
|
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-21: error: binding pattern has abstract type `(Abstract1,)` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var a: (Abstract1,);
|
|
}
|
|
|
|
// --- fail_abstract_var.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract2 {}
|
|
|
|
fn Var() {
|
|
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-28: error: binding pattern has abstract type `(Abstract2,)` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var unused v: (Abstract2,);
|
|
}
|
|
|
|
// --- abstract_let.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract3 {
|
|
}
|
|
|
|
fn F(a: Abstract3) {
|
|
let unused l: (Abstract3,) = (a,);
|
|
}
|
|
|
|
// --- fail_abstract_twice.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract4 {}
|
|
abstract class Abstract5 {}
|
|
|
|
fn Var2() {
|
|
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:18-39: error: binding pattern has abstract type `(Abstract4, Abstract5)` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-5]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var unused v2: (Abstract4, Abstract5);
|
|
}
|
|
|
|
// --- fail_abstract_first.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract6 {}
|
|
|
|
fn Var3() {
|
|
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `(Abstract6, {})` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var unused v3: (Abstract6, {});
|
|
}
|
|
|
|
// --- fail_abstract_second.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract7 {}
|
|
|
|
fn Var4() {
|
|
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `({}, Abstract7)` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var unused v4: ({}, Abstract7);
|
|
}
|
|
|
|
// --- lib.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
abstract class Abstract {}
|
|
|
|
// --- fail_import.carbon
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "lib";
|
|
|
|
fn Var5() {
|
|
// CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:18-28: error: binding pattern has abstract type `(Abstract,)` in `var` pattern [AbstractTypeInVarPattern]
|
|
// CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-4]]:1 [InImport]
|
|
// CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere]
|
|
// CHECK:STDERR:
|
|
var unused v5: (Abstract,);
|
|
}
|
|
|
|
// CHECK:STDOUT: --- fail_abstract_field.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract1: type = class_type @Abstract1 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Contains: type = class_type @Contains [concrete]
|
|
// CHECK:STDOUT: %tuple.type.135: type = tuple_type (type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.135 = tuple_value (%Abstract1) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.b06: type = tuple_type (%Abstract1) [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: .Abstract1 = %Abstract1.decl
|
|
// CHECK:STDOUT: .Contains = %Contains.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract1.decl: type = class_decl @Abstract1 [concrete = constants.%Abstract1] {} {}
|
|
// CHECK:STDOUT: %Contains.decl: type = class_decl @Contains [concrete = constants.%Contains] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract1 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract1
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Contains {
|
|
// CHECK:STDOUT: %field_decl: <error> = field_decl a, element0, %.loc9_21.2 in [concrete] {
|
|
// CHECK:STDOUT: %Abstract1.ref: type = name_ref Abstract1, file.%Abstract1.decl [concrete = constants.%Abstract1]
|
|
// CHECK:STDOUT: %.loc9_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc9_21.2: type = converted %.loc9_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness <error> [concrete = <error>]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Contains
|
|
// CHECK:STDOUT: .Abstract1 = <poisoned>
|
|
// CHECK:STDOUT: .a = %field_decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_abstract_var.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract2: type = class_type @Abstract2 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Var.type: type = fn_type @Var [concrete]
|
|
// CHECK:STDOUT: %Var: %Var.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %tuple.type.135: type = tuple_type (type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.135 = tuple_value (%Abstract2) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.ea9: type = tuple_type (%Abstract2) [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct.type: type = fn_type @SelfDestruct [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct: %SelfDestruct.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .SelfDestruct = %Core.SelfDestruct
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Abstract2 = %Abstract2.decl
|
|
// CHECK:STDOUT: .Var = %Var.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract2.decl: type = class_decl @Abstract2 [concrete = constants.%Abstract2] {} {}
|
|
// CHECK:STDOUT: %Var.decl: %Var.type = fn_decl @Var [concrete = constants.%Var] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract2 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Var() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %v.var: ref <error> = var_storage %v.var_patt [concrete = <error>]
|
|
// CHECK:STDOUT: assign %v.var, <error>
|
|
// CHECK:STDOUT: %.loc9_28.1: type = splice_block %.loc9_28.3 [concrete = constants.%tuple.type.ea9] {
|
|
// CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, file.%Abstract2.decl [concrete = constants.%Abstract2]
|
|
// CHECK:STDOUT: %.loc9_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc9_28.3: type = converted %.loc9_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %v: <error> = wrapper_binding v, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %v.patt: <error> = ref_binding_pattern v [concrete = <error>]
|
|
// CHECK:STDOUT: %v.var_patt: <error> = var_pattern %v.patt [concrete = <error>]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- abstract_let.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract3: type = class_type @Abstract3 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %pattern_type.457: type = pattern_type %Abstract3 [concrete]
|
|
// CHECK:STDOUT: %a.param_patt: %pattern_type.457 = value_param_pattern [concrete]
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.457 = wrapper_binding_pattern a, %a.param_patt [concrete]
|
|
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
|
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %tuple.type.135: type = tuple_type (type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.135 = tuple_value (%Abstract3) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.4cc: type = tuple_type (%Abstract3) [concrete]
|
|
// CHECK:STDOUT: %pattern_type.ac0: type = pattern_type %tuple.type.4cc [concrete]
|
|
// CHECK:STDOUT: %l.patt: %pattern_type.ac0 = value_binding_pattern l [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: .Abstract3 = %Abstract3.decl
|
|
// CHECK:STDOUT: .F = %F.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract3.decl: type = class_decl @Abstract3 [concrete = constants.%Abstract3] {} {}
|
|
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
|
|
// CHECK:STDOUT: %a.param_patt: %pattern_type.457 = value_param_pattern [concrete = constants.%a.param_patt]
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.457 = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %a.param: %Abstract3 = value_param call_param0
|
|
// CHECK:STDOUT: %Abstract3.ref.loc6: type = name_ref Abstract3, file.%Abstract3.decl [concrete = constants.%Abstract3]
|
|
// CHECK:STDOUT: %a: %Abstract3 = wrapper_binding a, %a.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract3 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract3
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F(%a.param: %Abstract3) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %Abstract3 = name_ref a, %a
|
|
// CHECK:STDOUT: %.loc7_35.1: %tuple.type.4cc = tuple_literal (%a.ref)
|
|
// CHECK:STDOUT: %tuple: %tuple.type.4cc = tuple_value (%a.ref)
|
|
// CHECK:STDOUT: %.loc7_35.2: %tuple.type.4cc = converted %.loc7_35.1, %tuple
|
|
// CHECK:STDOUT: %.loc7_28.1: type = splice_block %.loc7_28.3 [concrete = constants.%tuple.type.4cc] {
|
|
// CHECK:STDOUT: %Abstract3.ref.loc7: type = name_ref Abstract3, file.%Abstract3.decl [concrete = constants.%Abstract3]
|
|
// CHECK:STDOUT: %.loc7_28.2: %tuple.type.135 = tuple_literal (%Abstract3.ref.loc7) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc7_28.3: type = converted %.loc7_28.2, constants.%tuple.type.4cc [concrete = constants.%tuple.type.4cc]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %l: %tuple.type.4cc = wrapper_binding l, %.loc7_35.2
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %l.patt: %pattern_type.ac0 = value_binding_pattern l [concrete = constants.%l.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_abstract_twice.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract4: type = class_type @Abstract4 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Abstract5: type = class_type @Abstract5 [concrete]
|
|
// CHECK:STDOUT: %Var2.type: type = fn_type @Var2 [concrete]
|
|
// CHECK:STDOUT: %Var2: %Var2.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %tuple.type.693: type = tuple_type (type, type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.693 = tuple_value (%Abstract4, %Abstract5) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.417: type = tuple_type (%Abstract4, %Abstract5) [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct.type: type = fn_type @SelfDestruct [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct: %SelfDestruct.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .SelfDestruct = %Core.SelfDestruct
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Abstract4 = %Abstract4.decl
|
|
// CHECK:STDOUT: .Abstract5 = %Abstract5.decl
|
|
// CHECK:STDOUT: .Var2 = %Var2.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract4.decl: type = class_decl @Abstract4 [concrete = constants.%Abstract4] {} {}
|
|
// CHECK:STDOUT: %Abstract5.decl: type = class_decl @Abstract5 [concrete = constants.%Abstract5] {} {}
|
|
// CHECK:STDOUT: %Var2.decl: %Var2.type = fn_decl @Var2 [concrete = constants.%Var2] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract4 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract5 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract5
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Var2() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %v2.var: ref <error> = var_storage %v2.var_patt [concrete = <error>]
|
|
// CHECK:STDOUT: assign %v2.var, <error>
|
|
// CHECK:STDOUT: %.loc10_39.1: type = splice_block %.loc10_39.3 [concrete = constants.%tuple.type.417] {
|
|
// CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, file.%Abstract4.decl [concrete = constants.%Abstract4]
|
|
// CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, file.%Abstract5.decl [concrete = constants.%Abstract5]
|
|
// CHECK:STDOUT: %.loc10_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc10_39.3: type = converted %.loc10_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %v2: <error> = wrapper_binding v2, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %v2.patt: <error> = ref_binding_pattern v2 [concrete = <error>]
|
|
// CHECK:STDOUT: %v2.var_patt: <error> = var_pattern %v2.patt [concrete = <error>]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_abstract_first.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract6: type = class_type @Abstract6 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Var3.type: type = fn_type @Var3 [concrete]
|
|
// CHECK:STDOUT: %Var3: %Var3.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %tuple.type.4d1: type = tuple_type (type, %empty_struct_type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.4d1 = tuple_value (%Abstract6, %empty_struct) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.427: type = tuple_type (%Abstract6, %empty_struct_type) [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct.type: type = fn_type @SelfDestruct [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct: %SelfDestruct.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .SelfDestruct = %Core.SelfDestruct
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Abstract6 = %Abstract6.decl
|
|
// CHECK:STDOUT: .Var3 = %Var3.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract6.decl: type = class_decl @Abstract6 [concrete = constants.%Abstract6] {} {}
|
|
// CHECK:STDOUT: %Var3.decl: %Var3.type = fn_decl @Var3 [concrete = constants.%Var3] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract6 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract6
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Var3() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %v3.var: ref <error> = var_storage %v3.var_patt [concrete = <error>]
|
|
// CHECK:STDOUT: assign %v3.var, <error>
|
|
// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.427] {
|
|
// CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, file.%Abstract6.decl [concrete = constants.%Abstract6]
|
|
// CHECK:STDOUT: %.loc9_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc9_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc9_31) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
|
// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %v3: <error> = wrapper_binding v3, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %v3.patt: <error> = ref_binding_pattern v3 [concrete = <error>]
|
|
// CHECK:STDOUT: %v3.var_patt: <error> = var_pattern %v3.patt [concrete = <error>]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_abstract_second.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract7: type = class_type @Abstract7 [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Var4.type: type = fn_type @Var4 [concrete]
|
|
// CHECK:STDOUT: %Var4: %Var4.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %tuple.type.12a: type = tuple_type (%empty_struct_type, type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.12a = tuple_value (%empty_struct, %Abstract7) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.9db: type = tuple_type (%empty_struct_type, %Abstract7) [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct.type: type = fn_type @SelfDestruct [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct: %SelfDestruct.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .SelfDestruct = %Core.SelfDestruct
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Abstract7 = %Abstract7.decl
|
|
// CHECK:STDOUT: .Var4 = %Var4.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract7.decl: type = class_decl @Abstract7 [concrete = constants.%Abstract7] {} {}
|
|
// CHECK:STDOUT: %Var4.decl: %Var4.type = fn_decl @Var4 [concrete = constants.%Var4] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract7 {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract7
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Var4() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %v4.var: ref <error> = var_storage %v4.var_patt [concrete = <error>]
|
|
// CHECK:STDOUT: assign %v4.var, <error>
|
|
// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.9db] {
|
|
// CHECK:STDOUT: %.loc9_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, file.%Abstract7.decl [concrete = constants.%Abstract7]
|
|
// CHECK:STDOUT: %.loc9_32.2: %tuple.type.12a = tuple_literal (%.loc9_20, %Abstract7.ref) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
|
// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %v4: <error> = wrapper_binding v4, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %v4.patt: <error> = ref_binding_pattern v4 [concrete = <error>]
|
|
// CHECK:STDOUT: %v4.var_patt: <error> = var_pattern %v4.patt [concrete = <error>]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- lib.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Abstract: type = class_type @Abstract [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <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: 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: .Abstract = %Abstract.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [concrete = constants.%Abstract] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Abstract
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_import.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Var5.type: type = fn_type @Var5 [concrete]
|
|
// CHECK:STDOUT: %Var5: %Var5.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %Abstract: type = class_type @Abstract [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %tuple.type.135: type = tuple_type (type) [concrete]
|
|
// CHECK:STDOUT: %tuple: %tuple.type.135 = tuple_value (%Abstract) [concrete]
|
|
// CHECK:STDOUT: %tuple.type.763: type = tuple_type (%Abstract) [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct.type: type = fn_type @SelfDestruct [concrete]
|
|
// CHECK:STDOUT: %SelfDestruct: %SelfDestruct.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.Abstract: type = import_ref Main//lib, Abstract, loaded [concrete = constants.%Abstract]
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .SelfDestruct = %Core.SelfDestruct
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//lib, loc3_26, loaded [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: %Main.import_ref.fe1 = import_ref Main//lib, inst{{[0-9A-F]+}} [no loc], unloaded
|
|
// CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Abstract = imports.%Main.Abstract
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Var5 = %Var5.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %Var5.decl: %Var5.type = fn_decl @Var5 [concrete = constants.%Var5] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Abstract [from "lib.carbon"] {
|
|
// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%Main.import_ref.fe1
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Var5() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %v5.var: ref <error> = var_storage %v5.var_patt [concrete = <error>]
|
|
// CHECK:STDOUT: assign %v5.var, <error>
|
|
// CHECK:STDOUT: %.loc10_28.1: type = splice_block %.loc10_28.3 [concrete = constants.%tuple.type.763] {
|
|
// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract]
|
|
// CHECK:STDOUT: %.loc10_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple]
|
|
// CHECK:STDOUT: %.loc10_28.3: type = converted %.loc10_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %v5: <error> = wrapper_binding v5, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %v5.patt: <error> = ref_binding_pattern v5 [concrete = <error>]
|
|
// CHECK:STDOUT: %v5.var_patt: <error> = var_pattern %v5.patt [concrete = <error>]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|