mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-23 00:22:38 +00:00
Introduces the `BindingPattern` and `SymbolicBindingPattern` insts, and a separate stack of pattern blocks that they are emitted into. The intent is to generate the corresponding pattern-matching insts (like `BindName`) from them in a separate pass, but that is deferred to future PRs. See [here](https://docs.google.com/document/d/1U_vQH17V893J9aF1LJXUnFYBNSs2MjKl4bJPaWCB2zo/edit?usp=sharing&resourcekey=0-w0xGYZ0An31Kpz-wvzSXwQ) for the design this is based on, but note that during review we have chosen to deviate from that design by putting the patterns in separate blocks, and omitting the "forward references" from a `BindingPattern` to its corresponding `BindName`. This in turn necessitates having separate inst kinds for symbolic and non-symbolic binding patterns. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
352 lines
18 KiB
Plaintext
352 lines
18 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
|
|
//
|
|
// 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
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_incomplete.carbon
|
|
|
|
class Class;
|
|
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:4: error: cannot declare a member of incomplete class `Class`
|
|
// CHECK:STDERR: fn Class.Function() {}
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-5]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn Class.Function() {}
|
|
|
|
fn CallClassFunction() {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:3: error: member access into incomplete class `Class`
|
|
// CHECK:STDERR: Class.Function();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-15]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
Class.Function();
|
|
}
|
|
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:17: error: Variable has incomplete type `Class`
|
|
// CHECK:STDERR: var global_var: Class;
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-25]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
var global_var: Class;
|
|
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:24: error: function returns incomplete type `Class`
|
|
// CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; }
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-34]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn ConvertFromStruct() -> Class { return {}; }
|
|
|
|
fn G(p: Class*) -> i32 {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:10: error: member access into object of incomplete type `Class`
|
|
// CHECK:STDERR: return p->n;
|
|
// CHECK:STDERR: ^~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-44]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
return p->n;
|
|
}
|
|
|
|
fn MemberAccess(p: Class*) -> i32 {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:11: error: member access into object of incomplete type `Class`
|
|
// CHECK:STDERR: return (*p).n;
|
|
// CHECK:STDERR: ^~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-55]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
return (*p).n;
|
|
}
|
|
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:20: error: function returns incomplete type `Class`
|
|
// CHECK:STDERR: fn Copy(p: Class*) -> Class {
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-65]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn Copy(p: Class*) -> Class {
|
|
return *p;
|
|
}
|
|
|
|
fn Let(p: Class*) {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+7]]:10: error: `let` binding has incomplete type `Class`
|
|
// CHECK:STDERR: let c: Class = *p;
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-77]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
let c: Class = *p;
|
|
}
|
|
|
|
fn TakeIncomplete(c: Class);
|
|
|
|
fn ReturnIncomplete() -> Class;
|
|
|
|
fn CallTakeIncomplete(p: Class*) {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+10]]:3: error: forming value of incomplete type `Class`
|
|
// CHECK:STDERR: TakeIncomplete(*p);
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-92]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-11]]:1: note: initializing parameter 1 of function declared here
|
|
// CHECK:STDERR: fn TakeIncomplete(c: Class);
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
TakeIncomplete(*p);
|
|
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+10]]:3: error: forming value of incomplete type `Class`
|
|
// CHECK:STDERR: TakeIncomplete({});
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-104]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-23]]:1: note: initializing parameter 1 of function declared here
|
|
// CHECK:STDERR: fn TakeIncomplete(c: Class);
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
TakeIncomplete({});
|
|
}
|
|
|
|
fn CallReturnIncomplete() {
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+9]]:3: error: function returns incomplete type `Class`
|
|
// CHECK:STDERR: ReturnIncomplete();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-118]]:1: note: class was forward declared here
|
|
// CHECK:STDERR: class Class;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-35]]:23: note: return type declared here
|
|
// CHECK:STDERR: fn ReturnIncomplete() -> Class;
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
ReturnIncomplete();
|
|
}
|
|
|
|
// CHECK:STDOUT: --- fail_incomplete.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Class: type = class_type @Class [template]
|
|
// CHECK:STDOUT: %.type: type = fn_type @.1 [template]
|
|
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %.2: %.type = struct_value () [template]
|
|
// CHECK:STDOUT: %CallClassFunction.type: type = fn_type @CallClassFunction [template]
|
|
// CHECK:STDOUT: %CallClassFunction: %CallClassFunction.type = struct_value () [template]
|
|
// CHECK:STDOUT: %ConvertFromStruct.type: type = fn_type @ConvertFromStruct [template]
|
|
// CHECK:STDOUT: %ConvertFromStruct: %ConvertFromStruct.type = struct_value () [template]
|
|
// CHECK:STDOUT: %.3: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %.4: type = ptr_type %Class [template]
|
|
// CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
|
|
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
|
|
// CHECK:STDOUT: %G.type: type = fn_type @G [template]
|
|
// CHECK:STDOUT: %G: %G.type = struct_value () [template]
|
|
// CHECK:STDOUT: %MemberAccess.type: type = fn_type @MemberAccess [template]
|
|
// CHECK:STDOUT: %MemberAccess: %MemberAccess.type = struct_value () [template]
|
|
// CHECK:STDOUT: %Copy.type: type = fn_type @Copy [template]
|
|
// CHECK:STDOUT: %Copy: %Copy.type = struct_value () [template]
|
|
// CHECK:STDOUT: %Let.type: type = fn_type @Let [template]
|
|
// CHECK:STDOUT: %Let: %Let.type = struct_value () [template]
|
|
// CHECK:STDOUT: %TakeIncomplete.type: type = fn_type @TakeIncomplete [template]
|
|
// CHECK:STDOUT: %TakeIncomplete: %TakeIncomplete.type = struct_value () [template]
|
|
// CHECK:STDOUT: %ReturnIncomplete.type: type = fn_type @ReturnIncomplete [template]
|
|
// CHECK:STDOUT: %ReturnIncomplete: %ReturnIncomplete.type = struct_value () [template]
|
|
// CHECK:STDOUT: %CallTakeIncomplete.type: type = fn_type @CallTakeIncomplete [template]
|
|
// CHECK:STDOUT: %CallTakeIncomplete: %CallTakeIncomplete.type = struct_value () [template]
|
|
// CHECK:STDOUT: %CallReturnIncomplete.type: type = fn_type @CallReturnIncomplete [template]
|
|
// CHECK:STDOUT: %CallReturnIncomplete: %CallReturnIncomplete.type = struct_value () [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
|
|
// CHECK:STDOUT: .Int32 = %import_ref
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/operators
|
|
// CHECK:STDOUT: import Core//prelude/types
|
|
// CHECK:STDOUT: import Core//prelude/operators/arithmetic
|
|
// CHECK:STDOUT: import Core//prelude/operators/as
|
|
// CHECK:STDOUT: import Core//prelude/operators/bitwise
|
|
// CHECK:STDOUT: import Core//prelude/operators/comparison
|
|
// CHECK:STDOUT: import Core//prelude/types/bool
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// 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: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} {}
|
|
// CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.2] {} {}
|
|
// CHECK:STDOUT: %CallClassFunction.decl: %CallClassFunction.type = fn_decl @CallClassFunction [template = constants.%CallClassFunction] {} {}
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %global_var.var: ref <error> = var global_var
|
|
// CHECK:STDOUT: %global_var: ref <error> = bind_name global_var, %global_var.var
|
|
// CHECK:STDOUT: %ConvertFromStruct.decl: %ConvertFromStruct.type = fn_decl @ConvertFromStruct [template = constants.%ConvertFromStruct] {} {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %return: ref %Class = var <return slot>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
|
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %.loc51_14: type = ptr_type %Class [template = constants.%.4]
|
|
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
|
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
|
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
|
// CHECK:STDOUT: %.loc51_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
// CHECK:STDOUT: %.loc51_20.2: type = converted %int.make_type_32, %.loc51_20.1 [template = i32]
|
|
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %MemberAccess.decl: %MemberAccess.type = fn_decl @MemberAccess [template = constants.%MemberAccess] {
|
|
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %.loc62_25: type = ptr_type %Class [template = constants.%.4]
|
|
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
|
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
|
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
|
// CHECK:STDOUT: %.loc62_31.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
// CHECK:STDOUT: %.loc62_31.2: type = converted %int.make_type_32, %.loc62_31.1 [template = i32]
|
|
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Copy.decl: %Copy.type = fn_decl @Copy [template = constants.%Copy] {
|
|
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref.loc80_12: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %.loc80: type = ptr_type %Class [template = constants.%.4]
|
|
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
|
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
|
// CHECK:STDOUT: %Class.ref.loc80_23: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %return: ref %Class = var <return slot>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Let.decl: %Let.type = fn_decl @Let [template = constants.%Let] {
|
|
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref.loc84: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %.loc84: type = ptr_type %Class [template = constants.%.4]
|
|
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
|
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %TakeIncomplete.decl: %TakeIncomplete.type = fn_decl @TakeIncomplete [template = constants.%TakeIncomplete] {
|
|
// CHECK:STDOUT: %c.patt: %Class = binding_pattern c
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %c.param: %Class = param c, runtime_param0
|
|
// CHECK:STDOUT: %c: %Class = bind_name c, %c.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %ReturnIncomplete.decl: %ReturnIncomplete.type = fn_decl @ReturnIncomplete [template = constants.%ReturnIncomplete] {} {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %return: ref %Class = var <return slot>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %CallTakeIncomplete.decl: %CallTakeIncomplete.type = fn_decl @CallTakeIncomplete [template = constants.%CallTakeIncomplete] {
|
|
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %.loc99: type = ptr_type %Class [template = constants.%.4]
|
|
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
|
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %CallReturnIncomplete.decl: %CallReturnIncomplete.type = fn_decl @CallReturnIncomplete [template = constants.%CallReturnIncomplete] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Class;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @.1() {
|
|
// 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 [template = constants.%Class]
|
|
// CHECK:STDOUT: %Function.ref: <error> = name_ref Function, <error> [template = <error>]
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @ConvertFromStruct() -> %Class {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc49: %.3 = struct_literal ()
|
|
// CHECK:STDOUT: return <error>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @G(%p: %.4) -> i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %p.ref: %.4 = name_ref p, %p
|
|
// CHECK:STDOUT: %.loc59: ref %Class = deref %p.ref
|
|
// CHECK:STDOUT: return <error>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MemberAccess(%p: %.4) -> i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %p.ref: %.4 = name_ref p, %p
|
|
// CHECK:STDOUT: %.loc70: ref %Class = deref %p.ref
|
|
// CHECK:STDOUT: return <error>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Copy(%p: %.4) -> %Class {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %p.ref: %.4 = name_ref p, %p
|
|
// CHECK:STDOUT: %.loc81: ref %Class = deref %p.ref
|
|
// CHECK:STDOUT: return <error>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Let(%p: %.4) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Class.ref.loc92: type = name_ref Class, file.%Class.decl [template = constants.%Class]
|
|
// CHECK:STDOUT: %p.ref: %.4 = name_ref p, %p
|
|
// CHECK:STDOUT: %.loc92: ref %Class = deref %p.ref
|
|
// CHECK:STDOUT: %c: <error> = bind_name c, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @TakeIncomplete(%c: %Class);
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @ReturnIncomplete() -> %Class;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @CallTakeIncomplete(%p: %.4) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %TakeIncomplete.ref.loc110: %TakeIncomplete.type = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%TakeIncomplete]
|
|
// CHECK:STDOUT: %p.ref: %.4 = name_ref p, %p
|
|
// CHECK:STDOUT: %.loc110: ref %Class = deref %p.ref
|
|
// CHECK:STDOUT: %TakeIncomplete.call.loc110: init %.1 = call %TakeIncomplete.ref.loc110(<invalid>) [template = <error>]
|
|
// CHECK:STDOUT: %TakeIncomplete.ref.loc122: %TakeIncomplete.type = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%TakeIncomplete]
|
|
// CHECK:STDOUT: %.loc122: %.3 = struct_literal ()
|
|
// CHECK:STDOUT: %TakeIncomplete.call.loc122: init %.1 = call %TakeIncomplete.ref.loc122(<invalid>) [template = <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 [template = constants.%ReturnIncomplete]
|
|
// CHECK:STDOUT: %ReturnIncomplete.call: init <error> = call %ReturnIncomplete.ref()
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|