From 57a2715f10b138543b8744a4e3e232d60cd1eb82 Mon Sep 17 00:00:00 2001 From: Geoff Romer Date: Tue, 18 Nov 2025 11:48:58 -0800 Subject: [PATCH] Remove support for `addr` (#6375) Every test that used `addr` before #6283 should be using `ref` after this PR. In most cases that was done in #6283, but this PR transitions a few that I missed in that first pass. In addition, #6283 cloned the old `addr` tests from `foo.carbon` to `foo_addr.carbon` in order to maintain test coverage during the transition; this PR removes those cloned tests. --- examples/advent2024/day10_part1.carbon | 6 +- examples/advent2024/day10_part2.carbon | 6 +- examples/advent2024/day12_common.carbon | 28 +- examples/advent2024/day2_part1.carbon | 22 +- examples/advent2024/day2_part2.carbon | 32 +- examples/advent2024/day5_common.carbon | 18 +- examples/advent2024/day6_common.carbon | 28 +- examples/advent2024/day6_part2.carbon | 18 +- examples/advent2024/day9_common.carbon | 36 +- examples/sieve.carbon | 4 +- third_party/examples/re2/re2.carbon | 50 +- toolchain/check/handle_binding_pattern.cpp | 31 - toolchain/check/import_ref.cpp | 19 - toolchain/check/merge.cpp | 6 - toolchain/check/pattern_match.cpp | 44 - .../testdata/class/base_method_addr.carbon | 195 --- .../class/base_method_shadow_addr.carbon | 259 --- .../testdata/class/fail_addr_not_self.carbon | 25 - .../testdata/class/fail_addr_self.carbon | 155 -- .../testdata/class/fail_incomplete.carbon | 14 +- .../class/fail_memaccess_category.carbon | 14 +- .../testdata/class/generic/basic_addr.carbon | 287 ---- .../class/generic/member_access.carbon | 47 +- .../check/testdata/class/import_addr.carbon | 456 ----- .../check/testdata/class/method_addr.carbon | 489 ------ .../check/testdata/class/raw_self_addr.carbon | 236 --- .../check/testdata/class/self_addr.carbon | 266 --- .../class/self_conversion_addr.carbon | 277 --- .../testdata/class/syntactic_merge.carbon | 99 -- .../testdata/class/virtual_modifiers.carbon | 124 -- toolchain/check/testdata/const/basics.carbon | 14 +- .../check/testdata/impl/impl_thunk.carbon | 181 +- .../impl/lookup/impl_forall_addr.carbon | 352 ---- .../interface/compound_member_access.carbon | 604 ------- .../compound_member_access_addr.carbon | 1513 ----------------- .../fail_todo_generic_default_fn.carbon | 10 +- .../interop/cpp/class/abstract.carbon | 6 +- .../testdata/operators/overloaded/add.carbon | 17 +- .../overloaded/binary_op.carbon.tmpl | 3 +- .../operators/overloaded/bit_and.carbon | 17 +- .../operators/overloaded/bit_or.carbon | 17 +- .../operators/overloaded/bit_xor.carbon | 17 +- .../testdata/operators/overloaded/dec.carbon | 16 +- .../testdata/operators/overloaded/div.carbon | 17 +- .../overloaded/fail_assign_non_ref.carbon | 116 +- .../overloaded/fail_no_impl_for_arg.carbon | 2 +- .../testdata/operators/overloaded/inc.carbon | 16 +- .../operators/overloaded/left_shift.carbon | 17 +- .../testdata/operators/overloaded/mod.carbon | 17 +- .../testdata/operators/overloaded/mul.carbon | 17 +- .../operators/overloaded/negate.carbon | 2 +- .../operators/overloaded/right_shift.carbon | 17 +- .../testdata/operators/overloaded/sub.carbon | 17 +- .../operators/overloaded/unary_op.carbon.tmpl | 1 + .../overloaded/unary_stmt.carbon.tmpl | 3 +- toolchain/check/thunk.cpp | 22 - toolchain/diagnostics/diagnostic_kind.def | 3 - toolchain/lex/token_kind.def | 1 - .../lower/testdata/array/field_addr.carbon | 89 - .../lower/testdata/class/method_addr.carbon | 54 - .../lower/testdata/class/self_addr.carbon | 63 - .../testdata/impl/instance_method_addr.carbon | 62 - toolchain/parse/handle_binding_pattern.cpp | 20 - toolchain/parse/node_kind.def | 1 - toolchain/parse/state.def | 13 - .../testdata/class/fn_definitions.carbon | 17 +- .../testdata/function/declaration.carbon | 17 +- .../generics/generic_params/template.carbon | 58 +- .../generic_params/template_addr.carbon | 51 - .../{self_pointer.carbon => self_ref.carbon} | 34 +- toolchain/parse/typed_nodes.h | 9 - toolchain/sem_ir/expr_info.cpp | 1 - toolchain/sem_ir/function.cpp | 1 - toolchain/sem_ir/inst_kind.def | 1 - toolchain/sem_ir/pattern.cpp | 7 +- toolchain/sem_ir/typed_insts.h | 15 - 76 files changed, 397 insertions(+), 6442 deletions(-) delete mode 100644 toolchain/check/testdata/class/base_method_addr.carbon delete mode 100644 toolchain/check/testdata/class/base_method_shadow_addr.carbon delete mode 100644 toolchain/check/testdata/class/fail_addr_not_self.carbon delete mode 100644 toolchain/check/testdata/class/fail_addr_self.carbon delete mode 100644 toolchain/check/testdata/class/generic/basic_addr.carbon delete mode 100644 toolchain/check/testdata/class/import_addr.carbon delete mode 100644 toolchain/check/testdata/class/method_addr.carbon delete mode 100644 toolchain/check/testdata/class/raw_self_addr.carbon delete mode 100644 toolchain/check/testdata/class/self_addr.carbon delete mode 100644 toolchain/check/testdata/class/self_conversion_addr.carbon delete mode 100644 toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon delete mode 100644 toolchain/check/testdata/interface/compound_member_access_addr.carbon delete mode 100644 toolchain/lower/testdata/array/field_addr.carbon delete mode 100644 toolchain/lower/testdata/class/method_addr.carbon delete mode 100644 toolchain/lower/testdata/class/self_addr.carbon delete mode 100644 toolchain/lower/testdata/impl/instance_method_addr.carbon delete mode 100644 toolchain/parse/testdata/generics/generic_params/template_addr.carbon rename toolchain/parse/testdata/generics/interface/{self_pointer.carbon => self_ref.carbon} (74%) diff --git a/examples/advent2024/day10_part1.carbon b/examples/advent2024/day10_part1.carbon index 3f79753021a8..fb964b3a5014 100644 --- a/examples/advent2024/day10_part1.carbon +++ b/examples/advent2024/day10_part1.carbon @@ -38,7 +38,7 @@ class Reachable { return var; } - fn AddLevel[addr self: Self*](terrain: Terrain, level: i32) { + fn AddLevel[ref self: Self](terrain: Terrain, level: i32) { let adj: array((i32, i32), 4) = ((-1, 0), (0, -1), (1, 0), (0, 1)); for (y: i32 in Core.Range(43)) { for (x: i32 in Core.Range(43)) { @@ -51,11 +51,11 @@ class Reachable { if (adj_x >= 0 and adj_x < 43 and adj_y >= 0 and adj_y < 43 and terrain.height[adj_x][adj_y] == level - 1) { - reach = reach | self->trailheads[adj_x][adj_y]; + reach = reach | self.trailheads[adj_x][adj_y]; } ++i; } - self->trailheads[x][y] = reach; + self.trailheads[x][y] = reach; } } } diff --git a/examples/advent2024/day10_part2.carbon b/examples/advent2024/day10_part2.carbon index 290e0b4e887a..68fcbc3bbf6e 100644 --- a/examples/advent2024/day10_part2.carbon +++ b/examples/advent2024/day10_part2.carbon @@ -23,7 +23,7 @@ class PathsToTop { return var; } - fn AddLevel[addr self: Self*](terrain: Terrain, level: i32) -> i64 { + fn AddLevel[ref self: Self](terrain: Terrain, level: i32) -> i64 { var total: i64 = 0; let adj: array((i32, i32), 4) = ((-1, 0), (0, -1), (1, 0), (0, 1)); for (y: i32 in Core.Range(43)) { @@ -37,10 +37,10 @@ class PathsToTop { if (adj_x >= 0 and adj_x < 43 and adj_y >= 0 and adj_y < 43 and terrain.height[adj_x][adj_y] == level + 1) { - paths += self->paths[adj_x][adj_y]; + paths += self.paths[adj_x][adj_y]; } } - self->paths[x][y] = paths; + self.paths[x][y] = paths; total += paths; } } diff --git a/examples/advent2024/day12_common.carbon b/examples/advent2024/day12_common.carbon index 604b1fb80316..7e79f7d42bf7 100644 --- a/examples/advent2024/day12_common.carbon +++ b/examples/advent2024/day12_common.carbon @@ -42,13 +42,13 @@ class DisjointSetForest { return var; } - fn Lookup[addr self: Self*](a: i32) -> i32 { - let next: i32 = self->nodes[a].next; + fn Lookup[ref self: Self](a: i32) -> i32 { + let next: i32 = self.nodes[a].next; if (next == a) { return next; } - let resolved: i32 = self->Lookup(next); - self->nodes[a].next = resolved; + let resolved: i32 = self.Lookup(next); + self.nodes[a].next = resolved; return resolved; } @@ -60,22 +60,22 @@ class DisjointSetForest { return self.nodes[canon_a].weight; } - fn Union[addr self: Self*](a: i32, b: i32) { - let canon_b: i32 = self->Lookup(b); - self->Set(a, canon_b); - ++self->nodes[canon_b].unions; + fn Union[ref self: Self](a: i32, b: i32) { + let canon_b: i32 = self.Lookup(b); + self.Set(a, canon_b); + ++self.nodes[canon_b].unions; } - private fn Set[addr self: Self*](a: i32, canon_b: i32) { - let next: i32 = self->nodes[a].next; - self->nodes[a].next = canon_b; + private fn Set[ref self: Self](a: i32, canon_b: i32) { + let next: i32 = self.nodes[a].next; + self.nodes[a].next = canon_b; if (next == a) { if (a != canon_b) { - self->nodes[canon_b].weight += self->nodes[a].weight; - self->nodes[canon_b].unions += self->nodes[a].unions; + self.nodes[canon_b].weight += self.nodes[a].weight; + self.nodes[canon_b].unions += self.nodes[a].unions; } } else { - self->Set(next, canon_b); + self.Set(next, canon_b); } } diff --git a/examples/advent2024/day2_part1.carbon b/examples/advent2024/day2_part1.carbon index 310f734935e9..558bc8b2ab07 100644 --- a/examples/advent2024/day2_part1.carbon +++ b/examples/advent2024/day2_part1.carbon @@ -15,23 +15,23 @@ class ReportState { .increasing = false, .safe_so_far = true}; } - fn Add[addr self: Self*](level: i32) { - ++self->levels_so_far; - if (self->levels_so_far >= 2) { - if (not IsSafeDelta(self->previous, level)) { + fn Add[ref self: Self](level: i32) { + ++self.levels_so_far; + if (self.levels_so_far >= 2) { + if (not IsSafeDelta(self.previous, level)) { // Difference is zero or too large. - self->safe_so_far = false; + self.safe_so_far = false; } - var is_increase: bool = level > self->previous; - if (self->levels_so_far == 2) { - self->increasing = is_increase; - } else if (is_increase != self->increasing) { + var is_increase: bool = level > self.previous; + if (self.levels_so_far == 2) { + self.increasing = is_increase; + } else if (is_increase != self.increasing) { // Not monotone. - self->safe_so_far = false; + self.safe_so_far = false; } } - self->previous = level; + self.previous = level; } var levels_so_far: i32; diff --git a/examples/advent2024/day2_part2.carbon b/examples/advent2024/day2_part2.carbon index 9559c79595e7..85fe83ae3ce8 100644 --- a/examples/advent2024/day2_part2.carbon +++ b/examples/advent2024/day2_part2.carbon @@ -12,11 +12,11 @@ import library "io_utils"; // A three-element sliding window of recent levels. class Window { fn Make() -> Window { return {.data = (0,0,0), .size = 0}; } - fn Add[addr self: Self*](n: i32) { - self->data[2] = self->data[1]; - self->data[1] = self->data[0]; - self->data[0] = n; - ++self->size; + fn Add[ref self: Self](n: i32) { + self.data[2] = self.data[1]; + self.data[1] = self.data[0]; + self.data[0] = n; + ++self.size; } var data: array(i32, 3); @@ -36,7 +36,7 @@ class ReportState { .removable_double_bad_edge = false}; } - fn OnAdd[addr self: Self*](window: Window) { + fn OnAdd[ref self: Self](window: Window) { if (window.size < 2) { return; } @@ -47,39 +47,39 @@ class ReportState { let c: i32 = window.data[0]; // Keep a count of the unsafe edges. - let b_to_c: bool = IsSafe(window.data[1], window.data[0], self->increasing); + let b_to_c: bool = IsSafe(window.data[1], window.data[0], self.increasing); if (not b_to_c) { - ++self->bad_edges; + ++self.bad_edges; // We have a removable single bad edge if the first edge is unsafe. if (window.size == 2) { - self->removable_single_bad_edge = true; + self.removable_single_bad_edge = true; } } if (window.size >= 3) { let a: i32 = window.data[2]; - if (IsSafe(a, c, self->increasing)) { - let lhs: bool = IsSafe(a, b, self->increasing); + if (IsSafe(a, c, self.increasing)) { + let lhs: bool = IsSafe(a, b, self.increasing); let rhs: bool = b_to_c; if (not lhs and not rhs) { // If a->b and b->c are both unsafe, but a->c is safe, // then we have a removable double bad edge. - self->removable_double_bad_edge = true; + self.removable_double_bad_edge = true; } else if (not lhs or not rhs) { // If a->b or b->c is unsafe but a->c is safe, then we have a // removable single bad edge. - self->removable_single_bad_edge = true; + self.removable_single_bad_edge = true; } } } } - fn OnFinish[addr self: Self*](window: Window) { + fn OnFinish[ref self: Self](window: Window) { if (window.size >= 2 and - not IsSafe(window.data[1], window.data[0], self->increasing)) { + not IsSafe(window.data[1], window.data[0], self.increasing)) { // We have a removable single bad edge if the last edge is unsafe. - self->removable_single_bad_edge = true; + self.removable_single_bad_edge = true; } } diff --git a/examples/advent2024/day5_common.carbon b/examples/advent2024/day5_common.carbon index dbd225a28cfd..a1e07034885a 100644 --- a/examples/advent2024/day5_common.carbon +++ b/examples/advent2024/day5_common.carbon @@ -61,9 +61,9 @@ class PageList { return var; } - fn Add[addr self: Self*](page: i32) { - self->pages[self->num_pages] = page; - ++self->num_pages; + fn Add[ref self: Self](page: i32) { + self.pages[self.num_pages] = page; + ++self.num_pages; } fn FollowsRules[self: Self](rules: Rules) -> bool { @@ -87,12 +87,12 @@ class PageList { return true; } - fn ExtractPossibleFirstPage[addr self: Self*](rules: Rules) -> i32 { - for (i: i32 in Core.Range(self->num_pages)) { - var page: i32 = self->pages[i]; - if (self->IsPossibleFirstPage(rules, page)) { - self->pages[i] = self->pages[self->num_pages - 1]; - --self->num_pages; + fn ExtractPossibleFirstPage[ref self: Self](rules: Rules) -> i32 { + for (i: i32 in Core.Range(self.num_pages)) { + var page: i32 = self.pages[i]; + if (self.IsPossibleFirstPage(rules, page)) { + self.pages[i] = self.pages[self.num_pages - 1]; + --self.num_pages; return page; } } diff --git a/examples/advent2024/day6_common.carbon b/examples/advent2024/day6_common.carbon index 5da9cb1158c0..df802868729d 100644 --- a/examples/advent2024/day6_common.carbon +++ b/examples/advent2024/day6_common.carbon @@ -57,34 +57,34 @@ class Maze { return var; } - fn Step[addr self: Self*]() -> bool { - let x: i32 = self->loc.0 + self->dir.0; - let y: i32 = self->loc.1 + self->dir.1; + fn Step[ref self: Self]() -> bool { + let x: i32 = self.loc.0 + self.dir.0; + let y: i32 = self.loc.1 + self.dir.1; if (x < 0 or x >= 130 or y < 0 or y >= 130) { return false; } - if (self->data[x][y] == Wall()) { + if (self.data[x][y] == Wall()) { // TODO: Should this work? - // self->dir = (-self->dir.1, self->dir.0); - let d: (i32, i32) = self->dir; - self->dir = (-d.1, d.0); + // self.dir = (-self.dir.1, self.dir.0); + let d: (i32, i32) = self.dir; + self.dir = (-d.1, d.0); } else { - self->loc = (x, y); - self->data[x][y] = Visited(); + self.loc = (x, y); + self.data[x][y] = Visited(); } return true; } - fn AddObstacle[addr self: Self*]() -> bool { - let x: i32 = self->loc.0 + self->dir.0; - let y: i32 = self->loc.1 + self->dir.1; + fn AddObstacle[ref self: Self]() -> bool { + let x: i32 = self.loc.0 + self.dir.0; + let y: i32 = self.loc.1 + self.dir.1; if (x < 0 or x >= 130 or y < 0 or y >= 130) { return false; } - if (self->data[x][y] != Empty()) { + if (self.data[x][y] != Empty()) { return false; } - self->data[x][y] = Wall(); + self.data[x][y] = Wall(); return true; } diff --git a/examples/advent2024/day6_part2.carbon b/examples/advent2024/day6_part2.carbon index 7a28b5cca6c9..d7d96dbd0bab 100644 --- a/examples/advent2024/day6_part2.carbon +++ b/examples/advent2024/day6_part2.carbon @@ -13,17 +13,17 @@ class LoopDetector { return {.last = ((-1, -1), (-1, -1)), .steps = 1, .next_steps = 1}; } - fn Check[addr self: Self*](next: ((i32, i32), (i32, i32))) -> bool { - // TODO: if (next == self->last) { - if (next.0.0 == self->last.0.0 and next.0.1 == self->last.0.1 and - next.1.0 == self->last.1.0 and next.1.1 == self->last.1.1) { + fn Check[ref self: Self](next: ((i32, i32), (i32, i32))) -> bool { + // TODO: if (next == self.last) { + if (next.0.0 == self.last.0.0 and next.0.1 == self.last.0.1 and + next.1.0 == self.last.1.0 and next.1.1 == self.last.1.1) { return true; } - --self->steps; - if (self->steps == 0) { - self->steps = self->next_steps; - self->next_steps <<= 1; - self->last = next; + --self.steps; + if (self.steps == 0) { + self.steps = self.next_steps; + self.next_steps <<= 1; + self.last = next; } return false; } diff --git a/examples/advent2024/day9_common.carbon b/examples/advent2024/day9_common.carbon index 049b8a8ae7e2..0cbbe1261b5a 100644 --- a/examples/advent2024/day9_common.carbon +++ b/examples/advent2024/day9_common.carbon @@ -33,51 +33,51 @@ class SectorList { return var; } - fn DefragBlocks[addr self: Self*]() { + fn DefragBlocks[ref self: Self]() { var i: i32 = 0; - var j: i32 = self->size - 1; + var j: i32 = self.size - 1; while (j > i) { - if (self->data[i] != -1) { + if (self.data[i] != -1) { ++i; - } else if (self->data[j] == -1) { + } else if (self.data[j] == -1) { --j; } else { - self->data[i] = self->data[j]; + self.data[i] = self.data[j]; ++i; --j; } } - self->size = j; + self.size = j; } - fn HasSpace[addr self: Self*](start: i32, size: i32) -> bool { + fn HasSpace[ref self: Self](start: i32, size: i32) -> bool { for (i: i32 in Core.InclusiveRange(start, start + size - 1)) { - if (self->data[i] != -1) { + if (self.data[i] != -1) { return false; } } return true; } - fn Fill[addr self: Self*](start: i32, size: i32, sector: i32) { + fn Fill[ref self: Self](start: i32, size: i32, sector: i32) { for (i: i32 in Core.InclusiveRange(start, start + size - 1)) { - self->data[i] = sector; + self.data[i] = sector; } } - fn DefragFiles[addr self: Self*]() { - var j: i32 = self->size - 1; + fn DefragFiles[ref self: Self]() { + var j: i32 = self.size - 1; while (j >= 0) { // Skip empty sectors. - while (j >= 0 and self->data[j] == -1) { + while (j >= 0 and self.data[j] == -1) { --j; } // Find the file size and sector and delete the file. let last: i32 = j; - let sector: i32 = self->data[last]; - while (j >= 0 and self->data[j] == sector) { - self->data[j] = -1; + let sector: i32 = self.data[last]; + while (j >= 0 and self.data[j] == sector) { + self.data[j] = -1; --j; } let first: i32 = j + 1; @@ -85,7 +85,7 @@ class SectorList { // Find the first available space for the file. var i: i32 = 0; - while (not self->HasSpace(i, size)) { + while (not self.HasSpace(i, size)) { ++i; if (i + size > first) { // If it doesn't fit to the left of its old position, put it back @@ -95,7 +95,7 @@ class SectorList { } // Insert it. - self->Fill(i, size, sector); + self.Fill(i, size, sector); } } diff --git a/examples/sieve.carbon b/examples/sieve.carbon index 32a1c597db49..6e53b043bfd2 100644 --- a/examples/sieve.carbon +++ b/examples/sieve.carbon @@ -16,10 +16,10 @@ class Sieve { return var; } - fn MarkMultiplesNotPrime[addr self: Self*](p: i32) { + fn MarkMultiplesNotPrime[ref self: Self](p: i32) { var n: i32 = p * 2; while (n < 1000) { - self->is_prime[n] = false; + self.is_prime[n] = false; n += p; } } diff --git a/third_party/examples/re2/re2.carbon b/third_party/examples/re2/re2.carbon index 8a87ddb7c44b..250335a33375 100644 --- a/third_party/examples/re2/re2.carbon +++ b/third_party/examples/re2/re2.carbon @@ -697,46 +697,46 @@ class RE2 { impl CannedOptions as ImplicitAs(Self); fn encoding[self: Self]() -> Encoding { return self.encoding_; } - fn set_encoding[addr self: Self*](encoding: Encoding) { self->encoding_ = encoding; } + fn set_encoding[ref self: Self](encoding: Encoding) { self.encoding_ = encoding; } fn posix_syntax[self: Self]() -> bool { return self.posix_syntax_; } - fn set_posix_syntax[addr self: Self*](b: bool) { self->posix_syntax_ = b; } + fn set_posix_syntax[ref self: Self](b: bool) { self.posix_syntax_ = b; } fn longest_match[self: Self]() -> bool { return self.longest_match_; } - fn set_longest_match[addr self: Self*](b: bool) { self->longest_match_ = b; } + fn set_longest_match[ref self: Self](b: bool) { self.longest_match_ = b; } fn log_errors[self: Self]() -> bool { return self.log_errors_; } - fn set_log_errors[addr self: Self*](b: bool) { self->log_errors_ = b; } + fn set_log_errors[ref self: Self](b: bool) { self.log_errors_ = b; } fn max_mem[self: Self]() -> i64 { return self.max_mem_; } - fn set_max_mem[addr self: Self*](m: i64) { self->max_mem_ = m; } + fn set_max_mem[ref self: Self](m: i64) { self.max_mem_ = m; } fn literal[self: Self]() -> bool { return self.literal_; } - fn set_literal[addr self: Self*](b: bool) { self->literal_ = b; } + fn set_literal[ref self: Self](b: bool) { self.literal_ = b; } fn never_nl[self: Self]() -> bool { return self.never_nl_; } - fn set_never_nl[addr self: Self*](b: bool) { self->never_nl_ = b; } + fn set_never_nl[ref self: Self](b: bool) { self.never_nl_ = b; } fn dot_nl[self: Self]() -> bool { return self.dot_nl_; } - fn set_dot_nl[addr self: Self*](b: bool) { self->dot_nl_ = b; } + fn set_dot_nl[ref self: Self](b: bool) { self.dot_nl_ = b; } fn never_capture[self: Self]() -> bool { return self.never_capture_; } - fn set_never_capture[addr self: Self*](b: bool) { self->never_capture_ = b; } + fn set_never_capture[ref self: Self](b: bool) { self.never_capture_ = b; } fn case_sensitive[self: Self]() -> bool { return self.case_sensitive_; } - fn set_case_sensitive[addr self: Self*](b: bool) { self->case_sensitive_ = b; } + fn set_case_sensitive[ref self: Self](b: bool) { self.case_sensitive_ = b; } fn perl_classes[self: Self]() -> bool { return self.perl_classes_; } - fn set_perl_classes[addr self: Self*](b: bool) { self->perl_classes_ = b; } + fn set_perl_classes[ref self: Self](b: bool) { self.perl_classes_ = b; } fn word_boundary[self: Self]() -> bool { return self.word_boundary_; } - fn set_word_boundary[addr self: Self*](b: bool) { self->word_boundary_ = b; } + fn set_word_boundary[ref self: Self](b: bool) { self.word_boundary_ = b; } fn one_line[self: Self]() -> bool { return self.one_line_; } - fn set_one_line[addr self: Self*](b: bool) { self->one_line_ = b; } + fn set_one_line[ref self: Self](b: bool) { self.one_line_ = b; } - fn Copy[addr self: Self*](src: Options) { - *self = src; + fn Copy[ref self: Self](src: Options) { + self = src; } fn ParseFlags[self: Self]() -> i32; @@ -823,7 +823,7 @@ class RE2 { /***** Implementation details *****/ private interface Parse3ary { - fn Parse(str: StringView, n: i64, dest: Self*) -> bool; + fn Parse(str: StringView, n: i64, dest: Self) -> bool; } impl void as Parse3ary; impl String as Parse3ary; @@ -833,7 +833,7 @@ impl f32 as Parse3ary; impl f64 as Parse3ary; private interface Parse4ary { - fn Parse(str: StringView, n: i64, dest: Self*, radix: i32) -> bool; + fn Parse(str: StringView, n: i64, dest: Self, radix: i32) -> bool; } impl i16 as Parse4ary; impl u16 as Parse4ary; @@ -853,21 +853,21 @@ class RE2.Arg { fn Make(nullptr) -> Self { return Make(nullptr as NullArg*); } interface Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool; + fn Parse[ref self: Self](str: StringView, n: i64) -> bool; } match_first { impl [T:! Parse3ary] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[ref self: Self](str: StringView, n: i64) -> bool { return T.Parse(str, n, self); } } impl [T:! Parse4ary] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[ref self: Self](str: StringView, n: i64) -> bool { return T.Parse(str, n, self, 10); } } impl [T:! ParseFrom] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[ref self: Self](str: StringView, n: i64) -> bool { if (self == nullptr) { return true; } return T.Parse(str, n, self); } @@ -876,7 +876,7 @@ class RE2.Arg { private class NullArg {} impl NullArg as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[ref self: Self](str: StringView, n: i64) -> bool { return true; } } @@ -896,7 +896,7 @@ class RE2.Arg { private adapter ParseAsBase(T:! Parse4ary, base: i32) for T { impl as Self.Arg.Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[ref self: Self](str: StringView, n: i64) -> bool { return T.Parse(str, n, self, base); } } @@ -942,7 +942,7 @@ class LazyRE2 { } // Named accessor/initializer: - fn get[addr self: Self*]() -> RE* { + fn get[ref self: Self]() -> RE* { Cpp.std.call_once(once_, Self.Init, self); return ptr_; } @@ -954,7 +954,7 @@ class LazyRE2 { private var ptr_: RE2*; private var once_: Cpp.std.once_flag; - private fn Init(lazy_re2: LazyRE2*) { + private fn Init(ref lazy_re2: LazyRE2) { lazy_re2->ptr_ = heap.New!(RE2.Make(lazy_re2->pattern_, lazy_re2->options_)); } } diff --git a/toolchain/check/handle_binding_pattern.cpp b/toolchain/check/handle_binding_pattern.cpp index 35f8df843ba3..f21c5cab87f8 100644 --- a/toolchain/check/handle_binding_pattern.cpp +++ b/toolchain/check/handle_binding_pattern.cpp @@ -402,37 +402,6 @@ auto HandleParseNode(Context& context, Parse::FieldNameAndTypeId node_id) return true; } -auto HandleParseNode(Context& context, Parse::AddrId node_id) -> bool { - auto param_pattern_id = context.node_stack().PopPattern(); - if (SemIR::IsSelfPattern(context.sem_ir(), param_pattern_id)) { - auto param_type_id = ExtractScrutineeType( - context.sem_ir(), context.insts().Get(param_pattern_id).type_id()); - auto pointer_type = - context.types().TryGetAs(param_type_id); - if (pointer_type) { - auto addr_pattern_id = AddPatternInst( - context, node_id, - {.type_id = GetPatternType( - context, GetSingletonType(context, SemIR::AutoType::TypeInstId)), - .inner_id = param_pattern_id}); - context.node_stack().Push(node_id, addr_pattern_id); - } else { - CARBON_DIAGNOSTIC( - AddrOnNonPointerType, Error, - "`addr` can only be applied to a binding with a pointer type"); - context.emitter().Emit(node_id, AddrOnNonPointerType); - context.node_stack().Push(node_id, param_pattern_id); - } - } else { - CARBON_DIAGNOSTIC(AddrOnNonSelfParam, Error, - "`addr` can only be applied to a `self` parameter"); - context.emitter().Emit(LocIdForDiagnostics::TokenOnly(node_id), - AddrOnNonSelfParam); - context.node_stack().Push(node_id, param_pattern_id); - } - return true; -} - auto HandleParseNode(Context& context, Parse::RefBindingNameId node_id) -> bool { context.node_stack().Push(node_id); diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 92d9b6aa002b..2225c000a110 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -1342,22 +1342,6 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver, resolver, import_inst_id, {.adapted_type_inst_id = adapted_type_inst_id}); } -static auto TryResolveTypedInst(ImportRefResolver& resolver, - SemIR::AddrPattern inst, - SemIR::InstId import_inst_id) -> ResolveResult { - auto type_const_id = GetLocalConstantId(resolver, inst.type_id); - auto inner_id = GetLocalConstantInstId(resolver, inst.inner_id); - if (resolver.HasNewWork()) { - return ResolveResult::Retry(); - } - - return ResolveResult::Unique( - resolver, import_inst_id, - {.type_id = resolver.local_context().types().GetTypeIdForTypeConstantId( - type_const_id), - .inner_id = inner_id}); -} - template requires SemIR::Internal::HasInstCategory @@ -3457,9 +3441,6 @@ static auto TryResolveInstCanonical(ImportRefResolver& resolver, case CARBON_KIND(SemIR::AdaptDecl inst): { return TryResolveTypedInst(resolver, inst, constant_inst_id); } - case CARBON_KIND(SemIR::AddrPattern inst): { - return TryResolveTypedInst(resolver, inst, constant_inst_id); - } case CARBON_KIND(SemIR::ArrayType inst): { return TryResolveTypedInst(resolver, inst); } diff --git a/toolchain/check/merge.cpp b/toolchain/check/merge.cpp index 1c6cbfdd2886..b9b419bc3e11 100644 --- a/toolchain/check/merge.cpp +++ b/toolchain/check/merge.cpp @@ -249,12 +249,6 @@ static auto CheckRedeclParam(Context& context, bool is_implicit_param, } switch (new_param_pattern.kind()) { - case SemIR::AddrPattern::Kind: { - pattern_stack.push_back( - {.prev_id = prev_param_pattern.As().inner_id, - .new_id = new_param_pattern.As().inner_id}); - break; - } case SemIR::OutParamPattern::Kind: case SemIR::RefParamPattern::Kind: case SemIR::ValueParamPattern::Kind: diff --git a/toolchain/check/pattern_match.cpp b/toolchain/check/pattern_match.cpp index 4cd785101b36..859b6f432aa7 100644 --- a/toolchain/check/pattern_match.cpp +++ b/toolchain/check/pattern_match.cpp @@ -98,8 +98,6 @@ class MatchContext { auto DoEmitPatternMatch(Context& context, SemIR::AnyBindingPattern binding_pattern, WorkItem entry) -> void; - auto DoEmitPatternMatch(Context& context, SemIR::AddrPattern addr_pattern, - WorkItem entry) -> void; auto DoEmitPatternMatch(Context& context, SemIR::ValueParamPattern param_pattern, WorkItem entry) -> void; @@ -254,44 +252,6 @@ auto MatchContext::DoEmitPatternMatch(Context& context, } } -auto MatchContext::DoEmitPatternMatch(Context& context, - SemIR::AddrPattern addr_pattern, - WorkItem entry) -> void { - CARBON_CHECK(kind_ != MatchKind::Local); - if (kind_ == MatchKind::Callee) { - // We're emitting pattern-match IR for the callee, but we're still on - // the caller side of the pattern, so we traverse without emitting any - // insts. - AddWork({.pattern_id = addr_pattern.inner_id, - .scrutinee_id = SemIR::InstId::None}); - return; - } - CARBON_CHECK(entry.scrutinee_id.has_value()); - auto scrutinee_ref_id = ConvertToValueOrRefExpr(context, entry.scrutinee_id); - switch (SemIR::GetExprCategory(context.sem_ir(), scrutinee_ref_id)) { - case SemIR::ExprCategory::Error: - case SemIR::ExprCategory::DurableRef: - case SemIR::ExprCategory::EphemeralRef: - break; - default: - CARBON_DIAGNOSTIC(AddrSelfIsNonRef, Error, - "`addr self` method cannot be invoked on a value"); - context.emitter().Emit(entry.scrutinee_id, AddrSelfIsNonRef); - // Add fake reference expression to preserve invariants. - auto scrutinee = context.insts().GetWithLocId(entry.scrutinee_id); - scrutinee_ref_id = AddInst( - context, scrutinee.loc_id, {.type_id = scrutinee.inst.type_id()}); - } - auto scrutinee_ref = context.insts().Get(scrutinee_ref_id); - auto scrutinee_ref_type_inst_id = - context.types().GetInstId(scrutinee_ref.type_id()); - auto new_scrutinee = AddInst( - context, SemIR::LocId(scrutinee_ref_id), - {.type_id = GetPointerType(context, scrutinee_ref_type_inst_id), - .lvalue_id = scrutinee_ref_id}); - AddWork({.pattern_id = addr_pattern.inner_id, .scrutinee_id = new_scrutinee}); -} - auto MatchContext::DoEmitPatternMatch(Context& context, SemIR::ValueParamPattern param_pattern, WorkItem entry) -> void { @@ -606,10 +566,6 @@ auto MatchContext::EmitPatternMatch(Context& context, entry); break; } - case CARBON_KIND(SemIR::AddrPattern addr_pattern): { - DoEmitPatternMatch(context, addr_pattern, entry); - break; - } case CARBON_KIND(SemIR::ValueParamPattern param_pattern): { DoEmitPatternMatch(context, param_pattern, entry); break; diff --git a/toolchain/check/testdata/class/base_method_addr.carbon b/toolchain/check/testdata/class/base_method_addr.carbon deleted file mode 100644 index 5c37a373e2c8..000000000000 --- a/toolchain/check/testdata/class/base_method_addr.carbon +++ /dev/null @@ -1,195 +0,0 @@ -// 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/int.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/base_method_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method_addr.carbon - -base class Base { - var a: i32; - - fn F[addr self: Self*](); -} - -fn Base.F[addr self: Self*]() { - (*self).a = 1; -} - -class Derived { - extend base: Base; -} - -fn Call(p: Derived*) { - (*p).F(); -} - -// CHECK:STDOUT: --- base_method_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Base: type = class_type @Base [concrete] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] -// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete] -// CHECK:STDOUT: %ptr.11f: type = ptr_type %Base [concrete] -// CHECK:STDOUT: %pattern_type.1b9: type = pattern_type %ptr.11f [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Base.F.type: type = fn_type @Base.F [concrete] -// CHECK:STDOUT: %Base.F: %Base.F.type = struct_value () [concrete] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete] -// CHECK:STDOUT: %complete_type.fd7: = complete_type_witness %struct_type.a [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.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] -// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete] -// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete] -// CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete] -// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete] -// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] -// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete] -// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [concrete] -// CHECK:STDOUT: %struct_type.base.b1e: type = struct_type {.base: %Base} [concrete] -// CHECK:STDOUT: %complete_type.15c: = complete_type_witness %struct_type.base.b1e [concrete] -// CHECK:STDOUT: %ptr.404: type = ptr_type %Derived [concrete] -// CHECK:STDOUT: %pattern_type.605: type = pattern_type %ptr.404 [concrete] -// CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete] -// CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Base = %Base.decl -// CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Call = %Call.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {} -// CHECK:STDOUT: %Base.F.decl: %Base.F.type = fn_decl @Base.F [concrete = constants.%Base.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc21_11: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc21: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc21_26: type = splice_block %ptr.loc21 [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Base [concrete = constants.%Base] -// CHECK:STDOUT: %ptr.loc21: type = ptr_type %Self.ref.loc21 [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc21: %ptr.11f = value_binding self, %self.param.loc21 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {} -// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] { -// CHECK:STDOUT: %p.patt: %pattern_type.605 = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: %pattern_type.605 = value_param_pattern %p.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %p.param: %ptr.404 = value_param call_param0 -// CHECK:STDOUT: %.loc29: type = splice_block %ptr [concrete = constants.%ptr.404] { -// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.404] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: %ptr.404 = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Base { -// 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: %.loc16: %Base.elem = field_decl a, element0 [concrete] -// CHECK:STDOUT: %Base.F.decl: %Base.F.type = fn_decl @Base.F [concrete = constants.%Base.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc21_11: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc18: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc18: type = splice_block %ptr.loc18 [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Base [concrete = constants.%Base] -// CHECK:STDOUT: %ptr.loc18: type = ptr_type %Self.ref.loc18 [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc18: %ptr.11f = value_binding self, %self.param.loc18 -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.a [concrete = constants.%complete_type.fd7] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc16 -// CHECK:STDOUT: .F = %Base.F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %.loc26: %Derived.elem = base_decl %Base.ref, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base.b1e [concrete = constants.%complete_type.15c] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .Base = -// CHECK:STDOUT: .base = %.loc26 -// CHECK:STDOUT: .F = -// CHECK:STDOUT: extend %Base.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Base.F(%self.param.loc21: %ptr.11f) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %ptr.11f = name_ref self, %self.loc21 -// CHECK:STDOUT: %.loc22_4: ref %Base = deref %self.ref -// CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc16 [concrete = @Base.%.loc16] -// CHECK:STDOUT: %.loc22_10: ref %i32 = class_element_access %.loc22_4, element0 -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b] -// CHECK:STDOUT: %bound_method.loc22_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc22_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc22_13.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc22_13: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: assign %.loc22_10, %.loc22_13 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%p.param: %ptr.404) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref: %ptr.404 = name_ref p, %p -// CHECK:STDOUT: %.loc30_4.1: ref %Derived = deref %p.ref -// CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, @Base.%Base.F.decl [concrete = constants.%Base.F] -// CHECK:STDOUT: %Base.F.bound: = bound_method %.loc30_4.1, %F.ref -// CHECK:STDOUT: %addr.loc30_4.1: %ptr.404 = addr_of %.loc30_4.1 -// CHECK:STDOUT: %.loc30_4.2: ref %Derived = deref %addr.loc30_4.1 -// CHECK:STDOUT: %.loc30_4.3: ref %Base = class_element_access %.loc30_4.2, element0 -// CHECK:STDOUT: %addr.loc30_4.2: %ptr.11f = addr_of %.loc30_4.3 -// CHECK:STDOUT: %.loc30_4.4: %ptr.11f = converted %addr.loc30_4.1, %addr.loc30_4.2 -// CHECK:STDOUT: %Base.F.call: init %empty_tuple.type = call %Base.F.bound(%.loc30_4.4) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_shadow_addr.carbon b/toolchain/check/testdata/class/base_method_shadow_addr.carbon deleted file mode 100644 index 9047a7b008ed..000000000000 --- a/toolchain/check/testdata/class/base_method_shadow_addr.carbon +++ /dev/null @@ -1,259 +0,0 @@ -// 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/convert.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/base_method_shadow_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method_shadow_addr.carbon - -base class A { - fn F[addr self: Self*](); -} - -base class B { - extend base: A; - fn F[addr self: Self*](); -} - -class C { - extend base: B; - fn F[addr self: Self*](); -} - -class D { - extend base: B; -} - -fn Call(a: A*, b: B*, c: C*, d: D*) { - (*a).F(); - (*b).F(); - (*c).F(); - (*d).F(); -} - -// CHECK:STDOUT: --- base_method_shadow_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = class_type @A [concrete] -// CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete] -// CHECK:STDOUT: %pattern_type.5f8: type = pattern_type %ptr.6db [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %A.F.type: type = fn_type @A.F [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %A.F: %A.F.type = struct_value () [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %B: type = class_type @B [concrete] -// CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete] -// CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete] -// CHECK:STDOUT: %pattern_type.960: type = pattern_type %ptr.e79 [concrete] -// CHECK:STDOUT: %B.F.type: type = fn_type @B.F [concrete] -// CHECK:STDOUT: %B.F: %B.F.type = struct_value () [concrete] -// CHECK:STDOUT: %struct_type.base.953: type = struct_type {.base: %A} [concrete] -// CHECK:STDOUT: %complete_type.020: = complete_type_witness %struct_type.base.953 [concrete] -// CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %B [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete] -// CHECK:STDOUT: %C.F.type: type = fn_type @C.F [concrete] -// CHECK:STDOUT: %C.F: %C.F.type = struct_value () [concrete] -// CHECK:STDOUT: %struct_type.base.0ff: type = struct_type {.base: %B} [concrete] -// CHECK:STDOUT: %complete_type.98e: = complete_type_witness %struct_type.base.0ff [concrete] -// CHECK:STDOUT: %D: type = class_type @D [concrete] -// CHECK:STDOUT: %D.elem: type = unbound_element_type %D, %B [concrete] -// CHECK:STDOUT: %ptr.19c: type = ptr_type %D [concrete] -// CHECK:STDOUT: %pattern_type.a94: type = pattern_type %ptr.19c [concrete] -// CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete] -// CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .A = %A.decl -// CHECK:STDOUT: .B = %B.decl -// CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .Call = %Call.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {} -// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] { -// CHECK:STDOUT: %a.patt: %pattern_type.5f8 = value_binding_pattern a [concrete] -// CHECK:STDOUT: %a.param_patt: %pattern_type.5f8 = value_param_pattern %a.patt, call_param0 [concrete] -// CHECK:STDOUT: %b.patt: %pattern_type.960 = value_binding_pattern b [concrete] -// CHECK:STDOUT: %b.param_patt: %pattern_type.960 = value_param_pattern %b.patt, call_param1 [concrete] -// CHECK:STDOUT: %c.patt: %pattern_type.44a = value_binding_pattern c [concrete] -// CHECK:STDOUT: %c.param_patt: %pattern_type.44a = value_param_pattern %c.patt, call_param2 [concrete] -// CHECK:STDOUT: %d.patt: %pattern_type.a94 = value_binding_pattern d [concrete] -// CHECK:STDOUT: %d.param_patt: %pattern_type.a94 = value_param_pattern %d.patt, call_param3 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %a.param: %ptr.6db = value_param call_param0 -// CHECK:STDOUT: %.loc33_13: type = splice_block %ptr.loc33_13 [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %ptr.loc33_13: type = ptr_type %A.ref [concrete = constants.%ptr.6db] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a: %ptr.6db = value_binding a, %a.param -// CHECK:STDOUT: %b.param: %ptr.e79 = value_param call_param1 -// CHECK:STDOUT: %.loc33_20: type = splice_block %ptr.loc33_20 [concrete = constants.%ptr.e79] { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %ptr.loc33_20: type = ptr_type %B.ref [concrete = constants.%ptr.e79] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b: %ptr.e79 = value_binding b, %b.param -// CHECK:STDOUT: %c.param: %ptr.019 = value_param call_param2 -// CHECK:STDOUT: %.loc33_27: type = splice_block %ptr.loc33_27 [concrete = constants.%ptr.019] { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc33_27: type = ptr_type %C.ref [concrete = constants.%ptr.019] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c: %ptr.019 = value_binding c, %c.param -// CHECK:STDOUT: %d.param: %ptr.19c = value_param call_param3 -// CHECK:STDOUT: %.loc33_34: type = splice_block %ptr.loc33_34 [concrete = constants.%ptr.19c] { -// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %ptr.loc33_34: type = ptr_type %D.ref [concrete = constants.%ptr.19c] -// CHECK:STDOUT: } -// CHECK:STDOUT: %d: %ptr.19c = value_binding d, %d.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @A { -// CHECK:STDOUT: %A.F.decl: %A.F.type = fn_decl @A.F [concrete = constants.%A.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.5f8 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.5f8 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc16_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.6db = value_param call_param0 -// CHECK:STDOUT: %.loc16_23: type = splice_block %ptr [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%A [concrete = constants.%A] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.6db] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.6db = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .F = %A.F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc20: %B.elem = base_decl %A.ref, element0 [concrete] -// CHECK:STDOUT: %B.F.decl: %B.F.type = fn_decl @B.F [concrete = constants.%B.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.960 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.960 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc21_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.e79 = value_param call_param0 -// CHECK:STDOUT: %.loc21_23: type = splice_block %ptr [concrete = constants.%ptr.e79] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [concrete = constants.%B] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.e79] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.e79 = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base.953 [concrete = constants.%complete_type.020] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .A = -// CHECK:STDOUT: .base = %.loc20 -// CHECK:STDOUT: .F = %B.F.decl -// CHECK:STDOUT: extend %A.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %.loc25: %C.elem = base_decl %B.ref, element0 [concrete] -// CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.44a = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.44a = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc26_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.019 = value_param call_param0 -// CHECK:STDOUT: %.loc26_23: type = splice_block %ptr [concrete = constants.%ptr.019] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.019] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.019 = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base.0ff [concrete = constants.%complete_type.98e] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .B = -// CHECK:STDOUT: .base = %.loc25 -// CHECK:STDOUT: .F = %C.F.decl -// CHECK:STDOUT: extend %B.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %.loc30: %D.elem = base_decl %B.ref, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base.0ff [concrete = constants.%complete_type.98e] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .B = -// CHECK:STDOUT: .base = %.loc30 -// CHECK:STDOUT: .F = -// CHECK:STDOUT: extend %B.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @A.F(%self.param: %ptr.6db); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @B.F(%self.param: %ptr.e79); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.F(%self.param: %ptr.019); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%a.param: %ptr.6db, %b.param: %ptr.e79, %c.param: %ptr.019, %d.param: %ptr.19c) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: %ptr.6db = name_ref a, %a -// CHECK:STDOUT: %.loc34: ref %A = deref %a.ref -// CHECK:STDOUT: %F.ref.loc34: %A.F.type = name_ref F, @A.%A.F.decl [concrete = constants.%A.F] -// CHECK:STDOUT: %A.F.bound: = bound_method %.loc34, %F.ref.loc34 -// CHECK:STDOUT: %addr.loc34: %ptr.6db = addr_of %.loc34 -// CHECK:STDOUT: %A.F.call: init %empty_tuple.type = call %A.F.bound(%addr.loc34) -// CHECK:STDOUT: %b.ref: %ptr.e79 = name_ref b, %b -// CHECK:STDOUT: %.loc35: ref %B = deref %b.ref -// CHECK:STDOUT: %F.ref.loc35: %B.F.type = name_ref F, @B.%B.F.decl [concrete = constants.%B.F] -// CHECK:STDOUT: %B.F.bound.loc35: = bound_method %.loc35, %F.ref.loc35 -// CHECK:STDOUT: %addr.loc35: %ptr.e79 = addr_of %.loc35 -// CHECK:STDOUT: %B.F.call.loc35: init %empty_tuple.type = call %B.F.bound.loc35(%addr.loc35) -// CHECK:STDOUT: %c.ref: %ptr.019 = name_ref c, %c -// CHECK:STDOUT: %.loc36: ref %C = deref %c.ref -// CHECK:STDOUT: %F.ref.loc36: %C.F.type = name_ref F, @C.%C.F.decl [concrete = constants.%C.F] -// CHECK:STDOUT: %C.F.bound: = bound_method %.loc36, %F.ref.loc36 -// CHECK:STDOUT: %addr.loc36: %ptr.019 = addr_of %.loc36 -// CHECK:STDOUT: %C.F.call: init %empty_tuple.type = call %C.F.bound(%addr.loc36) -// CHECK:STDOUT: %d.ref: %ptr.19c = name_ref d, %d -// CHECK:STDOUT: %.loc37_4.1: ref %D = deref %d.ref -// CHECK:STDOUT: %F.ref.loc37: %B.F.type = name_ref F, @B.%B.F.decl [concrete = constants.%B.F] -// CHECK:STDOUT: %B.F.bound.loc37: = bound_method %.loc37_4.1, %F.ref.loc37 -// CHECK:STDOUT: %addr.loc37_4.1: %ptr.19c = addr_of %.loc37_4.1 -// CHECK:STDOUT: %.loc37_4.2: ref %D = deref %addr.loc37_4.1 -// CHECK:STDOUT: %.loc37_4.3: ref %B = class_element_access %.loc37_4.2, element0 -// CHECK:STDOUT: %addr.loc37_4.2: %ptr.e79 = addr_of %.loc37_4.3 -// CHECK:STDOUT: %.loc37_4.4: %ptr.e79 = converted %addr.loc37_4.1, %addr.loc37_4.2 -// CHECK:STDOUT: %B.F.call.loc37: init %empty_tuple.type = call %B.F.bound.loc37(%.loc37_4.4) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon deleted file mode 100644 index 9fad83d037a0..000000000000 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ /dev/null @@ -1,25 +0,0 @@ -// 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/convert.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon - -class Class { - // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a `self` parameter [AddrOnNonSelfParam] - // CHECK:STDERR: fn F[addr a:! Class*](); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: - fn F[addr a:! Class*](); - - // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a `self` parameter [AddrOnNonSelfParam] - // CHECK:STDERR: fn G(addr b: Class*); - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: - fn G(addr b: Class*); -} diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon deleted file mode 100644 index d60ba01700ac..000000000000 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ /dev/null @@ -1,155 +0,0 @@ -// 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/convert.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/fail_addr_self.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_self.carbon - -class Class { - fn F[addr self: Class*](); - // CHECK:STDERR: fail_addr_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a binding with a pointer type [AddrOnNonPointerType] - // CHECK:STDERR: fn G[addr self: Class](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: - fn G[addr self: Class](); -} - -fn F(c: Class, p: Class*) { - // CHECK:STDERR: fail_addr_self.carbon:[[@LINE+7]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef] - // CHECK:STDERR: c.F(); - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_addr_self.carbon:[[@LINE-12]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[addr self: Class*](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - c.F(); - - c.G(); - - // This call is OK. - (*p).F(); - - (*p).G(); -} - -// CHECK:STDOUT: --- fail_addr_self.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Class: type = class_type @Class [concrete] -// CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete] -// CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type.761: type = pattern_type %Class [concrete] -// CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G [concrete] -// CHECK:STDOUT: %Class.G: %Class.G.type = struct_value () [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %c.patt: %pattern_type.761 = value_binding_pattern c [concrete] -// CHECK:STDOUT: %c.param_patt: %pattern_type.761 = value_param_pattern %c.patt, call_param0 [concrete] -// CHECK:STDOUT: %p.patt: %pattern_type.796 = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: %pattern_type.796 = value_param_pattern %p.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %c.param: %Class = value_param call_param0 -// CHECK:STDOUT: %Class.ref.loc24_9: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %c: %Class = value_binding c, %c.param -// CHECK:STDOUT: %p.param: %ptr.e71 = value_param call_param1 -// CHECK:STDOUT: %.loc24: type = splice_block %ptr [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Class.ref.loc24_19: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %ptr: type = ptr_type %Class.ref.loc24_19 [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: %ptr.e71 = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.796 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc16_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc16_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 = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %Class = value_param call_param0 -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %self: %Class = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = 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.%Class -// CHECK:STDOUT: .Class = -// CHECK:STDOUT: .F = %Class.F.decl -// CHECK:STDOUT: .G = %Class.G.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F(%self.param: %ptr.e71); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G(%self.param: %Class); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%c.param: %Class, %p.param: %ptr.e71) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref.loc32: %Class = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc32: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc32: = bound_method %c.ref.loc32, %F.ref.loc32 -// CHECK:STDOUT: %.loc32: ref %Class = temporary_storage -// CHECK:STDOUT: %addr.loc32: %ptr.e71 = addr_of %.loc32 -// CHECK:STDOUT: %Class.F.call.loc32: init %empty_tuple.type = call %Class.F.bound.loc32(%addr.loc32) -// CHECK:STDOUT: %c.ref.loc34: %Class = name_ref c, %c -// CHECK:STDOUT: %G.ref.loc34: %Class.G.type = name_ref G, @Class.%Class.G.decl [concrete = constants.%Class.G] -// CHECK:STDOUT: %Class.G.bound.loc34: = bound_method %c.ref.loc34, %G.ref.loc34 -// CHECK:STDOUT: %Class.G.call.loc34: init %empty_tuple.type = call %Class.G.bound.loc34(%c.ref.loc34) -// CHECK:STDOUT: %p.ref.loc37: %ptr.e71 = name_ref p, %p -// CHECK:STDOUT: %.loc37: ref %Class = deref %p.ref.loc37 -// CHECK:STDOUT: %F.ref.loc37: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc37: = bound_method %.loc37, %F.ref.loc37 -// CHECK:STDOUT: %addr.loc37: %ptr.e71 = addr_of %.loc37 -// CHECK:STDOUT: %Class.F.call.loc37: init %empty_tuple.type = call %Class.F.bound.loc37(%addr.loc37) -// CHECK:STDOUT: %p.ref.loc39: %ptr.e71 = name_ref p, %p -// CHECK:STDOUT: %.loc39_4.1: ref %Class = deref %p.ref.loc39 -// CHECK:STDOUT: %G.ref.loc39: %Class.G.type = name_ref G, @Class.%Class.G.decl [concrete = constants.%Class.G] -// CHECK:STDOUT: %Class.G.bound.loc39: = bound_method %.loc39_4.1, %G.ref.loc39 -// CHECK:STDOUT: %.loc39_4.2: %Class = acquire_value %.loc39_4.1 -// CHECK:STDOUT: %Class.G.call.loc39: init %empty_tuple.type = call %Class.G.bound.loc39(%.loc39_4.2) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 08812c2dfc0d..4145ca54d191 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -142,23 +142,23 @@ fn CallReturnIncomplete() { ReturnIncomplete(); } -class IncompleteAddrSelf { - fn F[addr self: Class*](); +class IncompleteRefSelf { + fn F[ref self: Class](); } fn CallIncompleteAddrSelf(p: Class*) { // TODO: Should this be valid? // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:3: error: invalid use of incomplete type `Class` [IncompleteTypeInConversion] - // CHECK:STDERR: p->(IncompleteAddrSelf.F)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: p->(IncompleteRefSelf.F)(); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-137]]:1: note: class was forward declared here [ClassForwardDeclaredHere] // CHECK:STDERR: class Class; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-11]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[addr self: Class*](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn F[ref self: Class](); + // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: - p->(IncompleteAddrSelf.F)(); + p->(IncompleteRefSelf.F)(); } // --- fail_in_definition.carbon diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index a29af267c411..37d1b455efe9 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -11,7 +11,7 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_memaccess_category.carbon class A { - fn F[addr self: A*](); + fn F[ref self: A](); } class B { @@ -20,23 +20,23 @@ class B { fn F(s: {.a: A}, b: B) { // `s` has only a value representation, so this must be invalid. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef] + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: s.a.F(); // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-12]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[addr self: A*](); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fn F[ref self: A](); + // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: s.a.F(); // `b` has an object representation for `A`, but this is still invalid for // consistency. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef] + // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: b.a.F(); // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-23]]:8: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn F[addr self: A*](); - // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: fn F[ref self: A](); + // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: b.a.F(); } diff --git a/toolchain/check/testdata/class/generic/basic_addr.carbon b/toolchain/check/testdata/class/generic/basic_addr.carbon deleted file mode 100644 index 90d4d75dc14c..000000000000 --- a/toolchain/check/testdata/class/generic/basic_addr.carbon +++ /dev/null @@ -1,287 +0,0 @@ -// 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/convert.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/basic_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/basic_addr.carbon - -// --- basic_addr.carbon - -library "[[@TEST_NAME]]"; - -//@dump-sem-ir-begin -class Class(T:! Core.Copy) { - fn GetAddr[addr self: Self*]() -> T* { - return &self->k; - } - - fn GetValue[self: Self]() -> T { - return self.k; - } - - var k: T; -} - -class Declaration(T:! type); -//@dump-sem-ir-end - -// CHECK:STDOUT: --- basic_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %T.417: %Copy.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.322: type = pattern_type %Copy.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.417) [symbolic] -// CHECK:STDOUT: %ptr.5a6: type = ptr_type %Class [symbolic] -// CHECK:STDOUT: %pattern_type.ed4: type = pattern_type %ptr.5a6 [symbolic] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.417 [symbolic] -// CHECK:STDOUT: %ptr.d8c: type = ptr_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.12f: type = pattern_type %ptr.d8c [symbolic] -// CHECK:STDOUT: %Class.GetAddr.type: type = fn_type @Class.GetAddr, @Class(%T.417) [symbolic] -// CHECK:STDOUT: %Class.GetAddr: %Class.GetAddr.type = struct_value () [symbolic] -// CHECK:STDOUT: %pattern_type.fe4: type = pattern_type %Class [symbolic] -// CHECK:STDOUT: %pattern_type.f14b96.1: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %Class.GetValue.type: type = fn_type @Class.GetValue, @Class(%T.417) [symbolic] -// CHECK:STDOUT: %Class.GetValue: %Class.GetValue.type = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete.d74: = require_complete_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic] -// CHECK:STDOUT: %struct_type.k: type = struct_type {.k: %T.binding.as_type} [symbolic] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.k [symbolic] -// CHECK:STDOUT: %require_complete.d1a: = require_complete_type %ptr.d8c [symbolic] -// CHECK:STDOUT: %require_complete.797: = require_complete_type %ptr.5a6 [symbolic] -// CHECK:STDOUT: %require_complete.f79: = require_complete_type %Class [symbolic] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Copy.lookup_impl_witness.c42: = lookup_impl_witness %T.417, @Copy [symbolic] -// CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Copy.Op.type, %T.417 [symbolic] -// CHECK:STDOUT: %impl.elem0.fac: %.a79 = impl_witness_access %Copy.lookup_impl_witness.c42, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.103: = specific_impl_function %impl.elem0.fac, @Copy.Op(%T.417) [symbolic] -// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] -// CHECK:STDOUT: %Copy.lookup_impl_witness.34c: = lookup_impl_witness %ptr.d8c, @Copy [symbolic] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.d8c, (%Copy.lookup_impl_witness.34c) [symbolic] -// CHECK:STDOUT: %.dba: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [symbolic] -// CHECK:STDOUT: %impl.elem0.f88: %.dba = impl_witness_access %Copy.lookup_impl_witness.34c, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.5e8: = specific_impl_function %impl.elem0.f88, @Copy.Op(%Copy.facet) [symbolic] -// CHECK:STDOUT: %Declaration.type: type = generic_class_type @Declaration [concrete] -// CHECK:STDOUT: %Declaration.generic: %Declaration.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Copy = %Core.Copy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [concrete = constants.%Class.generic] { -// CHECK:STDOUT: %T.patt: %pattern_type.322 = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc5: type = splice_block %Copy.ref [concrete = constants.%Copy.type] { -// CHECK:STDOUT: -// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc5_13.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_13.1 (constants.%T.417)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Declaration.decl: %Declaration.type = class_decl @Declaration [concrete = constants.%Declaration.generic] { -// CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: -// CHECK:STDOUT: %T.loc17_19.2: type = symbolic_binding T, 0 [symbolic = %T.loc17_19.1 (constants.%T.d9f)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic class @Class(%T.loc5_13.2: %Copy.type) { -// CHECK:STDOUT: %T.loc5_13.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_13.1 (constants.%T.417)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Class.GetAddr.type: type = fn_type @Class.GetAddr, @Class(%T.loc5_13.1) [symbolic = %Class.GetAddr.type (constants.%Class.GetAddr.type)] -// CHECK:STDOUT: %Class.GetAddr: @Class.%Class.GetAddr.type (%Class.GetAddr.type) = struct_value () [symbolic = %Class.GetAddr (constants.%Class.GetAddr)] -// CHECK:STDOUT: %Class.GetValue.type: type = fn_type @Class.GetValue, @Class(%T.loc5_13.1) [symbolic = %Class.GetValue.type (constants.%Class.GetValue.type)] -// CHECK:STDOUT: %Class.GetValue: @Class.%Class.GetValue.type (%Class.GetValue.type) = struct_value () [symbolic = %Class.GetValue (constants.%Class.GetValue)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc5_13.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %require_complete: = require_complete_type %T.binding.as_type [symbolic = %require_complete (constants.%require_complete.d74)] -// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc5_13.1) [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic = %Class.elem (constants.%Class.elem)] -// CHECK:STDOUT: %struct_type.k: type = struct_type {.k: @Class.%T.binding.as_type (%T.binding.as_type)} [symbolic = %struct_type.k (constants.%struct_type.k)] -// CHECK:STDOUT: %complete_type.loc15_1.2: = complete_type_witness %struct_type.k [symbolic = %complete_type.loc15_1.2 (constants.%complete_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: class { -// CHECK:STDOUT: %Class.GetAddr.decl: @Class.%Class.GetAddr.type (%Class.GetAddr.type) = fn_decl @Class.GetAddr [symbolic = @Class.%Class.GetAddr (constants.%Class.GetAddr)] { -// CHECK:STDOUT: %self.patt: @Class.GetAddr.%pattern_type.loc6_19 (%pattern_type.ed4) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @Class.GetAddr.%pattern_type.loc6_19 (%pattern_type.ed4) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc6_14: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: %return.patt: @Class.GetAddr.%pattern_type.loc6_34 (%pattern_type.12f) = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: @Class.GetAddr.%pattern_type.loc6_34 (%pattern_type.12f) = out_param_pattern %return.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: %Copy.type = name_ref T, @Class.%T.loc5_13.2 [symbolic = %T (constants.%T.417)] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc6_38: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %ptr.loc6_38.2: type = ptr_type %.loc6_38 [symbolic = %ptr.loc6_38.1 (constants.%ptr.d8c)] -// CHECK:STDOUT: %self.param: @Class.GetAddr.%ptr.loc6_29.1 (%ptr.5a6) = value_param call_param0 -// CHECK:STDOUT: %.loc6_29: type = splice_block %ptr.loc6_29.2 [symbolic = %ptr.loc6_29.1 (constants.%ptr.5a6)] { -// CHECK:STDOUT: %.loc6_25: type = specific_constant constants.%Class, @Class(constants.%T.417) [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc6_25 [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %ptr.loc6_29.2: type = ptr_type %Self.ref [symbolic = %ptr.loc6_29.1 (constants.%ptr.5a6)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Class.GetAddr.%ptr.loc6_29.1 (%ptr.5a6) = value_binding self, %self.param -// CHECK:STDOUT: %return.param: ref @Class.GetAddr.%ptr.loc6_38.1 (%ptr.d8c) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.GetAddr.%ptr.loc6_38.1 (%ptr.d8c) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.GetValue.decl: @Class.%Class.GetValue.type (%Class.GetValue.type) = fn_decl @Class.GetValue [symbolic = @Class.%Class.GetValue (constants.%Class.GetValue)] { -// CHECK:STDOUT: %self.patt: @Class.GetValue.%pattern_type.loc10_15 (%pattern_type.fe4) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @Class.GetValue.%pattern_type.loc10_15 (%pattern_type.fe4) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %return.patt: @Class.GetValue.%pattern_type.loc10_29 (%pattern_type.f14b96.1) = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: @Class.GetValue.%pattern_type.loc10_29 (%pattern_type.f14b96.1) = out_param_pattern %return.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: %Copy.type = name_ref T, @Class.%T.loc5_13.2 [symbolic = %T (constants.%T.417)] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc10_32: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %self.param: @Class.GetValue.%Class (%Class) = value_param call_param0 -// CHECK:STDOUT: %.loc10_21.1: type = splice_block %Self.ref [symbolic = %Class (constants.%Class)] { -// CHECK:STDOUT: %.loc10_21.2: type = specific_constant constants.%Class, @Class(constants.%T.417) [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc10_21.2 [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Class.GetValue.%Class (%Class) = value_binding self, %self.param -// CHECK:STDOUT: %return.param: ref @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.ref: %Copy.type = name_ref T, %T.loc5_13.2 [symbolic = %T.loc5_13.1 (constants.%T.417)] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc14_10: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc14_8: @Class.%Class.elem (%Class.elem) = field_decl k, element0 [concrete] -// CHECK:STDOUT: %complete_type.loc15_1.1: = complete_type_witness constants.%struct_type.k [symbolic = %complete_type.loc15_1.2 (constants.%complete_type)] -// CHECK:STDOUT: complete_type_witness = %complete_type.loc15_1.1 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .GetAddr = %Class.GetAddr.decl -// CHECK:STDOUT: .GetValue = %Class.GetValue.decl -// CHECK:STDOUT: .k = %.loc14_8 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic class @Declaration(%T.loc17_19.2: type) { -// CHECK:STDOUT: %T.loc17_19.1: type = symbolic_binding T, 0 [symbolic = %T.loc17_19.1 (constants.%T.d9f)] -// CHECK:STDOUT: -// CHECK:STDOUT: class; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.GetAddr(@Class.%T.loc5_13.2: %Copy.type) { -// CHECK:STDOUT: %T: %Copy.type = symbolic_binding T, 0 [symbolic = %T (constants.%T.417)] -// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %ptr.loc6_29.1: type = ptr_type %Class [symbolic = %ptr.loc6_29.1 (constants.%ptr.5a6)] -// CHECK:STDOUT: %pattern_type.loc6_19: type = pattern_type %ptr.loc6_29.1 [symbolic = %pattern_type.loc6_19 (constants.%pattern_type.ed4)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %ptr.loc6_38.1: type = ptr_type %T.binding.as_type [symbolic = %ptr.loc6_38.1 (constants.%ptr.d8c)] -// CHECK:STDOUT: %pattern_type.loc6_34: type = pattern_type %ptr.loc6_38.1 [symbolic = %pattern_type.loc6_34 (constants.%pattern_type.12f)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc6_34: = require_complete_type %ptr.loc6_38.1 [symbolic = %require_complete.loc6_34 (constants.%require_complete.d1a)] -// CHECK:STDOUT: %require_complete.loc6_23: = require_complete_type %ptr.loc6_29.1 [symbolic = %require_complete.loc6_23 (constants.%require_complete.797)] -// CHECK:STDOUT: %require_complete.loc7: = require_complete_type %Class [symbolic = %require_complete.loc7 (constants.%require_complete.f79)] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic = %Class.elem (constants.%Class.elem)] -// CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %ptr.loc6_38.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.34c)] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc6_38.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet)] -// CHECK:STDOUT: %.loc7_12.2: type = fn_type_with_self_type constants.%Copy.Op.type, %Copy.facet [symbolic = %.loc7_12.2 (constants.%.dba)] -// CHECK:STDOUT: %impl.elem0.loc7_12.2: @Class.GetAddr.%.loc7_12.2 (%.dba) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_12.2 (constants.%impl.elem0.f88)] -// CHECK:STDOUT: %specific_impl_fn.loc7_12.2: = specific_impl_function %impl.elem0.loc7_12.2, @Copy.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc7_12.2 (constants.%specific_impl_fn.5e8)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Class.GetAddr.%ptr.loc6_29.1 (%ptr.5a6)) -> @Class.GetAddr.%ptr.loc6_38.1 (%ptr.d8c) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @Class.GetAddr.%ptr.loc6_29.1 (%ptr.5a6) = name_ref self, %self -// CHECK:STDOUT: %.loc7_17.1: ref @Class.GetAddr.%Class (%Class) = deref %self.ref -// CHECK:STDOUT: %k.ref: @Class.GetAddr.%Class.elem (%Class.elem) = name_ref k, @Class.%.loc14_8 [concrete = @Class.%.loc14_8] -// CHECK:STDOUT: %.loc7_17.2: ref @Class.GetAddr.%T.binding.as_type (%T.binding.as_type) = class_element_access %.loc7_17.1, element0 -// CHECK:STDOUT: %addr: @Class.GetAddr.%ptr.loc6_38.1 (%ptr.d8c) = addr_of %.loc7_17.2 -// CHECK:STDOUT: %impl.elem0.loc7_12.1: @Class.GetAddr.%.loc7_12.2 (%.dba) = impl_witness_access constants.%Copy.lookup_impl_witness.34c, element0 [symbolic = %impl.elem0.loc7_12.2 (constants.%impl.elem0.f88)] -// CHECK:STDOUT: %bound_method.loc7_12.1: = bound_method %addr, %impl.elem0.loc7_12.1 -// CHECK:STDOUT: %specific_impl_fn.loc7_12.1: = specific_impl_function %impl.elem0.loc7_12.1, @Copy.Op(constants.%Copy.facet) [symbolic = %specific_impl_fn.loc7_12.2 (constants.%specific_impl_fn.5e8)] -// CHECK:STDOUT: %bound_method.loc7_12.2: = bound_method %addr, %specific_impl_fn.loc7_12.1 -// CHECK:STDOUT: %.loc7_12.1: init @Class.GetAddr.%ptr.loc6_38.1 (%ptr.d8c) = call %bound_method.loc7_12.2(%addr) -// CHECK:STDOUT: return %.loc7_12.1 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.GetValue(@Class.%T.loc5_13.2: %Copy.type) { -// CHECK:STDOUT: %T: %Copy.type = symbolic_binding T, 0 [symbolic = %T (constants.%T.417)] -// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class)] -// CHECK:STDOUT: %pattern_type.loc10_15: type = pattern_type %Class [symbolic = %pattern_type.loc10_15 (constants.%pattern_type.fe4)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %pattern_type.loc10_29: type = pattern_type %T.binding.as_type [symbolic = %pattern_type.loc10_29 (constants.%pattern_type.f14b96.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc10: = require_complete_type %Class [symbolic = %require_complete.loc10 (constants.%require_complete.f79)] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic = %Class.elem (constants.%Class.elem)] -// CHECK:STDOUT: %require_complete.loc11: = require_complete_type %T.binding.as_type [symbolic = %require_complete.loc11 (constants.%require_complete.d74)] -// CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %T, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.c42)] -// CHECK:STDOUT: %.loc11_16.4: type = fn_type_with_self_type constants.%Copy.Op.type, %T [symbolic = %.loc11_16.4 (constants.%.a79)] -// CHECK:STDOUT: %impl.elem0.loc11_16.2: @Class.GetValue.%.loc11_16.4 (%.a79) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_16.2 (constants.%impl.elem0.fac)] -// CHECK:STDOUT: %specific_impl_fn.loc11_16.2: = specific_impl_function %impl.elem0.loc11_16.2, @Copy.Op(%T) [symbolic = %specific_impl_fn.loc11_16.2 (constants.%specific_impl_fn.103)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Class.GetValue.%Class (%Class)) -> %return.param: @Class.GetValue.%T.binding.as_type (%T.binding.as_type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @Class.GetValue.%Class (%Class) = name_ref self, %self -// CHECK:STDOUT: %k.ref: @Class.GetValue.%Class.elem (%Class.elem) = name_ref k, @Class.%.loc14_8 [concrete = @Class.%.loc14_8] -// CHECK:STDOUT: %.loc11_16.1: ref @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc11_16.2: @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = acquire_value %.loc11_16.1 -// CHECK:STDOUT: %impl.elem0.loc11_16.1: @Class.GetValue.%.loc11_16.4 (%.a79) = impl_witness_access constants.%Copy.lookup_impl_witness.c42, element0 [symbolic = %impl.elem0.loc11_16.2 (constants.%impl.elem0.fac)] -// CHECK:STDOUT: %bound_method.loc11_16.1: = bound_method %.loc11_16.2, %impl.elem0.loc11_16.1 -// CHECK:STDOUT: %specific_impl_fn.loc11_16.1: = specific_impl_function %impl.elem0.loc11_16.1, @Copy.Op(constants.%T.417) [symbolic = %specific_impl_fn.loc11_16.2 (constants.%specific_impl_fn.103)] -// CHECK:STDOUT: %bound_method.loc11_16.2: = bound_method %.loc11_16.2, %specific_impl_fn.loc11_16.1 -// CHECK:STDOUT: %.loc10_29: ref @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = splice_block %return {} -// CHECK:STDOUT: %.loc11_16.3: init @Class.GetValue.%T.binding.as_type (%T.binding.as_type) = call %bound_method.loc11_16.2(%.loc11_16.2) to %.loc10_29 -// CHECK:STDOUT: return %.loc11_16.3 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Class(constants.%T.417) { -// CHECK:STDOUT: %T.loc5_13.1 => constants.%T.417 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Class.GetAddr.type => constants.%Class.GetAddr.type -// CHECK:STDOUT: %Class.GetAddr => constants.%Class.GetAddr -// CHECK:STDOUT: %Class.GetValue.type => constants.%Class.GetValue.type -// CHECK:STDOUT: %Class.GetValue => constants.%Class.GetValue -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %require_complete => constants.%require_complete.d74 -// CHECK:STDOUT: %Class => constants.%Class -// CHECK:STDOUT: %Class.elem => constants.%Class.elem -// CHECK:STDOUT: %struct_type.k => constants.%struct_type.k -// CHECK:STDOUT: %complete_type.loc15_1.2 => constants.%complete_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.GetAddr(constants.%T.417) { -// CHECK:STDOUT: %T => constants.%T.417 -// CHECK:STDOUT: %Class => constants.%Class -// CHECK:STDOUT: %ptr.loc6_29.1 => constants.%ptr.5a6 -// CHECK:STDOUT: %pattern_type.loc6_19 => constants.%pattern_type.ed4 -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %ptr.loc6_38.1 => constants.%ptr.d8c -// CHECK:STDOUT: %pattern_type.loc6_34 => constants.%pattern_type.12f -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.GetValue(constants.%T.417) { -// CHECK:STDOUT: %T => constants.%T.417 -// CHECK:STDOUT: %Class => constants.%Class -// CHECK:STDOUT: %pattern_type.loc10_15 => constants.%pattern_type.fe4 -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type.loc10_29 => constants.%pattern_type.f14b96.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Declaration(constants.%T.d9f) { -// CHECK:STDOUT: %T.loc17_19.1 => constants.%T.d9f -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/member_access.carbon b/toolchain/check/testdata/class/generic/member_access.carbon index 7e47ef190136..155dd15dc846 100644 --- a/toolchain/check/testdata/class/generic/member_access.carbon +++ b/toolchain/check/testdata/class/generic/member_access.carbon @@ -23,9 +23,9 @@ class Class(T:! Core.Copy) { //@dump-sem-ir-end } - fn GetAddr[addr self: Self*]() -> T* { + fn GetAddr[ref self: Self]() -> T* { //@dump-sem-ir-begin - return &self->x; + return &self.x; //@dump-sem-ir-end } } @@ -75,15 +75,12 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: %pattern_type.f14b96.1: type = pattern_type %T.binding.as_type [symbolic] // CHECK:STDOUT: %Class.Get.type.620: type = fn_type @Class.Get, @Class(%T.417) [symbolic] // CHECK:STDOUT: %Class.Get.cd8: %Class.Get.type.620 = struct_value () [symbolic] -// CHECK:STDOUT: %ptr.5a6: type = ptr_type %Class.32e [symbolic] -// CHECK:STDOUT: %pattern_type.ed4: type = pattern_type %ptr.5a6 [symbolic] // CHECK:STDOUT: %ptr.d8c: type = ptr_type %T.binding.as_type [symbolic] // CHECK:STDOUT: %pattern_type.12f: type = pattern_type %ptr.d8c [symbolic] // CHECK:STDOUT: %Class.GetAddr.type.6b3: type = fn_type @Class.GetAddr, @Class(%T.417) [symbolic] // CHECK:STDOUT: %Class.GetAddr.ed1: %Class.GetAddr.type.6b3 = struct_value () [symbolic] // CHECK:STDOUT: %struct_type.x.d0a: type = struct_type {.x: %T.binding.as_type} [symbolic] // CHECK:STDOUT: %complete_type.40f: = complete_type_witness %struct_type.x.d0a [symbolic] -// CHECK:STDOUT: %require_complete.f79: = require_complete_type %Class.32e [symbolic] // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] // CHECK:STDOUT: %Copy.lookup_impl_witness.c42: = lookup_impl_witness %T.417, @Copy [symbolic] // CHECK:STDOUT: %.a79: type = fn_type_with_self_type %Copy.Op.type, %T.417 [symbolic] @@ -122,12 +119,10 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete] // CHECK:STDOUT: %Class.Get.specific_fn: = specific_function %Class.Get.a74, @Class.Get(%Copy.facet.c50) [concrete] // CHECK:STDOUT: %ptr.621: type = ptr_type %Class.c06 [concrete] -// CHECK:STDOUT: %pattern_type.185: type = pattern_type %ptr.621 [concrete] // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete] // CHECK:STDOUT: %pattern_type.fe8: type = pattern_type %ptr.235 [concrete] // CHECK:STDOUT: %Class.GetAddr.specific_fn: = specific_function %Class.GetAddr.070, @Class.GetAddr(%Copy.facet.c50) [concrete] // CHECK:STDOUT: %complete_type.3d0: = complete_type_witness %ptr.235 [concrete] -// CHECK:STDOUT: %complete_type.ae6: = complete_type_witness %ptr.621 [concrete] // CHECK:STDOUT: %Copy.impl_witness.be3: = impl_witness imports.%Copy.impl_witness_table.67d, @ptr.as.Copy.impl(%i32) [concrete] // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.d7c: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%i32) [concrete] // CHECK:STDOUT: %ptr.as.Copy.impl.Op.687: %ptr.as.Copy.impl.Op.type.d7c = struct_value () [concrete] @@ -195,26 +190,24 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %require_complete.loc15: = require_complete_type %Class [symbolic = %require_complete.loc15 (constants.%require_complete.f79)] // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic = %Class.elem (constants.%Class.elem.bc9)] -// CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %ptr.loc13_38.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.34c)] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc13_38.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet.89c)] +// CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %ptr.loc13_36.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.34c)] +// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc13_36.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet.89c)] // CHECK:STDOUT: %.loc15_12.2: type = fn_type_with_self_type constants.%Copy.Op.type, %Copy.facet [symbolic = %.loc15_12.2 (constants.%.dba)] // CHECK:STDOUT: %impl.elem0.loc15_12.2: @Class.GetAddr.%.loc15_12.2 (%.dba) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_12.2 (constants.%impl.elem0.f88)] // CHECK:STDOUT: %specific_impl_fn.loc15_12.2: = specific_impl_function %impl.elem0.loc15_12.2, @Copy.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc15_12.2 (constants.%specific_impl_fn.5e8)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Class.GetAddr.%ptr.loc13_29.1 (%ptr.5a6)) -> @Class.GetAddr.%ptr.loc13_38.1 (%ptr.d8c) { +// CHECK:STDOUT: fn(%self.param: @Class.GetAddr.%Class (%Class.32e)) -> @Class.GetAddr.%ptr.loc13_36.1 (%ptr.d8c) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @Class.GetAddr.%ptr.loc13_29.1 (%ptr.5a6) = name_ref self, %self -// CHECK:STDOUT: %.loc15_17.1: ref @Class.GetAddr.%Class (%Class.32e) = deref %self.ref +// CHECK:STDOUT: %self.ref: ref @Class.GetAddr.%Class (%Class.32e) = name_ref self, %self // CHECK:STDOUT: %x.ref: @Class.GetAddr.%Class.elem (%Class.elem.bc9) = name_ref x, @Class.%.loc5_8 [concrete = @Class.%.loc5_8] -// CHECK:STDOUT: %.loc15_17.2: ref @Class.GetAddr.%T.binding.as_type (%T.binding.as_type) = class_element_access %.loc15_17.1, element0 -// CHECK:STDOUT: %addr: @Class.GetAddr.%ptr.loc13_38.1 (%ptr.d8c) = addr_of %.loc15_17.2 +// CHECK:STDOUT: %.loc15_17: ref @Class.GetAddr.%T.binding.as_type (%T.binding.as_type) = class_element_access %self.ref, element0 +// CHECK:STDOUT: %addr: @Class.GetAddr.%ptr.loc13_36.1 (%ptr.d8c) = addr_of %.loc15_17 // CHECK:STDOUT: %impl.elem0.loc15_12.1: @Class.GetAddr.%.loc15_12.2 (%.dba) = impl_witness_access constants.%Copy.lookup_impl_witness.34c, element0 [symbolic = %impl.elem0.loc15_12.2 (constants.%impl.elem0.f88)] // CHECK:STDOUT: %bound_method.loc15_12.1: = bound_method %addr, %impl.elem0.loc15_12.1 // CHECK:STDOUT: %specific_impl_fn.loc15_12.1: = specific_impl_function %impl.elem0.loc15_12.1, @Copy.Op(constants.%Copy.facet.89c) [symbolic = %specific_impl_fn.loc15_12.2 (constants.%specific_impl_fn.5e8)] // CHECK:STDOUT: %bound_method.loc15_12.2: = bound_method %addr, %specific_impl_fn.loc15_12.1 -// CHECK:STDOUT: %.loc15_12.1: init @Class.GetAddr.%ptr.loc13_38.1 (%ptr.d8c) = call %bound_method.loc15_12.2(%addr) +// CHECK:STDOUT: %.loc15_12.1: init @Class.GetAddr.%ptr.loc13_36.1 (%ptr.d8c) = call %bound_method.loc15_12.2(%addr) // CHECK:STDOUT: return %.loc15_12.1 to %return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -254,8 +247,7 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: %Class.GetAddr.bound: = bound_method %.loc34_12.1, %GetAddr.ref // CHECK:STDOUT: %Class.GetAddr.specific_fn: = specific_function %GetAddr.ref, @Class.GetAddr(constants.%Copy.facet.c50) [concrete = constants.%Class.GetAddr.specific_fn] // CHECK:STDOUT: %bound_method.loc34_22: = bound_method %.loc34_12.1, %Class.GetAddr.specific_fn -// CHECK:STDOUT: %addr: %ptr.621 = addr_of %.loc34_12.1 -// CHECK:STDOUT: %Class.GetAddr.call: init %ptr.235 = call %bound_method.loc34_22(%addr) +// CHECK:STDOUT: %Class.GetAddr.call: init %ptr.235 = call %bound_method.loc34_22(%.loc34_12.1) // CHECK:STDOUT: %.loc34_22.1: %ptr.235 = value_of_initializer %Class.GetAddr.call // CHECK:STDOUT: %.loc34_22.2: %ptr.235 = converted %Class.GetAddr.call, %.loc34_22.1 // CHECK:STDOUT: %.loc34_10.1: ref %i32 = deref %.loc34_22.2 @@ -295,11 +287,10 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: specific @Class.GetAddr(constants.%T.417) { // CHECK:STDOUT: %T => constants.%T.417 // CHECK:STDOUT: %Class => constants.%Class.32e -// CHECK:STDOUT: %ptr.loc13_29.1 => constants.%ptr.5a6 -// CHECK:STDOUT: %pattern_type.loc13_19 => constants.%pattern_type.ed4 +// CHECK:STDOUT: %pattern_type.loc13_18 => constants.%pattern_type.fe4 // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %ptr.loc13_38.1 => constants.%ptr.d8c -// CHECK:STDOUT: %pattern_type.loc13_34 => constants.%pattern_type.12f +// CHECK:STDOUT: %ptr.loc13_36.1 => constants.%ptr.d8c +// CHECK:STDOUT: %pattern_type.loc13_32 => constants.%pattern_type.12f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Class(constants.%Copy.facet.c50) { @@ -338,16 +329,14 @@ fn StaticMemberFunctionCall(T:! type) -> Class(T) { // CHECK:STDOUT: specific @Class.GetAddr(constants.%Copy.facet.c50) { // CHECK:STDOUT: %T => constants.%Copy.facet.c50 // CHECK:STDOUT: %Class => constants.%Class.c06 -// CHECK:STDOUT: %ptr.loc13_29.1 => constants.%ptr.621 -// CHECK:STDOUT: %pattern_type.loc13_19 => constants.%pattern_type.185 +// CHECK:STDOUT: %pattern_type.loc13_18 => constants.%pattern_type.ece // CHECK:STDOUT: %T.binding.as_type => constants.%i32 -// CHECK:STDOUT: %ptr.loc13_38.1 => constants.%ptr.235 -// CHECK:STDOUT: %pattern_type.loc13_34 => constants.%pattern_type.fe8 +// CHECK:STDOUT: %ptr.loc13_36.1 => constants.%ptr.235 +// CHECK:STDOUT: %pattern_type.loc13_32 => constants.%pattern_type.fe8 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc13_34 => constants.%complete_type.3d0 -// CHECK:STDOUT: %require_complete.loc13_23 => constants.%complete_type.ae6 -// CHECK:STDOUT: %require_complete.loc15 => constants.%complete_type.1ec +// CHECK:STDOUT: %require_complete.loc13_32 => constants.%complete_type.3d0 +// CHECK:STDOUT: %require_complete.loc13_22 => constants.%complete_type.1ec // CHECK:STDOUT: %Class.elem => constants.%Class.elem.ef0 // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.be3 // CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.687 diff --git a/toolchain/check/testdata/class/import_addr.carbon b/toolchain/check/testdata/class/import_addr.carbon deleted file mode 100644 index fe48e6626790..000000000000 --- a/toolchain/check/testdata/class/import_addr.carbon +++ /dev/null @@ -1,456 +0,0 @@ -// 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/int.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/import_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_addr.carbon - -// --- a.carbon - -library "[[@TEST_NAME]]"; - -class Empty { -} - -class Field { - var x: i32; -} - -class ForwardDeclared; - -class ForwardDeclared { - fn F[self: Self](); - fn G[addr self: Self*](); -} - -class Incomplete; - -// --- b.carbon - -library "[[@TEST_NAME]]"; - -import library "a"; - -fn Run() { - var a: Empty = {}; - - var b: Field = {.x = 1}; - b.x = 2; - - var c: ForwardDeclared = {}; - c.F(); - c.G(); - - var d: ForwardDeclared* = &c; - - var e: Incomplete*; -} - -// CHECK:STDOUT: --- a.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Empty: type = class_type @Empty [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Field: type = class_type @Field [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: %Field.elem: type = unbound_element_type %Field, %i32 [concrete] -// CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %i32} [concrete] -// CHECK:STDOUT: %complete_type.1ec: = complete_type_witness %struct_type.x [concrete] -// CHECK:STDOUT: %ForwardDeclared: type = class_type @ForwardDeclared [concrete] -// CHECK:STDOUT: %pattern_type.1b8: type = pattern_type %ForwardDeclared [concrete] -// CHECK:STDOUT: %ForwardDeclared.F.type: type = fn_type @ForwardDeclared.F [concrete] -// CHECK:STDOUT: %ForwardDeclared.F: %ForwardDeclared.F.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr: type = ptr_type %ForwardDeclared [concrete] -// CHECK:STDOUT: %pattern_type.ebb: type = pattern_type %ptr [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %ForwardDeclared.G.type: type = fn_type @ForwardDeclared.G [concrete] -// CHECK:STDOUT: %ForwardDeclared.G: %ForwardDeclared.G.type = struct_value () [concrete] -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Empty = %Empty.decl -// CHECK:STDOUT: .Field = %Field.decl -// CHECK:STDOUT: .ForwardDeclared = %ForwardDeclared.decl.loc11 -// CHECK:STDOUT: .Incomplete = %Incomplete.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Empty.decl: type = class_decl @Empty [concrete = constants.%Empty] {} {} -// CHECK:STDOUT: %Field.decl: type = class_decl @Field [concrete = constants.%Field] {} {} -// CHECK:STDOUT: %ForwardDeclared.decl.loc11: type = class_decl @ForwardDeclared [concrete = constants.%ForwardDeclared] {} {} -// CHECK:STDOUT: %ForwardDeclared.decl.loc13: type = class_decl @ForwardDeclared [concrete = constants.%ForwardDeclared] {} {} -// CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [concrete = constants.%Incomplete] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Empty { -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Empty -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Field { -// 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: %.loc8: %Field.elem = field_decl x, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.x [concrete = constants.%complete_type.1ec] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Field -// CHECK:STDOUT: .x = %.loc8 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @ForwardDeclared { -// CHECK:STDOUT: %ForwardDeclared.F.decl: %ForwardDeclared.F.type = fn_decl @ForwardDeclared.F [concrete = constants.%ForwardDeclared.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b8 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b8 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ForwardDeclared = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%ForwardDeclared [concrete = constants.%ForwardDeclared] -// CHECK:STDOUT: %self: %ForwardDeclared = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %ForwardDeclared.G.decl: %ForwardDeclared.G.type = fn_decl @ForwardDeclared.G [concrete = constants.%ForwardDeclared.G] { -// CHECK:STDOUT: %self.patt: %pattern_type.ebb = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.ebb = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc15_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr = value_param call_param0 -// CHECK:STDOUT: %.loc15_23: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%ForwardDeclared [concrete = constants.%ForwardDeclared] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%ForwardDeclared -// CHECK:STDOUT: .F = %ForwardDeclared.F.decl -// CHECK:STDOUT: .G = %ForwardDeclared.G.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Incomplete; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @ForwardDeclared.F(%self.param: %ForwardDeclared); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @ForwardDeclared.G(%self.param: %ptr); -// CHECK:STDOUT: -// CHECK:STDOUT: --- b.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Run.type: type = fn_type @Run [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %Run: %Run.type = struct_value () [concrete] -// CHECK:STDOUT: %Empty: type = class_type @Empty [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %pattern_type.2f0: type = pattern_type %Empty [concrete] -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] -// CHECK:STDOUT: %Empty.val: %Empty = struct_value () [concrete] -// CHECK:STDOUT: %Field: type = class_type @Field [concrete] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %struct_type.x.767: type = struct_type {.x: %i32} [concrete] -// CHECK:STDOUT: %complete_type.c07: = complete_type_witness %struct_type.x.767 [concrete] -// CHECK:STDOUT: %pattern_type.f46: type = pattern_type %Field [concrete] -// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] -// CHECK:STDOUT: %struct_type.x.c96: type = struct_type {.x: Core.IntLiteral} [concrete] -// CHECK:STDOUT: %struct: %struct_type.x.c96 = struct_value (%int_1.5b8) [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.bd9: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] -// CHECK:STDOUT: %ImplicitAs.Convert.type.6da: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete] -// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.8cf: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.09b: = impl_witness imports.%ImplicitAs.impl_witness_table.04e, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.069: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.069 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.bd9 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.09b) [concrete] -// CHECK:STDOUT: %.1a5: type = fn_type_with_self_type %ImplicitAs.Convert.type.6da, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b66: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete] -// CHECK:STDOUT: %bound_method.c7c: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete] -// CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete] -// CHECK:STDOUT: %Field.val: %Field = struct_value (%int_1.47b) [concrete] -// CHECK:STDOUT: %Field.elem: type = unbound_element_type %Field, %i32 [concrete] -// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e7: = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.13e [concrete] -// CHECK:STDOUT: %bound_method.a94: = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete] -// CHECK:STDOUT: %int_2.d0d: %i32 = int_value 2 [concrete] -// CHECK:STDOUT: %ForwardDeclared.7b34f2.1: type = class_type @ForwardDeclared.1 [concrete] -// CHECK:STDOUT: %pattern_type.1b8: type = pattern_type %ForwardDeclared.7b34f2.1 [concrete] -// CHECK:STDOUT: %ForwardDeclared.val: %ForwardDeclared.7b34f2.1 = struct_value () [concrete] -// CHECK:STDOUT: %ForwardDeclared.F.type: type = fn_type @ForwardDeclared.F [concrete] -// CHECK:STDOUT: %ForwardDeclared.F: %ForwardDeclared.F.type = struct_value () [concrete] -// CHECK:STDOUT: %ForwardDeclared.G.type: type = fn_type @ForwardDeclared.G [concrete] -// CHECK:STDOUT: %ForwardDeclared.G: %ForwardDeclared.G.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr.6cf: type = ptr_type %ForwardDeclared.7b34f2.1 [concrete] -// CHECK:STDOUT: %pattern_type.ebb: type = pattern_type %ptr.6cf [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.75b: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.d9f) [symbolic] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.692: %ptr.as.Copy.impl.Op.type.75b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.bf8: = impl_witness imports.%Copy.impl_witness_table.67d, @ptr.as.Copy.impl(%ForwardDeclared.7b34f2.1) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.b63: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%ForwardDeclared.7b34f2.1) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.8de: %ptr.as.Copy.impl.Op.type.b63 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.6cf, (%Copy.impl_witness.bf8) [concrete] -// CHECK:STDOUT: %.05a: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: = specific_function %ptr.as.Copy.impl.Op.8de, @ptr.as.Copy.impl.Op(%ForwardDeclared.7b34f2.1) [concrete] -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [concrete] -// CHECK:STDOUT: %ptr.c62: type = ptr_type %Incomplete [concrete] -// CHECK:STDOUT: %pattern_type.275: type = pattern_type %ptr.c62 [concrete] -// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] -// CHECK:STDOUT: %type_where: type = facet_type > [concrete] -// CHECK:STDOUT: %facet_value.a09: %type_where = facet_value %ptr.c62, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.257: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.a09) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.6fd: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.257 = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.cdc: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.6fd, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.a09) [concrete] -// CHECK:STDOUT: %facet_value.481: %type_where = facet_value %ptr.6cf, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6eb: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.481) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.610: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.6eb = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.250: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.610, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.481) [concrete] -// CHECK:STDOUT: %facet_value.c58: %type_where = facet_value %ForwardDeclared.7b34f2.1, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d7f: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.c58) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e9e: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d7f = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.cf0: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.e9e, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.c58) [concrete] -// CHECK:STDOUT: %facet_value.f6b: %type_where = facet_value %Field, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b06: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.f6b) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.088: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b06 = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.0a0: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.088, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.f6b) [concrete] -// CHECK:STDOUT: %facet_value.8d3: %type_where = facet_value %Empty, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.3f6: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.8d3) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.a12: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.3f6 = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.af0: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.a12, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.8d3) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Main.Empty: type = import_ref Main//a, Empty, loaded [concrete = constants.%Empty] -// CHECK:STDOUT: %Main.Field: type = import_ref Main//a, Field, loaded [concrete = constants.%Field] -// CHECK:STDOUT: %Main.ForwardDeclared: type = import_ref Main//a, ForwardDeclared, loaded [concrete = constants.%ForwardDeclared.7b34f2.1] -// CHECK:STDOUT: %Main.Incomplete: type = import_ref Main//a, Incomplete, loaded [concrete = constants.%Incomplete] -// CHECK:STDOUT: %Core.ece: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: .Copy = %Core.Copy -// CHECK:STDOUT: .Destroy = %Core.Destroy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Main.import_ref.8f24d3.1: = import_ref Main//a, loc5_1, loaded [concrete = constants.%complete_type.357] -// CHECK:STDOUT: %Main.import_ref.fd7 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.709: = import_ref Main//a, loc9_1, loaded [concrete = constants.%complete_type.c07] -// CHECK:STDOUT: %Main.import_ref.845 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.4d2: %Field.elem = import_ref Main//a, loc8_8, loaded [concrete = %.d33] -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.7d5: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.365) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.8cf)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.04e = impl_witness_table (%Core.import_ref.7d5), @Core.IntLiteral.as.ImplicitAs.impl [concrete] -// CHECK:STDOUT: %.d33: %Field.elem = field_decl x, element0 [concrete] -// CHECK:STDOUT: %Main.import_ref.8f24d3.2: = import_ref Main//a, loc16_1, loaded [concrete = constants.%complete_type.357] -// CHECK:STDOUT: %Main.import_ref.39e731.1 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.760: %ForwardDeclared.F.type = import_ref Main//a, loc14_21, loaded [concrete = constants.%ForwardDeclared.F] -// CHECK:STDOUT: %Main.import_ref.26e: %ForwardDeclared.G.type = import_ref Main//a, loc15_27, loaded [concrete = constants.%ForwardDeclared.G] -// CHECK:STDOUT: %Main.import_ref.8f24d3.3: = import_ref Main//a, loc16_1, loaded [concrete = constants.%complete_type.357] -// CHECK:STDOUT: %Main.import_ref.39e731.2 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.42a = import_ref Main//a, loc14_21, unloaded -// CHECK:STDOUT: %Main.import_ref.67a = import_ref Main//a, loc15_27, unloaded -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: %Core.import_ref.659: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.75b) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.692)] -// CHECK:STDOUT: %Copy.impl_witness_table.67d = impl_witness_table (%Core.import_ref.659), @ptr.as.Copy.impl [concrete] -// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Empty = imports.%Main.Empty -// CHECK:STDOUT: .Field = imports.%Main.Field -// CHECK:STDOUT: .ForwardDeclared = imports.%Main.ForwardDeclared -// CHECK:STDOUT: .Incomplete = imports.%Main.Incomplete -// CHECK:STDOUT: .Core = imports.%Core.ece -// CHECK:STDOUT: .Run = %Run.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Empty [from "a.carbon"] { -// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Main.import_ref.fd7 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Field [from "a.carbon"] { -// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.709 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Main.import_ref.845 -// CHECK:STDOUT: .x = imports.%Main.import_ref.4d2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @ForwardDeclared.1 [from "a.carbon"] { -// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Main.import_ref.39e731.1 -// CHECK:STDOUT: .F = imports.%Main.import_ref.760 -// CHECK:STDOUT: .G = imports.%Main.import_ref.26e -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @ForwardDeclared.2 [from "a.carbon"] { -// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.3 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Main.import_ref.39e731.2 -// CHECK:STDOUT: .F = imports.%Main.import_ref.42a -// CHECK:STDOUT: .G = imports.%Main.import_ref.67a -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Incomplete [from "a.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Run() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt: %pattern_type.2f0 = ref_binding_pattern a [concrete] -// CHECK:STDOUT: %a.var_patt: %pattern_type.2f0 = var_pattern %a.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %a.var: ref %Empty = var %a.var_patt -// CHECK:STDOUT: %.loc7_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_19.2: init %Empty = class_init (), %a.var [concrete = constants.%Empty.val] -// CHECK:STDOUT: %.loc7_3: init %Empty = converted %.loc7_19.1, %.loc7_19.2 [concrete = constants.%Empty.val] -// CHECK:STDOUT: assign %a.var, %.loc7_3 -// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, imports.%Main.Empty [concrete = constants.%Empty] -// CHECK:STDOUT: %a: ref %Empty = ref_binding a, %a.var -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %b.patt: %pattern_type.f46 = ref_binding_pattern b [concrete] -// CHECK:STDOUT: %b.var_patt: %pattern_type.f46 = var_pattern %b.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %b.var: ref %Field = var %b.var_patt -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc9_25.1: %struct_type.x.c96 = struct_literal (%int_1) [concrete = constants.%struct] -// CHECK:STDOUT: %impl.elem0.loc9: %.1a5 = impl_witness_access constants.%ImplicitAs.impl_witness.09b, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.13e] -// CHECK:STDOUT: %bound_method.loc9_25.1: = bound_method %int_1, %impl.elem0.loc9 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b66] -// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_25.2: = bound_method %int_1, %specific_fn.loc9 [concrete = constants.%bound_method.c7c] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %i32 = call %bound_method.loc9_25.2(%int_1) [concrete = constants.%int_1.47b] -// CHECK:STDOUT: %.loc9_25.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%int_1.47b] -// CHECK:STDOUT: %.loc9_25.3: ref %i32 = class_element_access %b.var, element0 -// CHECK:STDOUT: %.loc9_25.4: init %i32 = initialize_from %.loc9_25.2 to %.loc9_25.3 [concrete = constants.%int_1.47b] -// CHECK:STDOUT: %.loc9_25.5: init %Field = class_init (%.loc9_25.4), %b.var [concrete = constants.%Field.val] -// CHECK:STDOUT: %.loc9_3: init %Field = converted %.loc9_25.1, %.loc9_25.5 [concrete = constants.%Field.val] -// CHECK:STDOUT: assign %b.var, %.loc9_3 -// CHECK:STDOUT: %Field.ref: type = name_ref Field, imports.%Main.Field [concrete = constants.%Field] -// CHECK:STDOUT: %b: ref %Field = ref_binding b, %b.var -// CHECK:STDOUT: %b.ref: ref %Field = name_ref b, %b -// CHECK:STDOUT: %x.ref: %Field.elem = name_ref x, imports.%Main.import_ref.4d2 [concrete = imports.%.d33] -// CHECK:STDOUT: %.loc10_4: ref %i32 = class_element_access %b.ref, element0 -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc10: %.1a5 = impl_witness_access constants.%ImplicitAs.impl_witness.09b, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.13e] -// CHECK:STDOUT: %bound_method.loc10_7.1: = bound_method %int_2, %impl.elem0.loc10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e7] -// CHECK:STDOUT: %specific_fn.loc10: = specific_function %impl.elem0.loc10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_7.2: = bound_method %int_2, %specific_fn.loc10 [concrete = constants.%bound_method.a94] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10: init %i32 = call %bound_method.loc10_7.2(%int_2) [concrete = constants.%int_2.d0d] -// CHECK:STDOUT: %.loc10_7: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10 [concrete = constants.%int_2.d0d] -// CHECK:STDOUT: assign %.loc10_4, %.loc10_7 -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %c.patt: %pattern_type.1b8 = ref_binding_pattern c [concrete] -// CHECK:STDOUT: %c.var_patt: %pattern_type.1b8 = var_pattern %c.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c.var: ref %ForwardDeclared.7b34f2.1 = var %c.var_patt -// CHECK:STDOUT: %.loc12_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_29.2: init %ForwardDeclared.7b34f2.1 = class_init (), %c.var [concrete = constants.%ForwardDeclared.val] -// CHECK:STDOUT: %.loc12_3: init %ForwardDeclared.7b34f2.1 = converted %.loc12_29.1, %.loc12_29.2 [concrete = constants.%ForwardDeclared.val] -// CHECK:STDOUT: assign %c.var, %.loc12_3 -// CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, imports.%Main.ForwardDeclared [concrete = constants.%ForwardDeclared.7b34f2.1] -// CHECK:STDOUT: %c: ref %ForwardDeclared.7b34f2.1 = ref_binding c, %c.var -// CHECK:STDOUT: %c.ref.loc13: ref %ForwardDeclared.7b34f2.1 = name_ref c, %c -// CHECK:STDOUT: %F.ref: %ForwardDeclared.F.type = name_ref F, imports.%Main.import_ref.760 [concrete = constants.%ForwardDeclared.F] -// CHECK:STDOUT: %ForwardDeclared.F.bound: = bound_method %c.ref.loc13, %F.ref -// CHECK:STDOUT: %.loc13: %ForwardDeclared.7b34f2.1 = acquire_value %c.ref.loc13 -// CHECK:STDOUT: %ForwardDeclared.F.call: init %empty_tuple.type = call %ForwardDeclared.F.bound(%.loc13) -// CHECK:STDOUT: %c.ref.loc14: ref %ForwardDeclared.7b34f2.1 = name_ref c, %c -// CHECK:STDOUT: %G.ref: %ForwardDeclared.G.type = name_ref G, imports.%Main.import_ref.26e [concrete = constants.%ForwardDeclared.G] -// CHECK:STDOUT: %ForwardDeclared.G.bound: = bound_method %c.ref.loc14, %G.ref -// CHECK:STDOUT: %addr.loc14: %ptr.6cf = addr_of %c.ref.loc14 -// CHECK:STDOUT: %ForwardDeclared.G.call: init %empty_tuple.type = call %ForwardDeclared.G.bound(%addr.loc14) -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %d.patt: %pattern_type.ebb = ref_binding_pattern d [concrete] -// CHECK:STDOUT: %d.var_patt: %pattern_type.ebb = var_pattern %d.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %d.var: ref %ptr.6cf = var %d.var_patt -// CHECK:STDOUT: %c.ref.loc16: ref %ForwardDeclared.7b34f2.1 = name_ref c, %c -// CHECK:STDOUT: %addr.loc16: %ptr.6cf = addr_of %c.ref.loc16 -// CHECK:STDOUT: %impl.elem0.loc16: %.05a = impl_witness_access constants.%Copy.impl_witness.bf8, element0 [concrete = constants.%ptr.as.Copy.impl.Op.8de] -// CHECK:STDOUT: %bound_method.loc16_29.1: = bound_method %addr.loc16, %impl.elem0.loc16 -// CHECK:STDOUT: %specific_fn.loc16: = specific_function %impl.elem0.loc16, @ptr.as.Copy.impl.Op(constants.%ForwardDeclared.7b34f2.1) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc16_29.2: = bound_method %addr.loc16, %specific_fn.loc16 -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.6cf = call %bound_method.loc16_29.2(%addr.loc16) -// CHECK:STDOUT: assign %d.var, %ptr.as.Copy.impl.Op.call -// CHECK:STDOUT: %.loc16: type = splice_block %ptr.loc16 [concrete = constants.%ptr.6cf] { -// CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, imports.%Main.ForwardDeclared [concrete = constants.%ForwardDeclared.7b34f2.1] -// CHECK:STDOUT: %ptr.loc16: type = ptr_type %ForwardDeclared.ref.loc16 [concrete = constants.%ptr.6cf] -// CHECK:STDOUT: } -// CHECK:STDOUT: %d: ref %ptr.6cf = ref_binding d, %d.var -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %e.patt: %pattern_type.275 = ref_binding_pattern e [concrete] -// CHECK:STDOUT: %e.var_patt: %pattern_type.275 = var_pattern %e.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %e.var: ref %ptr.c62 = var %e.var_patt -// CHECK:STDOUT: %.loc18: type = splice_block %ptr.loc18 [concrete = constants.%ptr.c62] { -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, imports.%Main.Incomplete [concrete = constants.%Incomplete] -// CHECK:STDOUT: %ptr.loc18: type = ptr_type %Incomplete.ref [concrete = constants.%ptr.c62] -// CHECK:STDOUT: } -// CHECK:STDOUT: %e: ref %ptr.c62 = ref_binding e, %e.var -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc18: = bound_method %e.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.6fd -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.6fd, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.a09) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.cdc] -// CHECK:STDOUT: %bound_method.loc18: = bound_method %e.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc18: init %empty_tuple.type = call %bound_method.loc18(%e.var) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc16: = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.610 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.610, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.481) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.250] -// CHECK:STDOUT: %bound_method.loc16_3: = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc16: init %empty_tuple.type = call %bound_method.loc16_3(%d.var) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: = bound_method %c.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e9e -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e9e, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.c58) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.cf0] -// CHECK:STDOUT: %bound_method.loc12: = bound_method %c.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%c.var) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.088 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.4: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.088, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.f6b) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.0a0] -// CHECK:STDOUT: %bound_method.loc9_3: = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.4 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9_3(%b.var) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc7: = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.a12 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.5: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.a12, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.8d3) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.af0] -// CHECK:STDOUT: %bound_method.loc7: = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.5 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc7: init %empty_tuple.type = call %bound_method.loc7(%a.var) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @ForwardDeclared.F [from "a.carbon"]; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @ForwardDeclared.G [from "a.carbon"]; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/method_addr.carbon b/toolchain/check/testdata/class/method_addr.carbon deleted file mode 100644 index 40ff7e87d2b2..000000000000 --- a/toolchain/check/testdata/class/method_addr.carbon +++ /dev/null @@ -1,489 +0,0 @@ -// 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/int.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/method_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/method_addr.carbon - -class Class { - fn F[self: Self]() -> i32; - fn G[addr self: Self*]() -> i32; - - alias A = F; - - var k: i32; -} - -fn Class.F[self: Self]() -> i32 { - return self.k; -} - -fn Call(c: Class) -> i32 { - // TODO: The sem-ir for this call doesn't distinguish the `self` argument from - // the explicit arguments. - return c.F(); -} - -fn CallAlias(c: Class) -> i32 { - return c.A(); -} - -fn CallOnConstBoundMethod() -> i32 { - return ({.k = 1} as Class).F(); -} - -fn CallWithAddr() -> i32 { - var c: Class; - return c.G(); -} - -fn CallFThroughPointer(p: Class*) -> i32 { - return (*p).F(); -} - -fn CallGThroughPointer(p: Class*) -> i32 { - return (*p).G(); -} - -fn Make() -> Class; - -fn CallFOnInitializingExpr() -> i32 { - return Make().F(); -} - -fn CallGOnInitializingExpr() -> i32 { - return Make().G(); -} - -// CHECK:STDOUT: --- method_addr.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: %int_32: Core.IntLiteral = int_value 32 [concrete] -// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] -// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] -// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F [concrete] -// CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete] -// CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G [concrete] -// CHECK:STDOUT: %Class.G: %Class.G.type = struct_value () [concrete] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete] -// CHECK:STDOUT: %struct_type.k.0bf: type = struct_type {.k: %i32} [concrete] -// CHECK:STDOUT: %complete_type.954: = complete_type_witness %struct_type.k.0bf [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.fb7: = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete] -// CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete] -// CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete] -// CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete] -// CHECK:STDOUT: %CallAlias.type: type = fn_type @CallAlias [concrete] -// CHECK:STDOUT: %CallAlias: %CallAlias.type = struct_value () [concrete] -// CHECK:STDOUT: %CallOnConstBoundMethod.type: type = fn_type @CallOnConstBoundMethod [concrete] -// CHECK:STDOUT: %CallOnConstBoundMethod: %CallOnConstBoundMethod.type = struct_value () [concrete] -// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete] -// CHECK:STDOUT: %struct_type.k.240: type = struct_type {.k: Core.IntLiteral} [concrete] -// CHECK:STDOUT: %struct: %struct_type.k.240 = struct_value (%int_1.5b8) [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.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] -// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete] -// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete] -// CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete] -// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete] -// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] -// CHECK:STDOUT: %Class.val: %Class = struct_value (%int_1.5d2) [concrete] -// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] -// CHECK:STDOUT: %type_where: type = facet_type > [concrete] -// CHECK:STDOUT: %facet_value: %type_where = facet_value %Class, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.e99: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.378: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.e99 = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.378, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [concrete] -// CHECK:STDOUT: %CallWithAddr.type: type = fn_type @CallWithAddr [concrete] -// CHECK:STDOUT: %CallWithAddr: %CallWithAddr.type = struct_value () [concrete] -// CHECK:STDOUT: %CallFThroughPointer.type: type = fn_type @CallFThroughPointer [concrete] -// CHECK:STDOUT: %CallFThroughPointer: %CallFThroughPointer.type = struct_value () [concrete] -// CHECK:STDOUT: %CallGThroughPointer.type: type = fn_type @CallGThroughPointer [concrete] -// CHECK:STDOUT: %CallGThroughPointer: %CallGThroughPointer.type = struct_value () [concrete] -// CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete] -// CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete] -// CHECK:STDOUT: %CallFOnInitializingExpr.type: type = fn_type @CallFOnInitializingExpr [concrete] -// CHECK:STDOUT: %CallFOnInitializingExpr: %CallFOnInitializingExpr.type = struct_value () [concrete] -// CHECK:STDOUT: %CallGOnInitializingExpr.type: type = fn_type @CallGOnInitializingExpr [concrete] -// CHECK:STDOUT: %CallGOnInitializingExpr: %CallGOnInitializingExpr.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Int = %Core.Int -// CHECK:STDOUT: .Copy = %Core.Copy -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: .Destroy = %Core.Destroy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)] -// CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete] -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete] -// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Call = %Call.decl -// CHECK:STDOUT: .CallAlias = %CallAlias.decl -// CHECK:STDOUT: .CallOnConstBoundMethod = %CallOnConstBoundMethod.decl -// CHECK:STDOUT: .CallWithAddr = %CallWithAddr.decl -// CHECK:STDOUT: .CallFThroughPointer = %CallFThroughPointer.decl -// CHECK:STDOUT: .CallGThroughPointer = %CallGThroughPointer.decl -// CHECK:STDOUT: .Make = %Make.decl -// CHECK:STDOUT: .CallFOnInitializingExpr = %CallFOnInitializingExpr.decl -// CHECK:STDOUT: .CallGOnInitializingExpr = %CallGOnInitializingExpr.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.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.loc24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc24: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc24: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc24: %Class = value_binding self, %self.param.loc24 -// CHECK:STDOUT: %return.param.loc24: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc24: ref %i32 = return_slot %return.param.loc24 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] { -// CHECK:STDOUT: %c.patt: %pattern_type.761 = value_binding_pattern c [concrete] -// CHECK:STDOUT: %c.param_patt: %pattern_type.761 = value_param_pattern %c.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: %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 = value_binding c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %CallAlias.decl: %CallAlias.type = fn_decl @CallAlias [concrete = constants.%CallAlias] { -// CHECK:STDOUT: %c.patt: %pattern_type.761 = value_binding_pattern c [concrete] -// CHECK:STDOUT: %c.param_patt: %pattern_type.761 = value_param_pattern %c.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: %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 = value_binding c, %c.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %CallOnConstBoundMethod.decl: %CallOnConstBoundMethod.type = fn_decl @CallOnConstBoundMethod [concrete = constants.%CallOnConstBoundMethod] { -// 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: %CallWithAddr.decl: %CallWithAddr.type = fn_decl @CallWithAddr [concrete = constants.%CallWithAddr] { -// 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: %CallFThroughPointer.decl: %CallFThroughPointer.type = fn_decl @CallFThroughPointer [concrete = constants.%CallFThroughPointer] { -// CHECK:STDOUT: %p.patt: %pattern_type.796 = value_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: %.loc47: 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 = value_binding 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: %CallGThroughPointer.decl: %CallGThroughPointer.type = fn_decl @CallGThroughPointer [concrete = constants.%CallGThroughPointer] { -// CHECK:STDOUT: %p.patt: %pattern_type.796 = value_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: %.loc51: 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 = value_binding 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: %Make.decl: %Make.type = fn_decl @Make [concrete = constants.%Make] { -// 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: %CallFOnInitializingExpr.decl: %CallFOnInitializingExpr.type = fn_decl @CallFOnInitializingExpr [concrete = constants.%CallFOnInitializingExpr] { -// 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: %CallGOnInitializingExpr.decl: %CallGOnInitializingExpr.type = fn_decl @CallGOnInitializingExpr [concrete = constants.%CallGOnInitializingExpr] { -// 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: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.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.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc16: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc16: %Class = value_binding self, %self.param.loc16 -// CHECK:STDOUT: %return.param.loc16: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc16: ref %i32 = return_slot %return.param.loc16 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.796 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc17_8: %pattern_type.f6d = addr_pattern %self.param_patt [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: %self.param: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc17_23: type = splice_block %ptr [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.e71 = value_binding self, %self.param -// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %F.ref: %Class.F.type = name_ref F, %Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %A: %Class.F.type = alias_binding A, %Class.F.decl [concrete = constants.%Class.F] -// 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: %.loc21: %Class.elem = field_decl k, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.k.0bf [concrete = constants.%complete_type.954] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %Class.F.decl -// CHECK:STDOUT: .G = %Class.G.decl -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .k = %.loc21 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F(%self.param.loc24: %Class) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self.loc24 -// CHECK:STDOUT: %k.ref: %Class.elem = name_ref k, @Class.%.loc21 [concrete = @Class.%.loc21] -// CHECK:STDOUT: %.loc25_14.1: ref %i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc25_14.2: %i32 = acquire_value %.loc25_14.1 -// CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc25_14.1: = bound_method %.loc25_14.2, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_14.2: = bound_method %.loc25_14.2, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc25_14.2(%.loc25_14.2) -// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.loc24 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G(%self.param: %ptr.e71) -> %i32; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%c.param: %Class) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound: = bound_method %c.ref, %F.ref -// CHECK:STDOUT: %Class.F.call: init %i32 = call %Class.F.bound(%c.ref) -// CHECK:STDOUT: return %Class.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallAlias(%c.param: %Class) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c -// CHECK:STDOUT: %A.ref: %Class.F.type = name_ref A, @Class.%A [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound: = bound_method %c.ref, %A.ref -// CHECK:STDOUT: %Class.F.call: init %i32 = call %Class.F.bound(%c.ref) -// CHECK:STDOUT: return %Class.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallOnConstBoundMethod() -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc39_18.1: %struct_type.k.240 = struct_literal (%int_1) [concrete = constants.%struct] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b] -// CHECK:STDOUT: %bound_method.loc39_18.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_18.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc39_18.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc39_18.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc39_18.3: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc39_18.4: ref %i32 = class_element_access %.loc39_18.3, element0 -// CHECK:STDOUT: %.loc39_18.5: init %i32 = initialize_from %.loc39_18.2 to %.loc39_18.4 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc39_18.6: init %Class = class_init (%.loc39_18.5), %.loc39_18.3 [concrete = constants.%Class.val] -// CHECK:STDOUT: %.loc39_18.7: ref %Class = temporary %.loc39_18.3, %.loc39_18.6 -// CHECK:STDOUT: %.loc39_20.1: ref %Class = converted %.loc39_18.1, %.loc39_18.7 -// CHECK:STDOUT: %F.ref: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound: = bound_method %.loc39_20.1, %F.ref -// CHECK:STDOUT: %.loc39_20.2: %Class = acquire_value %.loc39_20.1 -// CHECK:STDOUT: %Class.F.call: init %i32 = call %Class.F.bound(%.loc39_20.2) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: = bound_method %.loc39_18.7, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_18.3: = bound_method %.loc39_18.7, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc39_18.3(%.loc39_18.7) -// CHECK:STDOUT: return %Class.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallWithAddr() -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %c.patt: %pattern_type.761 = ref_binding_pattern c [concrete] -// CHECK:STDOUT: %c.var_patt: %pattern_type.761 = var_pattern %c.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c.var: ref %Class = var %c.var_patt -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %c: ref %Class = ref_binding c, %c.var -// CHECK:STDOUT: %c.ref: ref %Class = name_ref c, %c -// CHECK:STDOUT: %G.ref: %Class.G.type = name_ref G, @Class.%Class.G.decl [concrete = constants.%Class.G] -// CHECK:STDOUT: %Class.G.bound: = bound_method %c.ref, %G.ref -// CHECK:STDOUT: %addr: %ptr.e71 = addr_of %c.ref -// CHECK:STDOUT: %Class.G.call: init %i32 = call %Class.G.bound(%addr) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: = bound_method %c.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method: = bound_method %c.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%c.var) -// CHECK:STDOUT: return %Class.G.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallFThroughPointer(%p.param: %ptr.e71) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref: %ptr.e71 = name_ref p, %p -// CHECK:STDOUT: %.loc48_11.1: ref %Class = deref %p.ref -// CHECK:STDOUT: %F.ref: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound: = bound_method %.loc48_11.1, %F.ref -// CHECK:STDOUT: %.loc48_11.2: %Class = acquire_value %.loc48_11.1 -// CHECK:STDOUT: %Class.F.call: init %i32 = call %Class.F.bound(%.loc48_11.2) -// CHECK:STDOUT: return %Class.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallGThroughPointer(%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: %G.ref: %Class.G.type = name_ref G, @Class.%Class.G.decl [concrete = constants.%Class.G] -// CHECK:STDOUT: %Class.G.bound: = bound_method %.loc52, %G.ref -// CHECK:STDOUT: %addr: %ptr.e71 = addr_of %.loc52 -// CHECK:STDOUT: %Class.G.call: init %i32 = call %Class.G.bound(%addr) -// CHECK:STDOUT: return %Class.G.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Make() -> %return.param: %Class; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallFOnInitializingExpr() -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %.loc58_15.1: ref %Class = temporary_storage -// CHECK:STDOUT: %Make.call: init %Class = call %Make.ref() to %.loc58_15.1 -// CHECK:STDOUT: %.loc58_15.2: ref %Class = temporary %.loc58_15.1, %Make.call -// CHECK:STDOUT: %F.ref: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound: = bound_method %.loc58_15.2, %F.ref -// CHECK:STDOUT: %.loc58_15.3: %Class = acquire_value %.loc58_15.2 -// CHECK:STDOUT: %Class.F.call: init %i32 = call %Class.F.bound(%.loc58_15.3) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: = bound_method %.loc58_15.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method: = bound_method %.loc58_15.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc58_15.2) -// CHECK:STDOUT: return %Class.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallGOnInitializingExpr() -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %.loc62_15.1: ref %Class = temporary_storage -// CHECK:STDOUT: %Make.call: init %Class = call %Make.ref() to %.loc62_15.1 -// CHECK:STDOUT: %.loc62_15.2: ref %Class = temporary %.loc62_15.1, %Make.call -// CHECK:STDOUT: %G.ref: %Class.G.type = name_ref G, @Class.%Class.G.decl [concrete = constants.%Class.G] -// CHECK:STDOUT: %Class.G.bound: = bound_method %.loc62_15.2, %G.ref -// CHECK:STDOUT: %addr: %ptr.e71 = addr_of %.loc62_15.2 -// CHECK:STDOUT: %Class.G.call: init %i32 = call %Class.G.bound(%addr) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: = bound_method %.loc62_15.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.378, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method: = bound_method %.loc62_15.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc62_15.2) -// CHECK:STDOUT: return %Class.G.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/raw_self_addr.carbon b/toolchain/check/testdata/class/raw_self_addr.carbon deleted file mode 100644 index 65bfb0a066ab..000000000000 --- a/toolchain/check/testdata/class/raw_self_addr.carbon +++ /dev/null @@ -1,236 +0,0 @@ -// 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/int.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/raw_self_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/raw_self_addr.carbon - -class Class { - fn F[addr self: Self*](r#self: i32); - fn G[self: Self](r#self: i32) -> (i32, i32); - var n: i32; -} - -fn Class.F[addr self: Self*](r#self: i32) { - (*self).n = r#self; -} - -fn Class.G[self: Self](r#self: i32) -> (i32, i32) { - return (self.n, r#self); -} - -// CHECK:STDOUT: --- raw_self_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Class: type = class_type @Class [concrete] -// CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete] -// CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [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: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] -// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F [concrete] -// CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type.761: type = pattern_type %Class [concrete] -// CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete] -// CHECK:STDOUT: %tuple.95a: %tuple.type.24b = tuple_value (%i32, %i32) [concrete] -// CHECK:STDOUT: %tuple.type.d07: type = tuple_type (%i32, %i32) [concrete] -// CHECK:STDOUT: %pattern_type.511: type = pattern_type %tuple.type.d07 [concrete] -// CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G [concrete] -// CHECK:STDOUT: %Class.G: %Class.G.type = struct_value () [concrete] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete] -// CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %i32} [concrete] -// CHECK:STDOUT: %complete_type.54b: = complete_type_witness %struct_type.n [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.fb7: = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete] -// CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Int = %Core.Int -// CHECK:STDOUT: .Copy = %Core.Copy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)] -// CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt.loc21_17: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt.loc21_21: %pattern_type.796 = value_param_pattern %self.patt.loc21_17, call_param0 [concrete] -// CHECK:STDOUT: %.loc21_12: %pattern_type.f6d = addr_pattern %self.param_patt.loc21_21 [concrete] -// CHECK:STDOUT: %self.patt.loc21_30: %pattern_type.7ce = value_binding_pattern r#self [concrete] -// CHECK:STDOUT: %self.param_patt.loc21_36: %pattern_type.7ce = value_param_pattern %self.patt.loc21_30, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc21_21: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc21_27: type = splice_block %ptr.loc21 [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %ptr.loc21: type = ptr_type %Self.ref.loc21 [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc21_17: %ptr.e71 = value_binding self, %self.param.loc21_21 -// CHECK:STDOUT: %self.param.loc21_36: %i32 = value_param call_param1 -// CHECK:STDOUT: %.loc21_38: type = splice_block %i32.loc21 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc21_30: %i32 = value_binding r#self, %self.param.loc21_36 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt.loc25_12: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt.loc25_16: %pattern_type.761 = value_param_pattern %self.patt.loc25_12, call_param0 [concrete] -// CHECK:STDOUT: %self.patt.loc25_24: %pattern_type.7ce = value_binding_pattern r#self [concrete] -// CHECK:STDOUT: %self.param_patt.loc25_30: %pattern_type.7ce = value_param_pattern %self.patt.loc25_24, call_param1 [concrete] -// CHECK:STDOUT: %return.patt: %pattern_type.511 = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: %pattern_type.511 = out_param_pattern %return.patt, call_param2 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc25_41: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc25_41: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc25_46: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc25_46: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc25_49.1: %tuple.type.24b = tuple_literal (%i32.loc25_41, %i32.loc25_46) [concrete = constants.%tuple.95a] -// CHECK:STDOUT: %.loc25_49.2: type = converted %.loc25_49.1, constants.%tuple.type.d07 [concrete = constants.%tuple.type.d07] -// CHECK:STDOUT: %self.param.loc25_16: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc25: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc25_12: %Class = value_binding self, %self.param.loc25_16 -// CHECK:STDOUT: %self.param.loc25_30: %i32 = value_param call_param1 -// CHECK:STDOUT: %.loc25_32: type = splice_block %i32.loc25_32 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc25_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc25_32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc25_24: %i32 = value_binding r#self, %self.param.loc25_30 -// CHECK:STDOUT: %return.param.loc25: ref %tuple.type.d07 = out_param call_param2 -// CHECK:STDOUT: %return.loc25: ref %tuple.type.d07 = return_slot %return.param.loc25 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt.loc21_17: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt.loc21_21: %pattern_type.796 = value_param_pattern %self.patt.loc21_17, call_param0 [concrete] -// CHECK:STDOUT: %.loc21_12: %pattern_type.f6d = addr_pattern %self.param_patt.loc21_21 [concrete] -// CHECK:STDOUT: %self.patt.loc21_30: %pattern_type.7ce = value_binding_pattern r#self [concrete] -// CHECK:STDOUT: %self.param_patt.loc21_36: %pattern_type.7ce = value_param_pattern %self.patt.loc21_30, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc16_17: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc16_23: type = splice_block %ptr.loc16 [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %ptr.loc16: type = ptr_type %Self.ref.loc16 [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc16_13: %ptr.e71 = value_binding self, %self.param.loc16_17 -// CHECK:STDOUT: %self.param.loc16_32: %i32 = value_param call_param1 -// CHECK:STDOUT: %.loc16_34: type = splice_block %i32.loc16 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc16_26: %i32 = value_binding r#self, %self.param.loc16_32 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt.loc25_12: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt.loc25_16: %pattern_type.761 = value_param_pattern %self.patt.loc25_12, call_param0 [concrete] -// CHECK:STDOUT: %self.patt.loc25_24: %pattern_type.7ce = value_binding_pattern r#self [concrete] -// CHECK:STDOUT: %self.param_patt.loc25_30: %pattern_type.7ce = value_param_pattern %self.patt.loc25_24, call_param1 [concrete] -// CHECK:STDOUT: %return.patt: %pattern_type.511 = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: %pattern_type.511 = out_param_pattern %return.patt, call_param2 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc17_37: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc17_37: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc17_42: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc17_42: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc17_45.1: %tuple.type.24b = tuple_literal (%i32.loc17_37, %i32.loc17_42) [concrete = constants.%tuple.95a] -// CHECK:STDOUT: %.loc17_45.2: type = converted %.loc17_45.1, constants.%tuple.type.d07 [concrete = constants.%tuple.type.d07] -// CHECK:STDOUT: %self.param.loc17_12: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc17_8: %Class = value_binding self, %self.param.loc17_12 -// CHECK:STDOUT: %self.param.loc17_26: %i32 = value_param call_param1 -// CHECK:STDOUT: %.loc17_28: type = splice_block %i32.loc17_28 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc17_28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc17_28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc17_20: %i32 = value_binding r#self, %self.param.loc17_26 -// CHECK:STDOUT: %return.param.loc17: ref %tuple.type.d07 = out_param call_param2 -// CHECK:STDOUT: %return.loc17: ref %tuple.type.d07 = return_slot %return.param.loc17 -// 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: %.loc18: %Class.elem = field_decl n, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.n [concrete = constants.%complete_type.54b] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %Class.F.decl -// CHECK:STDOUT: .G = %Class.G.decl -// CHECK:STDOUT: .n = %.loc18 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F(%self.param.loc21_21: %ptr.e71, %self.param.loc21_36: %i32) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref.loc22_5: %ptr.e71 = name_ref self, %self.loc21_17 -// CHECK:STDOUT: %.loc22_4: ref %Class = deref %self.ref.loc22_5 -// CHECK:STDOUT: %n.ref: %Class.elem = name_ref n, @Class.%.loc18 [concrete = @Class.%.loc18] -// CHECK:STDOUT: %.loc22_10: ref %i32 = class_element_access %.loc22_4, element0 -// CHECK:STDOUT: %self.ref.loc22_15: %i32 = name_ref r#self, %self.loc21_30 -// CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc22_15.1: = bound_method %self.ref.loc22_15, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc22_15.2: = bound_method %self.ref.loc22_15, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc22_15.2(%self.ref.loc22_15) -// CHECK:STDOUT: assign %.loc22_10, %Int.as.Copy.impl.Op.call -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G(%self.param.loc25_16: %Class, %self.param.loc25_30: %i32) -> %return.param.loc25: %tuple.type.d07 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref.loc26_11: %Class = name_ref self, %self.loc25_12 -// CHECK:STDOUT: %n.ref: %Class.elem = name_ref n, @Class.%.loc18 [concrete = @Class.%.loc18] -// CHECK:STDOUT: %.loc26_15.1: ref %i32 = class_element_access %self.ref.loc26_11, element0 -// CHECK:STDOUT: %.loc26_15.2: %i32 = acquire_value %.loc26_15.1 -// CHECK:STDOUT: %self.ref.loc26_19: %i32 = name_ref r#self, %self.loc25_24 -// CHECK:STDOUT: %.loc26_25.1: %tuple.type.d07 = tuple_literal (%.loc26_15.2, %self.ref.loc26_19) -// CHECK:STDOUT: %impl.elem0.loc26_15: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc26_15.1: = bound_method %.loc26_15.2, %impl.elem0.loc26_15 -// CHECK:STDOUT: %specific_fn.loc26_15: = specific_function %impl.elem0.loc26_15, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc26_15.2: = bound_method %.loc26_15.2, %specific_fn.loc26_15 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc26_15: init %i32 = call %bound_method.loc26_15.2(%.loc26_15.2) -// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %return.loc25, element0 -// CHECK:STDOUT: %.loc26_25.2: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc26_15 to %tuple.elem0 -// CHECK:STDOUT: %impl.elem0.loc26_19: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc26_19.1: = bound_method %self.ref.loc26_19, %impl.elem0.loc26_19 -// CHECK:STDOUT: %specific_fn.loc26_19: = specific_function %impl.elem0.loc26_19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc26_19.2: = bound_method %self.ref.loc26_19, %specific_fn.loc26_19 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc26_19: init %i32 = call %bound_method.loc26_19.2(%self.ref.loc26_19) -// CHECK:STDOUT: %tuple.elem1: ref %i32 = tuple_access %return.loc25, element1 -// CHECK:STDOUT: %.loc26_25.3: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc26_19 to %tuple.elem1 -// CHECK:STDOUT: %.loc26_25.4: init %tuple.type.d07 = tuple_init (%.loc26_25.2, %.loc26_25.3) to %return.loc25 -// CHECK:STDOUT: %.loc26_26: init %tuple.type.d07 = converted %.loc26_25.1, %.loc26_25.4 -// CHECK:STDOUT: return %.loc26_26 to %return.loc25 -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_addr.carbon b/toolchain/check/testdata/class/self_addr.carbon deleted file mode 100644 index 2865f9477f66..000000000000 --- a/toolchain/check/testdata/class/self_addr.carbon +++ /dev/null @@ -1,266 +0,0 @@ -// 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/int.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/self_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self_addr.carbon - -// --- self.carbon - -library "[[@TEST_NAME]]"; - -class Class { - fn F[self: Self]() -> i32; - fn G[addr self: Self*]() -> i32; - - var n: i32; -} - -fn Class.F[self: Self]() -> i32 { - return self.n; -} - -fn Class.G[addr self: Self*]() -> i32 { - return (*self).n; -} - -// --- fail_return_self_value.carbon - -library "[[@TEST_NAME]]"; - -class Class { - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+7]]:25: error: cannot implicitly convert non-type value of type `Class` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fn F[self: Self]() -> self; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+4]]:25: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: fn F[self: Self]() -> self; - // CHECK:STDERR: ^~~~ - // CHECK:STDERR: - fn F[self: Self]() -> self; -} - -// CHECK:STDOUT: --- self.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: %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: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] -// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F [concrete] -// CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr.e71: type = ptr_type %Class [concrete] -// CHECK:STDOUT: %pattern_type.796: type = pattern_type %ptr.e71 [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Class.G.type: type = fn_type @Class.G [concrete] -// CHECK:STDOUT: %Class.G: %Class.G.type = struct_value () [concrete] -// CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete] -// CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %i32} [concrete] -// CHECK:STDOUT: %complete_type.54b: = complete_type_witness %struct_type.n [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.fb7: = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete] -// CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Int = %Core.Int -// CHECK:STDOUT: .Copy = %Core.Copy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)] -// CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.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.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc11: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc11: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc11: %Class = value_binding self, %self.param.loc11 -// CHECK:STDOUT: %return.param.loc11: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc11: ref %i32 = return_slot %return.param.loc11 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.796 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc15_12: %pattern_type.f6d = addr_pattern %self.param_patt [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.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc15: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc15_27: type = splice_block %ptr.loc15 [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %ptr.loc15: type = ptr_type %Self.ref.loc15 [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc15: %ptr.e71 = value_binding self, %self.param.loc15 -// CHECK:STDOUT: %return.param.loc15: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc15: ref %i32 = return_slot %return.param.loc15 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.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.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc5: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref.loc5: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self.loc5: %Class = value_binding self, %self.param.loc5 -// CHECK:STDOUT: %return.param.loc5: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc5: ref %i32 = return_slot %return.param.loc5 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type = fn_decl @Class.G [concrete = constants.%Class.G] { -// CHECK:STDOUT: %self.patt: %pattern_type.796 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.796 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc15_12: %pattern_type.f6d = addr_pattern %self.param_patt [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.loc6: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc6: %ptr.e71 = value_param call_param0 -// CHECK:STDOUT: %.loc6: type = splice_block %ptr.loc6 [concrete = constants.%ptr.e71] { -// CHECK:STDOUT: %Self.ref.loc6: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %ptr.loc6: type = ptr_type %Self.ref.loc6 [concrete = constants.%ptr.e71] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc6: %ptr.e71 = value_binding self, %self.param.loc6 -// CHECK:STDOUT: %return.param.loc6: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc6: ref %i32 = return_slot %return.param.loc6 -// 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: %.loc8: %Class.elem = field_decl n, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.n [concrete = constants.%complete_type.54b] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %Class.F.decl -// CHECK:STDOUT: .G = %Class.G.decl -// CHECK:STDOUT: .n = %.loc8 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F(%self.param.loc11: %Class) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self.loc11 -// CHECK:STDOUT: %n.ref: %Class.elem = name_ref n, @Class.%.loc8 [concrete = @Class.%.loc8] -// CHECK:STDOUT: %.loc12_14.1: ref %i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc12_14.2: %i32 = acquire_value %.loc12_14.1 -// CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc12_14.1: = bound_method %.loc12_14.2, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_14.2: = bound_method %.loc12_14.2, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc12_14.2(%.loc12_14.2) -// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.loc11 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G(%self.param.loc15: %ptr.e71) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %ptr.e71 = name_ref self, %self.loc15 -// CHECK:STDOUT: %.loc16_11: ref %Class = deref %self.ref -// CHECK:STDOUT: %n.ref: %Class.elem = name_ref n, @Class.%.loc8 [concrete = @Class.%.loc8] -// CHECK:STDOUT: %.loc16_17.1: ref %i32 = class_element_access %.loc16_11, element0 -// CHECK:STDOUT: %.loc16_17.2: %i32 = acquire_value %.loc16_17.1 -// CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc16_17.1: = bound_method %.loc16_17.2, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc16_17.2: = bound_method %.loc16_17.2, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc16_17.2(%.loc16_17.2) -// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.loc15 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_return_self_value.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: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] -// CHECK:STDOUT: %Class.F.type: type = fn_type @Class.F [concrete] -// CHECK:STDOUT: %Class.F: %Class.F.type = struct_value () [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.F.decl: %Class.F.type = fn_decl @Class.F [concrete = constants.%Class.F] { -// CHECK:STDOUT: %self.patt: %pattern_type.761 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.761 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %return.patt: = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self -// CHECK:STDOUT: %.loc12: type = converted %self.ref, [concrete = ] -// CHECK:STDOUT: %self.param: %Class = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] -// CHECK:STDOUT: %self: %Class = value_binding self, %self.param -// CHECK:STDOUT: %return.param: ref = out_param call_param1 -// CHECK:STDOUT: %return: ref = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = 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.%Class -// CHECK:STDOUT: .F = %Class.F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F(%self.param: %Class) -> ; -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_conversion_addr.carbon b/toolchain/check/testdata/class/self_conversion_addr.carbon deleted file mode 100644 index 2140a0a108ba..000000000000 --- a/toolchain/check/testdata/class/self_conversion_addr.carbon +++ /dev/null @@ -1,277 +0,0 @@ -// 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/int.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/self_conversion_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self_conversion_addr.carbon - -base class Base { - var a: i32; -} - -class Derived { - extend base: Base; - - fn SelfBase[self: Base]() -> i32; - fn AddrSelfBase[addr self: Base*](); -} - -fn Derived.SelfBase[self: Base]() -> i32 { - return self.a; -} - -fn Derived.AddrSelfBase[addr self: Base*]() { - (*self).a = 1; -} - -fn Call(p: Derived*) -> i32 { - (*p).AddrSelfBase(); - return (*p).SelfBase(); -} - -// CHECK:STDOUT: --- self_conversion_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Base: type = class_type @Base [concrete] -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] -// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete] -// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] -// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete] -// CHECK:STDOUT: %complete_type.fd7: = complete_type_witness %struct_type.a [concrete] -// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete] -// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [concrete] -// CHECK:STDOUT: %pattern_type.bcc: type = pattern_type %Base [concrete] -// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete] -// CHECK:STDOUT: %Derived.SelfBase.type: type = fn_type @Derived.SelfBase [concrete] -// CHECK:STDOUT: %Derived.SelfBase: %Derived.SelfBase.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr.11f: type = ptr_type %Base [concrete] -// CHECK:STDOUT: %pattern_type.1b9: type = pattern_type %ptr.11f [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Derived.AddrSelfBase.type: type = fn_type @Derived.AddrSelfBase [concrete] -// CHECK:STDOUT: %Derived.AddrSelfBase: %Derived.AddrSelfBase.type = struct_value () [concrete] -// CHECK:STDOUT: %struct_type.base.b1e: type = struct_type {.base: %Base} [concrete] -// CHECK:STDOUT: %complete_type.15c: = complete_type_witness %struct_type.base.b1e [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.fb7: = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete] -// CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [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.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] -// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete] -// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete] -// CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete] -// CHECK:STDOUT: %bound_method: = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete] -// CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete] -// CHECK:STDOUT: %ptr.404: type = ptr_type %Derived [concrete] -// CHECK:STDOUT: %pattern_type.605: type = pattern_type %ptr.404 [concrete] -// CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete] -// CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .Int = %Core.Int -// CHECK:STDOUT: .Copy = %Core.Copy -// 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/parts/int, Int, loaded [concrete = constants.%Int.generic] -// CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type] -// CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)] -// CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete] -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)] -// CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Base = %Base.decl -// CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Call = %Call.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {} -// CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {} -// CHECK:STDOUT: %Derived.SelfBase.decl: %Derived.SelfBase.type = fn_decl @Derived.SelfBase [concrete = constants.%Derived.SelfBase] { -// CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.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.loc26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc26: %Base = value_param call_param0 -// CHECK:STDOUT: %Base.ref.loc26: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %self.loc26: %Base = value_binding self, %self.param.loc26 -// CHECK:STDOUT: %return.param.loc26: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc26: ref %i32 = return_slot %return.param.loc26 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Derived.AddrSelfBase.decl: %Derived.AddrSelfBase.type = fn_decl @Derived.AddrSelfBase [concrete = constants.%Derived.AddrSelfBase] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc30_25: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc30: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc30_40: type = splice_block %ptr.loc30 [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Base.ref.loc30: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %ptr.loc30: type = ptr_type %Base.ref.loc30 [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc30: %ptr.11f = value_binding self, %self.param.loc30 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] { -// CHECK:STDOUT: %p.patt: %pattern_type.605 = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: %pattern_type.605 = 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.404 = value_param call_param0 -// CHECK:STDOUT: %.loc34: type = splice_block %ptr [concrete = constants.%ptr.404] { -// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.404] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: %ptr.404 = value_binding 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: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Base { -// 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: %.loc16: %Base.elem = field_decl a, element0 [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.a [concrete = constants.%complete_type.fd7] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc16 -// CHECK:STDOUT: .Base = -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %.loc20: %Derived.elem = base_decl %Base.ref, element0 [concrete] -// CHECK:STDOUT: %Derived.SelfBase.decl: %Derived.SelfBase.type = fn_decl @Derived.SelfBase [concrete = constants.%Derived.SelfBase] { -// CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.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.loc22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %self.param.loc22: %Base = value_param call_param0 -// CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %self.loc22: %Base = value_binding self, %self.param.loc22 -// CHECK:STDOUT: %return.param.loc22: ref %i32 = out_param call_param1 -// CHECK:STDOUT: %return.loc22: ref %i32 = return_slot %return.param.loc22 -// CHECK:STDOUT: } -// CHECK:STDOUT: %Derived.AddrSelfBase.decl: %Derived.AddrSelfBase.type = fn_decl @Derived.AddrSelfBase [concrete = constants.%Derived.AddrSelfBase] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc30_25: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param.loc23: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc23: type = splice_block %ptr.loc23 [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Base.ref.loc23: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %ptr.loc23: type = ptr_type %Base.ref.loc23 [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self.loc23: %ptr.11f = value_binding self, %self.param.loc23 -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base.b1e [concrete = constants.%complete_type.15c] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .Base = -// CHECK:STDOUT: .base = %.loc20 -// CHECK:STDOUT: .SelfBase = %Derived.SelfBase.decl -// CHECK:STDOUT: .AddrSelfBase = %Derived.AddrSelfBase.decl -// CHECK:STDOUT: extend %Base.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Derived.SelfBase(%self.param.loc26: %Base) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %Base = name_ref self, %self.loc26 -// CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc16 [concrete = @Base.%.loc16] -// CHECK:STDOUT: %.loc27_14.1: ref %i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc27_14.2: %i32 = acquire_value %.loc27_14.1 -// CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd] -// CHECK:STDOUT: %bound_method.loc27_14.1: = bound_method %.loc27_14.2, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_14.2: = bound_method %.loc27_14.2, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc27_14.2(%.loc27_14.2) -// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.loc26 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Derived.AddrSelfBase(%self.param.loc30: %ptr.11f) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %ptr.11f = name_ref self, %self.loc30 -// CHECK:STDOUT: %.loc31_4: ref %Base = deref %self.ref -// CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc16 [concrete = @Base.%.loc16] -// CHECK:STDOUT: %.loc31_10: ref %i32 = class_element_access %.loc31_4, element0 -// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b] -// CHECK:STDOUT: %bound_method.loc31_13.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc31_13.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc31_13.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc31_13: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: assign %.loc31_10, %.loc31_13 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Call(%p.param: %ptr.404) -> %i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref.loc35: %ptr.404 = name_ref p, %p -// CHECK:STDOUT: %.loc35_4.1: ref %Derived = deref %p.ref.loc35 -// CHECK:STDOUT: %AddrSelfBase.ref: %Derived.AddrSelfBase.type = name_ref AddrSelfBase, @Derived.%Derived.AddrSelfBase.decl [concrete = constants.%Derived.AddrSelfBase] -// CHECK:STDOUT: %Derived.AddrSelfBase.bound: = bound_method %.loc35_4.1, %AddrSelfBase.ref -// CHECK:STDOUT: %addr.loc35_4.1: %ptr.404 = addr_of %.loc35_4.1 -// CHECK:STDOUT: %.loc35_4.2: ref %Derived = deref %addr.loc35_4.1 -// CHECK:STDOUT: %.loc35_4.3: ref %Base = class_element_access %.loc35_4.2, element0 -// CHECK:STDOUT: %addr.loc35_4.2: %ptr.11f = addr_of %.loc35_4.3 -// CHECK:STDOUT: %.loc35_4.4: %ptr.11f = converted %addr.loc35_4.1, %addr.loc35_4.2 -// CHECK:STDOUT: %Derived.AddrSelfBase.call: init %empty_tuple.type = call %Derived.AddrSelfBase.bound(%.loc35_4.4) -// CHECK:STDOUT: %p.ref.loc36: %ptr.404 = name_ref p, %p -// CHECK:STDOUT: %.loc36_11.1: ref %Derived = deref %p.ref.loc36 -// CHECK:STDOUT: %SelfBase.ref: %Derived.SelfBase.type = name_ref SelfBase, @Derived.%Derived.SelfBase.decl [concrete = constants.%Derived.SelfBase] -// CHECK:STDOUT: %Derived.SelfBase.bound: = bound_method %.loc36_11.1, %SelfBase.ref -// CHECK:STDOUT: %.loc36_11.2: ref %Base = class_element_access %.loc36_11.1, element0 -// CHECK:STDOUT: %.loc36_11.3: ref %Base = converted %.loc36_11.1, %.loc36_11.2 -// CHECK:STDOUT: %.loc36_11.4: %Base = acquire_value %.loc36_11.3 -// CHECK:STDOUT: %Derived.SelfBase.call: init %i32 = call %Derived.SelfBase.bound(%.loc36_11.4) -// CHECK:STDOUT: return %Derived.SelfBase.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/syntactic_merge.carbon b/toolchain/check/testdata/class/syntactic_merge.carbon index 816187ad7ce5..b959efdf5976 100644 --- a/toolchain/check/testdata/class/syntactic_merge.carbon +++ b/toolchain/check/testdata/class/syntactic_merge.carbon @@ -184,27 +184,6 @@ fn Base.F[ref self: Base]() { self.a = (); } -// --- fail_self_type_addr.carbon - -library "[[@TEST_NAME]]"; - -base class Base { - var a: (); - - fn F[addr self: Self*](); -} - -// CHECK:STDERR: fail_self_type_addr.carbon:[[@LINE+7]]:22: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fn Base.F[addr self: Base*]() { -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: fail_self_type_addr.carbon:[[@LINE-6]]:19: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] -// CHECK:STDERR: fn F[addr self: Self*](); -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: -fn Base.F[addr self: Base*]() { - (*self).a = (); -} - // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -1215,81 +1194,3 @@ fn Base.F[addr self: Base*]() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_self_type_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Base: type = class_type @Base [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] -// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %empty_tuple.type [concrete] -// CHECK:STDOUT: %ptr.11f: type = ptr_type %Base [concrete] -// CHECK:STDOUT: %pattern_type.1b9: type = pattern_type %ptr.11f [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %Base.F.type.7c6384.1: type = fn_type @Base.F.loc7 [concrete] -// CHECK:STDOUT: %Base.F.d17bbc.1: %Base.F.type.7c6384.1 = struct_value () [concrete] -// CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a [concrete] -// CHECK:STDOUT: %Base.F.type.7c6384.2: type = fn_type @Base.F.loc17 [concrete] -// CHECK:STDOUT: %Base.F.d17bbc.2: %Base.F.type.7c6384.2 = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Base = %Base.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {} -// CHECK:STDOUT: %Base.F.decl: %Base.F.type.7c6384.2 = fn_decl @Base.F.loc17 [concrete = constants.%Base.F.d17bbc.2] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc17_11: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc17_26: type = splice_block %ptr [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %ptr: type = ptr_type %Base.ref [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.11f = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc5_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc5_11.2: type = converted %.loc5_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc5_8: %Base.elem = field_decl a, element0 [concrete] -// CHECK:STDOUT: %Base.F.decl: %Base.F.type.7c6384.1 = fn_decl @Base.F.loc7 [concrete = constants.%Base.F.d17bbc.1] { -// CHECK:STDOUT: %self.patt: %pattern_type.1b9 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.1b9 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc7_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.11f = value_param call_param0 -// CHECK:STDOUT: %.loc7_23: type = splice_block %ptr [concrete = constants.%ptr.11f] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [concrete = constants.%Base] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.11f] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.11f = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.a [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc5_8 -// CHECK:STDOUT: .F = %Base.F.decl -// CHECK:STDOUT: .Base = -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Base.F.loc7(%self.param: %ptr.11f); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Base.F.loc17(%self.param: %ptr.11f) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: %ptr.11f = name_ref self, %self -// CHECK:STDOUT: %.loc18_4: ref %Base = deref %self.ref -// CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc5_8 [concrete = @Base.%.loc5_8] -// CHECK:STDOUT: %.loc18_10: ref %empty_tuple.type = class_element_access %.loc18_4, element0 -// CHECK:STDOUT: %.loc18_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_16.2: init %empty_tuple.type = tuple_init () to %.loc18_10 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_13: init %empty_tuple.type = converted %.loc18_16.1, %.loc18_16.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %.loc18_10, %.loc18_13 -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/virtual_modifiers.carbon b/toolchain/check/testdata/class/virtual_modifiers.carbon index de5b7c3b86a5..b0d1317c0b9f 100644 --- a/toolchain/check/testdata/class/virtual_modifiers.carbon +++ b/toolchain/check/testdata/class/virtual_modifiers.carbon @@ -310,26 +310,6 @@ class T2 { override fn F1[ref self: Self](); } -// --- fail_addr_self_mismatch.carbon - -library "[[@TEST_NAME]]"; - -base class T1 { - virtual fn F1[self: Self*](); -} - -class T2 { - extend base: T1; - // CHECK:STDERR: fail_addr_self_mismatch.carbon:[[@LINE+7]]:18: error: redeclaration differs at implicit parameter 1 [RedeclParamDiffers] - // CHECK:STDERR: override fn F1[addr self: Self*](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_addr_self_mismatch.carbon:[[@LINE-8]]:17: note: previous declaration's corresponding implicit parameter here [RedeclParamPrevious] - // CHECK:STDERR: virtual fn F1[self: Self*](); - // CHECK:STDERR: ^~~~~~~~~~~ - // CHECK:STDERR: - override fn F1[addr self: Self*](); -} - // --- fail_generic_virtual.carbon library "[[@TEST_NAME]]"; @@ -2665,110 +2645,6 @@ class T2(G2:! type) { // CHECK:STDOUT: // CHECK:STDOUT: override fn @T2.F1(%self.param: %T2); // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_addr_self_mismatch.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T1: type = class_type @T1 [concrete] -// CHECK:STDOUT: %ptr.87b: type = ptr_type %T1 [concrete] -// CHECK:STDOUT: %pattern_type.a36: type = pattern_type %ptr.87b [concrete] -// CHECK:STDOUT: %T1.F1.type: type = fn_type @T1.F1 [concrete] -// CHECK:STDOUT: %T1.F1: %T1.F1.type = struct_value () [concrete] -// CHECK:STDOUT: %ptr.454: type = ptr_type [concrete] -// CHECK:STDOUT: %T1.vtable_decl: ref %ptr.454 = vtable_decl @T1.vtable [concrete] -// CHECK:STDOUT: %struct_type.vptr: type = struct_type {.: %ptr.454} [concrete] -// CHECK:STDOUT: %complete_type.513: = complete_type_witness %struct_type.vptr [concrete] -// CHECK:STDOUT: %T2: type = class_type @T2 [concrete] -// CHECK:STDOUT: %T2.elem: type = unbound_element_type %T2, %T1 [concrete] -// CHECK:STDOUT: %ptr.63e: type = ptr_type %T2 [concrete] -// CHECK:STDOUT: %pattern_type.fb8: type = pattern_type %ptr.63e [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %T2.F1.type: type = fn_type @T2.F1 [concrete] -// CHECK:STDOUT: %T2.F1: %T2.F1.type = struct_value () [concrete] -// CHECK:STDOUT: %T2.vtable_decl: ref %ptr.454 = vtable_decl @T2.vtable [concrete] -// CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %T1} [concrete] -// CHECK:STDOUT: %complete_type.e14: = complete_type_witness %struct_type.base [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .T1 = %T1.decl -// CHECK:STDOUT: .T2 = %T2.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %T1.decl: type = class_decl @T1 [concrete = constants.%T1] {} {} -// CHECK:STDOUT: %T2.decl: type = class_decl @T2 [concrete = constants.%T2] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @T1 { -// CHECK:STDOUT: %T1.F1.decl: %T1.F1.type = fn_decl @T1.F1 [concrete = constants.%T1.F1] { -// CHECK:STDOUT: %self.patt: %pattern_type.a36 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.a36 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.87b = value_param call_param0 -// CHECK:STDOUT: %.loc5: type = splice_block %ptr [concrete = constants.%ptr.87b] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%T1 [concrete = constants.%T1] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.87b] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.87b = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %vtable_decl: ref %ptr.454 = vtable_decl @T1.vtable [concrete = constants.%T1.vtable_decl] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.vptr [concrete = constants.%complete_type.513] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: vtable_decl = %vtable_decl -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%T1 -// CHECK:STDOUT: .F1 = %T1.F1.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @T2 { -// CHECK:STDOUT: %T1.ref: type = name_ref T1, file.%T1.decl [concrete = constants.%T1] -// CHECK:STDOUT: %.loc9: %T2.elem = base_decl %T1.ref, element0 [concrete] -// CHECK:STDOUT: %T2.F1.decl: %T2.F1.type = fn_decl @T2.F1 [concrete = constants.%T2.F1] { -// CHECK:STDOUT: %self.patt: %pattern_type.fb8 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.fb8 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc17_18: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.63e = value_param call_param0 -// CHECK:STDOUT: %.loc17_33: type = splice_block %ptr [concrete = constants.%ptr.63e] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%T2 [concrete = constants.%T2] -// CHECK:STDOUT: %ptr: type = ptr_type %Self.ref [concrete = constants.%ptr.63e] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.63e = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %vtable_decl: ref %ptr.454 = vtable_decl @T2.vtable [concrete = constants.%T2.vtable_decl] -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.base [concrete = constants.%complete_type.e14] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: vtable_decl = %vtable_decl -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%T2 -// CHECK:STDOUT: .T1 = -// CHECK:STDOUT: .base = %.loc9 -// CHECK:STDOUT: .F1 = %T2.F1.decl -// CHECK:STDOUT: extend %T1.ref -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: vtable @T1.vtable { -// CHECK:STDOUT: @T1.%T1.F1.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: vtable @T2.vtable { -// CHECK:STDOUT: @T2.%T2.F1.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: virtual fn @T1.F1(%self.param: %ptr.87b); -// CHECK:STDOUT: -// CHECK:STDOUT: override fn @T2.F1(%self.param: %ptr.63e); -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_generic_virtual.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/const/basics.carbon b/toolchain/check/testdata/const/basics.carbon index 306b00b60429..1a4f72bd8f4f 100644 --- a/toolchain/check/testdata/const/basics.carbon +++ b/toolchain/check/testdata/const/basics.carbon @@ -128,7 +128,7 @@ var init_const_from_const: const X = ({} as X) as const X; library "[[@TEST_NAME]]"; class X { - fn TakeConstSelf[addr self: const Self*](); + fn TakeConstSelf[ref self: const Self](); } fn PassReferenceToConstReference(p: X*) { @@ -139,19 +139,19 @@ fn PassReferenceToConstReference(p: X*) { library "[[@TEST_NAME]]"; class X { - fn TakeSelf[addr self: Self*](); + fn TakeSelf[ref self: Self](); } fn PassConstReferenceToReference(p: const X*) { - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `const X*` to `X*` [ConversionFailure] + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+10]]:3: error: cannot implicitly convert expression of type `const X` to `X` [ConversionFailure] // CHECK:STDERR: p->(X.TakeSelf)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+7]]:3: note: type `const X*` does not implement interface `Core.ImplicitAs(X*)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+7]]:3: note: type `const X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessNote] // CHECK:STDERR: p->(X.TakeSelf)(); // CHECK:STDERR: ^~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-10]]:20: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn TakeSelf[addr self: Self*](); - // CHECK:STDERR: ^~~~~~~~~~~ + // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-10]]:15: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fn TakeSelf[ref self: Self](); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: p->(X.TakeSelf)(); } diff --git a/toolchain/check/testdata/impl/impl_thunk.carbon b/toolchain/check/testdata/impl/impl_thunk.carbon index f686f428a991..d332c3297e74 100644 --- a/toolchain/check/testdata/impl/impl_thunk.carbon +++ b/toolchain/check/testdata/impl/impl_thunk.carbon @@ -55,24 +55,6 @@ impl B as X { //@dump-sem-ir-end } -// --- inheritance_conversion_addr.carbon - -library "[[@TEST_NAME]]"; - -base class A {} -base class B { extend base: A; } -class C { extend base: B; } - -interface X { - fn F[addr self: Self*](other: Self*) -> Self*; -} - -impl B as X { - //@dump-sem-ir-begin - fn F[addr self: A*](other: A*) -> C*; - //@dump-sem-ir-end -} - // --- inheritance_value_conversion.carbon library "[[@TEST_NAME]]"; @@ -117,12 +99,12 @@ base class B { extend base: A; } class C { extend base: B; } interface X { - fn F[addr self: Self*](other: Self*) -> Self*; + fn F[ref self: Self](other: Self*) -> Self*; } impl B as X { //@dump-sem-ir-begin - fn F[addr self: A*](other: A*) -> C*; + fn F[ref self: A](other: A*) -> C*; //@dump-sem-ir-end } @@ -523,103 +505,6 @@ impl () as I({}) { // CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- inheritance_conversion_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %A: type = class_type @A [concrete] -// CHECK:STDOUT: %B: type = class_type @B [concrete] -// CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete] -// CHECK:STDOUT: %pattern_type.5f8: type = pattern_type %ptr.6db [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.1: type = fn_type @B.as.X.impl.F.loc14_39.1 [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.b849c8.1: %B.as.X.impl.F.type.84a1c2.1 = struct_value () [concrete] -// CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.2: type = fn_type @B.as.X.impl.F.loc14_39.2 [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.b849c8.2: %B.as.X.impl.F.type.84a1c2.2 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.75b: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.d9f) [symbolic] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.692: %ptr.as.Copy.impl.Op.type.75b = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.impl_witness.5dd: = impl_witness imports.%Copy.impl_witness_table.67d, @ptr.as.Copy.impl(%B) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.0a3: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%B) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.8c4: %ptr.as.Copy.impl.Op.type.0a3 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.e79, (%Copy.impl_witness.5dd) [concrete] -// CHECK:STDOUT: %.ee7: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: = specific_function %ptr.as.Copy.impl.Op.8c4, @ptr.as.Copy.impl.Op(%B) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core.import_ref.659: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.75b) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.692)] -// CHECK:STDOUT: %Copy.impl_witness_table.67d = impl_witness_table (%Core.import_ref.659), @ptr.as.Copy.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @B.as.X.impl: %B.ref as %X.ref { -// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_39.1: %B.as.X.impl.F.type.84a1c2.1 = fn_decl @B.as.X.impl.F.loc14_39.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] { -// CHECK:STDOUT: %self.patt: %pattern_type.5f8 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.5f8 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc14_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: %other.patt: %pattern_type.5f8 = value_binding_pattern other [concrete] -// CHECK:STDOUT: %other.param_patt: %pattern_type.5f8 = value_param_pattern %other.patt, call_param1 [concrete] -// CHECK:STDOUT: %return.patt: %pattern_type.44a = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: %pattern_type.44a = out_param_pattern %return.patt, call_param2 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc14_38: type = ptr_type %C.ref [concrete = constants.%ptr.019] -// CHECK:STDOUT: %self.param: %ptr.6db = value_param call_param0 -// CHECK:STDOUT: %.loc14_20: type = splice_block %ptr.loc14_20 [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %A.ref.loc14_19: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %ptr.loc14_20: type = ptr_type %A.ref.loc14_19 [concrete = constants.%ptr.6db] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.6db = value_binding self, %self.param -// CHECK:STDOUT: %other.param: %ptr.6db = value_param call_param1 -// CHECK:STDOUT: %.loc14_31: type = splice_block %ptr.loc14_31 [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %A.ref.loc14_30: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %ptr.loc14_31: type = ptr_type %A.ref.loc14_30 [concrete = constants.%ptr.6db] -// CHECK:STDOUT: } -// CHECK:STDOUT: %other: %ptr.6db = value_binding other, %other.param -// CHECK:STDOUT: %return.param: ref %ptr.019 = out_param call_param2 -// CHECK:STDOUT: %return: ref %ptr.019 = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_39.2: %B.as.X.impl.F.type.84a1c2.2 = fn_decl @B.as.X.impl.F.loc14_39.2 [concrete = constants.%B.as.X.impl.F.b849c8.2] { -// CHECK:STDOUT: -// CHECK:STDOUT: } { -// CHECK:STDOUT: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .A = -// CHECK:STDOUT: .C = -// CHECK:STDOUT: .F = %B.as.X.impl.F.decl.loc14_39.1 -// CHECK:STDOUT: witness = file.%X.impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_39.1(%self.param: %ptr.6db, %other.param: %ptr.6db) -> %ptr.019; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_39.2(%self.param: %ptr.e79, %other.param: %ptr.e79) -> %ptr.e79 [thunk @B.as.X.impl.%B.as.X.impl.F.decl.loc14_39.1] { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %B.as.X.impl.F.type.84a1c2.1 = name_ref F, @B.as.X.impl.%B.as.X.impl.F.decl.loc14_39.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] -// CHECK:STDOUT: -// CHECK:STDOUT: %B.as.X.impl.F.bound: = bound_method %.loc9_17.1, %F.ref -// CHECK:STDOUT: -// CHECK:STDOUT: %B.as.X.impl.F.call: init %ptr.019 = call %B.as.X.impl.F.bound(%.loc9_17.4, %.loc9_31.3) -// CHECK:STDOUT: %.loc14_39.1: %ptr.019 = value_of_initializer %B.as.X.impl.F.call -// CHECK:STDOUT: %.loc14_39.2: %ptr.019 = converted %B.as.X.impl.F.call, %.loc14_39.1 -// CHECK:STDOUT: %.loc14_39.3: ref %C = deref %.loc14_39.2 -// CHECK:STDOUT: %.loc14_39.4: ref %B = class_element_access %.loc14_39.3, element0 -// CHECK:STDOUT: %addr.loc14: %ptr.e79 = addr_of %.loc14_39.4 -// CHECK:STDOUT: %.loc14_39.5: %ptr.e79 = converted %B.as.X.impl.F.call, %addr.loc14 -// CHECK:STDOUT: %impl.elem0: %.ee7 = impl_witness_access constants.%Copy.impl_witness.5dd, element0 [concrete = constants.%ptr.as.Copy.impl.Op.8c4] -// CHECK:STDOUT: %bound_method.loc14_39.1: = bound_method %.loc14_39.5, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%B) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_39.2: = bound_method %.loc14_39.5, %specific_fn -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.e79 = call %bound_method.loc14_39.2(%.loc14_39.5) -// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- inheritance_value_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -773,15 +658,15 @@ impl () as I({}) { // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %B: type = class_type @B [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] +// CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete] // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete] // CHECK:STDOUT: %pattern_type.5f8: type = pattern_type %ptr.6db [concrete] // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.1: type = fn_type @B.as.X.impl.F.loc14_39.1 [concrete] +// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.1: type = fn_type @B.as.X.impl.F.loc14_37.1 [concrete] // CHECK:STDOUT: %B.as.X.impl.F.b849c8.1: %B.as.X.impl.F.type.84a1c2.1 = struct_value () [concrete] // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete] -// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.2: type = fn_type @B.as.X.impl.F.loc14_39.2 [concrete] +// CHECK:STDOUT: %B.as.X.impl.F.type.84a1c2.2: type = fn_type @B.as.X.impl.F.loc14_37.2 [concrete] // CHECK:STDOUT: %B.as.X.impl.F.b849c8.2: %B.as.X.impl.F.type.84a1c2.2 = struct_value () [concrete] // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] @@ -802,33 +687,29 @@ impl () as I({}) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @B.as.X.impl: %B.ref as %X.ref { -// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_39.1: %B.as.X.impl.F.type.84a1c2.1 = fn_decl @B.as.X.impl.F.loc14_39.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] { -// CHECK:STDOUT: %self.patt: %pattern_type.5f8 = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.5f8 = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc14_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] +// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_37.1: %B.as.X.impl.F.type.84a1c2.1 = fn_decl @B.as.X.impl.F.loc14_37.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] { +// CHECK:STDOUT: %self.patt: %pattern_type.c10 = ref_binding_pattern self [concrete] +// CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = ref_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: %other.patt: %pattern_type.5f8 = value_binding_pattern other [concrete] // CHECK:STDOUT: %other.param_patt: %pattern_type.5f8 = value_param_pattern %other.patt, call_param1 [concrete] // CHECK:STDOUT: %return.patt: %pattern_type.44a = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.44a = out_param_pattern %return.patt, call_param2 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc14_38: type = ptr_type %C.ref [concrete = constants.%ptr.019] -// CHECK:STDOUT: %self.param: %ptr.6db = value_param call_param0 -// CHECK:STDOUT: %.loc14_20: type = splice_block %ptr.loc14_20 [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %A.ref.loc14_19: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %ptr.loc14_20: type = ptr_type %A.ref.loc14_19 [concrete = constants.%ptr.6db] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.6db = value_binding self, %self.param +// CHECK:STDOUT: %ptr.loc14_36: type = ptr_type %C.ref [concrete = constants.%ptr.019] +// CHECK:STDOUT: %self.param: ref %A = ref_param call_param0 +// CHECK:STDOUT: %A.ref.loc14_18: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %self: ref %A = ref_binding self, %self.param // CHECK:STDOUT: %other.param: %ptr.6db = value_param call_param1 -// CHECK:STDOUT: %.loc14_31: type = splice_block %ptr.loc14_31 [concrete = constants.%ptr.6db] { -// CHECK:STDOUT: %A.ref.loc14_30: type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %ptr.loc14_31: type = ptr_type %A.ref.loc14_30 [concrete = constants.%ptr.6db] +// CHECK:STDOUT: %.loc14: type = splice_block %ptr.loc14_29 [concrete = constants.%ptr.6db] { +// CHECK:STDOUT: %A.ref.loc14_28: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %ptr.loc14_29: type = ptr_type %A.ref.loc14_28 [concrete = constants.%ptr.6db] // CHECK:STDOUT: } // CHECK:STDOUT: %other: %ptr.6db = value_binding other, %other.param // CHECK:STDOUT: %return.param: ref %ptr.019 = out_param call_param2 // CHECK:STDOUT: %return: ref %ptr.019 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_39.2: %B.as.X.impl.F.type.84a1c2.2 = fn_decl @B.as.X.impl.F.loc14_39.2 [concrete = constants.%B.as.X.impl.F.b849c8.2] { +// CHECK:STDOUT: %B.as.X.impl.F.decl.loc14_37.2: %B.as.X.impl.F.type.84a1c2.2 = fn_decl @B.as.X.impl.F.loc14_37.2 [concrete = constants.%B.as.X.impl.F.b849c8.2] { // CHECK:STDOUT: // CHECK:STDOUT: } { // CHECK:STDOUT: @@ -837,30 +718,30 @@ impl () as I({}) { // CHECK:STDOUT: !members: // CHECK:STDOUT: .A = // CHECK:STDOUT: .C = -// CHECK:STDOUT: .F = %B.as.X.impl.F.decl.loc14_39.1 +// CHECK:STDOUT: .F = %B.as.X.impl.F.decl.loc14_37.1 // CHECK:STDOUT: witness = file.%X.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_39.1(%self.param: %ptr.6db, %other.param: %ptr.6db) -> %ptr.019; +// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_37.1(%self.param: %A, %other.param: %ptr.6db) -> %ptr.019; // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_39.2(%self.param: %ptr.e79, %other.param: %ptr.e79) -> %ptr.e79 [thunk @B.as.X.impl.%B.as.X.impl.F.decl.loc14_39.1] { +// CHECK:STDOUT: fn @B.as.X.impl.F.loc14_37.2(%self.param: %B, %other.param: %ptr.e79) -> %ptr.e79 [thunk @B.as.X.impl.%B.as.X.impl.F.decl.loc14_37.1] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %B.as.X.impl.F.type.84a1c2.1 = name_ref F, @B.as.X.impl.%B.as.X.impl.F.decl.loc14_39.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] +// CHECK:STDOUT: %F.ref: %B.as.X.impl.F.type.84a1c2.1 = name_ref F, @B.as.X.impl.%B.as.X.impl.F.decl.loc14_37.1 [concrete = constants.%B.as.X.impl.F.b849c8.1] // CHECK:STDOUT: -// CHECK:STDOUT: %B.as.X.impl.F.bound: = bound_method %.loc9_17.1, %F.ref +// CHECK:STDOUT: %B.as.X.impl.F.bound: = bound_method %self.ref, %F.ref // CHECK:STDOUT: -// CHECK:STDOUT: %B.as.X.impl.F.call: init %ptr.019 = call %B.as.X.impl.F.bound(%.loc9_17.4, %.loc9_31.3) -// CHECK:STDOUT: %.loc14_39.1: %ptr.019 = value_of_initializer %B.as.X.impl.F.call -// CHECK:STDOUT: %.loc14_39.2: %ptr.019 = converted %B.as.X.impl.F.call, %.loc14_39.1 -// CHECK:STDOUT: %.loc14_39.3: ref %C = deref %.loc14_39.2 -// CHECK:STDOUT: %.loc14_39.4: ref %B = class_element_access %.loc14_39.3, element0 -// CHECK:STDOUT: %addr.loc14: %ptr.e79 = addr_of %.loc14_39.4 -// CHECK:STDOUT: %.loc14_39.5: %ptr.e79 = converted %B.as.X.impl.F.call, %addr.loc14 +// CHECK:STDOUT: %B.as.X.impl.F.call: init %ptr.019 = call %B.as.X.impl.F.bound(%.loc9_16.2, %.loc9_29.3) +// CHECK:STDOUT: %.loc14_37.1: %ptr.019 = value_of_initializer %B.as.X.impl.F.call +// CHECK:STDOUT: %.loc14_37.2: %ptr.019 = converted %B.as.X.impl.F.call, %.loc14_37.1 +// CHECK:STDOUT: %.loc14_37.3: ref %C = deref %.loc14_37.2 +// CHECK:STDOUT: %.loc14_37.4: ref %B = class_element_access %.loc14_37.3, element0 +// CHECK:STDOUT: %addr.loc14: %ptr.e79 = addr_of %.loc14_37.4 +// CHECK:STDOUT: %.loc14_37.5: %ptr.e79 = converted %B.as.X.impl.F.call, %addr.loc14 // CHECK:STDOUT: %impl.elem0: %.ee7 = impl_witness_access constants.%Copy.impl_witness.5dd, element0 [concrete = constants.%ptr.as.Copy.impl.Op.8c4] -// CHECK:STDOUT: %bound_method.loc14_39.1: = bound_method %.loc14_39.5, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc14_37.1: = bound_method %.loc14_37.5, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%B) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_39.2: = bound_method %.loc14_39.5, %specific_fn -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.e79 = call %bound_method.loc14_39.2(%.loc14_39.5) +// CHECK:STDOUT: %bound_method.loc14_37.2: = bound_method %.loc14_37.5, %specific_fn +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.e79 = call %bound_method.loc14_37.2(%.loc14_37.5) // CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon b/toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon deleted file mode 100644 index 208ea73f2c6b..000000000000 --- a/toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon +++ /dev/null @@ -1,352 +0,0 @@ -// 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/convert.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/impl_forall_addr.carbon - -// --- impl_forall.carbon -library "[[@TEST_NAME]]"; - -class A(T:! type) { - var n: T; -} - -interface I(U:! type) { - fn F[addr self: Self*]() -> U*; -} - -//@dump-sem-ir-begin -impl forall [V:! type] A(V) as I(V) { - fn F[addr self: Self*]() -> V* { - return &self->n; - } -} -//@dump-sem-ir-end - -fn TestGeneric[W:! type](a: A(W)*) -> W* { - //@dump-sem-ir-begin - return a->(I(W).F)(); - //@dump-sem-ir-end -} - -fn TestSpecific(a: A({})*) -> {}* { - //@dump-sem-ir-begin - return a->(I({}).F)(); - //@dump-sem-ir-end -} - -// CHECK:STDOUT: --- impl_forall.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete] -// CHECK:STDOUT: %A.type: type = generic_class_type @A [concrete] -// CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete] -// CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete] -// CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %V.d9f: type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %A.2ddf89.2: type = class_type @A, @A(%V.d9f) [symbolic] -// CHECK:STDOUT: %I.type.07036d.2: type = facet_type <@I, @I(%V.d9f)> [symbolic] -// CHECK:STDOUT: %require_complete.c94ab4.1: = require_complete_type %I.type.07036d.2 [symbolic] -// CHECK:STDOUT: %I.impl_witness.0c179e.1: = impl_witness file.%I.impl_witness_table, @A.as.I.impl(%V.d9f) [symbolic] -// CHECK:STDOUT: %ptr.6f46b6.1: type = ptr_type %A.2ddf89.2 [symbolic] -// CHECK:STDOUT: %pattern_type.2180b5.1: type = pattern_type %ptr.6f46b6.1 [symbolic] -// CHECK:STDOUT: %ptr.4f0b5c.2: type = ptr_type %V.d9f [symbolic] -// CHECK:STDOUT: %pattern_type.a603a0.2: type = pattern_type %ptr.4f0b5c.2 [symbolic] -// CHECK:STDOUT: %A.as.I.impl.F.type.2974bf.1: type = fn_type @A.as.I.impl.F, @A.as.I.impl(%V.d9f) [symbolic] -// CHECK:STDOUT: %A.as.I.impl.F.786476.1: %A.as.I.impl.F.type.2974bf.1 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete.482d3f.1: = require_complete_type %ptr.4f0b5c.2 [symbolic] -// CHECK:STDOUT: %require_complete.743ecf.1: = require_complete_type %ptr.6f46b6.1 [symbolic] -// CHECK:STDOUT: %A.elem.ee5a68.2: type = unbound_element_type %A.2ddf89.2, %V.d9f [symbolic] -// CHECK:STDOUT: %require_complete.f6b5ff.1: = require_complete_type %A.2ddf89.2 [symbolic] -// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] -// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.75bcbe.1: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.d9f) [symbolic] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.692ac2.1: %ptr.as.Copy.impl.Op.type.75bcbe.1 = struct_value () [symbolic] -// CHECK:STDOUT: %Copy.lookup_impl_witness.c66: = lookup_impl_witness %ptr.4f0b5c.2, @Copy [symbolic] -// CHECK:STDOUT: %Copy.facet.747: %Copy.type = facet_value %ptr.4f0b5c.2, (%Copy.lookup_impl_witness.c66) [symbolic] -// CHECK:STDOUT: %.89d: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.747 [symbolic] -// CHECK:STDOUT: %impl.elem0.928: %.89d = impl_witness_access %Copy.lookup_impl_witness.c66, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.6a1: = specific_impl_function %impl.elem0.928, @Copy.Op(%Copy.facet.747) [symbolic] -// CHECK:STDOUT: %W: type = symbolic_binding W, 0 [symbolic] -// CHECK:STDOUT: %A.2ddf89.3: type = class_type @A, @A(%W) [symbolic] -// CHECK:STDOUT: %ptr.6f46b6.2: type = ptr_type %A.2ddf89.3 [symbolic] -// CHECK:STDOUT: %pattern_type.2180b5.2: type = pattern_type %ptr.6f46b6.2 [symbolic] -// CHECK:STDOUT: %ptr.4f0b5c.4: type = ptr_type %W [symbolic] -// CHECK:STDOUT: %pattern_type.a603a0.4: type = pattern_type %ptr.4f0b5c.4 [symbolic] -// CHECK:STDOUT: %I.type.07036d.3: type = facet_type <@I, @I(%W)> [symbolic] -// CHECK:STDOUT: %I.F.type.76d346.3: type = fn_type @I.F, @I(%W) [symbolic] -// CHECK:STDOUT: %I.assoc_type.b650b2.3: type = assoc_entity_type @I, @I(%W) [symbolic] -// CHECK:STDOUT: %assoc0.b4fda0.3: %I.assoc_type.b650b2.3 = assoc_entity element0, @I.%I.F.decl [symbolic] -// CHECK:STDOUT: %require_complete.c94ab4.2: = require_complete_type %I.type.07036d.3 [symbolic] -// CHECK:STDOUT: %I.impl_witness.0c179e.2: = impl_witness file.%I.impl_witness_table, @A.as.I.impl(%W) [symbolic] -// CHECK:STDOUT: %A.as.I.impl.F.type.2974bf.2: type = fn_type @A.as.I.impl.F, @A.as.I.impl(%W) [symbolic] -// CHECK:STDOUT: %A.as.I.impl.F.786476.2: %A.as.I.impl.F.type.2974bf.2 = struct_value () [symbolic] -// CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %A.2ddf89.3, @I, @I(%W) [symbolic] -// CHECK:STDOUT: %I.facet.84d: %I.type.07036d.3 = facet_value %A.2ddf89.3, (%I.lookup_impl_witness) [symbolic] -// CHECK:STDOUT: %.e50: type = fn_type_with_self_type %I.F.type.76d346.3, %I.facet.84d [symbolic] -// CHECK:STDOUT: %impl.elem0.a9e: %.e50 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.2e3: = specific_impl_function %impl.elem0.a9e, @I.F(%W, %I.facet.84d) [symbolic] -// CHECK:STDOUT: %require_complete.f6b5ff.2: = require_complete_type %A.2ddf89.3 [symbolic] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] -// CHECK:STDOUT: %A.235: type = class_type @A, @A(%empty_struct_type) [concrete] -// CHECK:STDOUT: %ptr.197: type = ptr_type %A.235 [concrete] -// CHECK:STDOUT: %pattern_type.e47: type = pattern_type %ptr.197 [concrete] -// CHECK:STDOUT: %ptr.c28: type = ptr_type %empty_struct_type [concrete] -// CHECK:STDOUT: %pattern_type.1cc: type = pattern_type %ptr.c28 [concrete] -// CHECK:STDOUT: %I.type.399: type = facet_type <@I, @I(%empty_struct_type)> [concrete] -// CHECK:STDOUT: %I.F.type.684: type = fn_type @I.F, @I(%empty_struct_type) [concrete] -// CHECK:STDOUT: %I.assoc_type.22c: type = assoc_entity_type @I, @I(%empty_struct_type) [concrete] -// CHECK:STDOUT: %assoc0.a7f: %I.assoc_type.22c = assoc_entity element0, @I.%I.F.decl [concrete] -// CHECK:STDOUT: %complete_type.e4b: = complete_type_witness %I.type.399 [concrete] -// CHECK:STDOUT: %I.impl_witness.915: = impl_witness file.%I.impl_witness_table, @A.as.I.impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %A.as.I.impl.F.type.184: type = fn_type @A.as.I.impl.F, @A.as.I.impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %A.as.I.impl.F.041: %A.as.I.impl.F.type.184 = struct_value () [concrete] -// CHECK:STDOUT: %I.facet.6ea: %I.type.399 = facet_value %A.235, (%I.impl_witness.915) [concrete] -// CHECK:STDOUT: %.824: type = fn_type_with_self_type %I.F.type.684, %I.facet.6ea [concrete] -// CHECK:STDOUT: %A.as.I.impl.F.specific_fn: = specific_function %A.as.I.impl.F.041, @A.as.I.impl.F(%empty_struct_type) [concrete] -// CHECK:STDOUT: %A.elem.2af: type = unbound_element_type %A.235, %empty_struct_type [concrete] -// CHECK:STDOUT: %struct_type.n.91c: type = struct_type {.n: %empty_struct_type} [concrete] -// CHECK:STDOUT: %complete_type.0a6: = complete_type_witness %struct_type.n.91c [concrete] -// CHECK:STDOUT: %complete_type.38e: = complete_type_witness %ptr.c28 [concrete] -// CHECK:STDOUT: %complete_type.d27: = complete_type_witness %ptr.197 [concrete] -// CHECK:STDOUT: %Copy.impl_witness.433: = impl_witness imports.%Copy.impl_witness_table.67d, @ptr.as.Copy.impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.424: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%empty_struct_type) [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.15e: %ptr.as.Copy.impl.Op.type.424 = struct_value () [concrete] -// CHECK:STDOUT: %Copy.facet.48c: %Copy.type = facet_value %ptr.c28, (%Copy.impl_witness.433) [concrete] -// CHECK:STDOUT: %.fb0: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.48c [concrete] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: = specific_function %ptr.as.Copy.impl.Op.15e, @ptr.as.Copy.impl.Op(%empty_struct_type) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core.import_ref.659: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.75bcbe.1) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.692ac2.1)] -// CHECK:STDOUT: %Copy.impl_witness_table.67d = impl_witness_table (%Core.import_ref.659), @ptr.as.Copy.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: impl_decl @A.as.I.impl [concrete] { -// CHECK:STDOUT: %V.patt: %pattern_type.98f = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %V.ref.loc12_26: type = name_ref V, %V.loc12_14.2 [symbolic = %V.loc12_14.1 (constants.%V.d9f)] -// CHECK:STDOUT: %A.loc12_27.2: type = class_type @A, @A(constants.%V.d9f) [symbolic = %A.loc12_27.1 (constants.%A.2ddf89.2)] -// CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %V.ref.loc12_34: type = name_ref V, %V.loc12_14.2 [symbolic = %V.loc12_14.1 (constants.%V.d9f)] -// CHECK:STDOUT: %I.type.loc12_35.2: type = facet_type <@I, @I(constants.%V.d9f)> [symbolic = %I.type.loc12_35.1 (constants.%I.type.07036d.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: %V.loc12_14.2: type = symbolic_binding V, 0 [symbolic = %V.loc12_14.1 (constants.%V.d9f)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@A.as.I.impl.%A.as.I.impl.F.decl), @A.as.I.impl [concrete] -// CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table, @A.as.I.impl(constants.%V.d9f) [symbolic = @A.as.I.impl.%I.impl_witness (constants.%I.impl_witness.0c179e.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @A.as.I.impl(%V.loc12_14.2: type) { -// CHECK:STDOUT: %V.loc12_14.1: type = symbolic_binding V, 0 [symbolic = %V.loc12_14.1 (constants.%V.d9f)] -// CHECK:STDOUT: %A.loc12_27.1: type = class_type @A, @A(%V.loc12_14.1) [symbolic = %A.loc12_27.1 (constants.%A.2ddf89.2)] -// CHECK:STDOUT: %I.type.loc12_35.1: type = facet_type <@I, @I(%V.loc12_14.1)> [symbolic = %I.type.loc12_35.1 (constants.%I.type.07036d.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %I.type.loc12_35.1 [symbolic = %require_complete (constants.%require_complete.c94ab4.1)] -// CHECK:STDOUT: %I.impl_witness: = impl_witness file.%I.impl_witness_table, @A.as.I.impl(%V.loc12_14.1) [symbolic = %I.impl_witness (constants.%I.impl_witness.0c179e.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %A.as.I.impl.F.type: type = fn_type @A.as.I.impl.F, @A.as.I.impl(%V.loc12_14.1) [symbolic = %A.as.I.impl.F.type (constants.%A.as.I.impl.F.type.2974bf.1)] -// CHECK:STDOUT: %A.as.I.impl.F: @A.as.I.impl.%A.as.I.impl.F.type (%A.as.I.impl.F.type.2974bf.1) = struct_value () [symbolic = %A.as.I.impl.F (constants.%A.as.I.impl.F.786476.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %A.loc12_27.2 as %I.type.loc12_35.2 { -// CHECK:STDOUT: %A.as.I.impl.F.decl: @A.as.I.impl.%A.as.I.impl.F.type (%A.as.I.impl.F.type.2974bf.1) = fn_decl @A.as.I.impl.F [symbolic = @A.as.I.impl.%A.as.I.impl.F (constants.%A.as.I.impl.F.786476.1)] { -// CHECK:STDOUT: %self.patt: @A.as.I.impl.F.%pattern_type.loc13_13 (%pattern_type.2180b5.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @A.as.I.impl.F.%pattern_type.loc13_13 (%pattern_type.2180b5.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc13_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: %return.patt: @A.as.I.impl.F.%pattern_type.loc13_28 (%pattern_type.a603a0.2) = return_slot_pattern [concrete] -// CHECK:STDOUT: %return.param_patt: @A.as.I.impl.F.%pattern_type.loc13_28 (%pattern_type.a603a0.2) = out_param_pattern %return.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %V.ref: type = name_ref V, @A.as.I.impl.%V.loc12_14.2 [symbolic = %V (constants.%V.d9f)] -// CHECK:STDOUT: %ptr.loc13_32.2: type = ptr_type %V.ref [symbolic = %ptr.loc13_32.1 (constants.%ptr.4f0b5c.2)] -// CHECK:STDOUT: %self.param: @A.as.I.impl.F.%ptr.loc13_23.1 (%ptr.6f46b6.1) = value_param call_param0 -// CHECK:STDOUT: %.loc13_23: type = splice_block %ptr.loc13_23.2 [symbolic = %ptr.loc13_23.1 (constants.%ptr.6f46b6.1)] { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @A.as.I.impl.%A.loc12_27.2 [symbolic = %A (constants.%A.2ddf89.2)] -// CHECK:STDOUT: %ptr.loc13_23.2: type = ptr_type %Self.ref [symbolic = %ptr.loc13_23.1 (constants.%ptr.6f46b6.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @A.as.I.impl.F.%ptr.loc13_23.1 (%ptr.6f46b6.1) = value_binding self, %self.param -// CHECK:STDOUT: %return.param: ref @A.as.I.impl.F.%ptr.loc13_32.1 (%ptr.4f0b5c.2) = out_param call_param1 -// CHECK:STDOUT: %return: ref @A.as.I.impl.F.%ptr.loc13_32.1 (%ptr.4f0b5c.2) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .V = -// CHECK:STDOUT: .F = %A.as.I.impl.F.decl -// CHECK:STDOUT: witness = file.%I.impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A.as.I.impl.F(@A.as.I.impl.%V.loc12_14.2: type) { -// CHECK:STDOUT: %V: type = symbolic_binding V, 0 [symbolic = %V (constants.%V.d9f)] -// CHECK:STDOUT: %A: type = class_type @A, @A(%V) [symbolic = %A (constants.%A.2ddf89.2)] -// CHECK:STDOUT: %ptr.loc13_23.1: type = ptr_type %A [symbolic = %ptr.loc13_23.1 (constants.%ptr.6f46b6.1)] -// CHECK:STDOUT: %pattern_type.loc13_13: type = pattern_type %ptr.loc13_23.1 [symbolic = %pattern_type.loc13_13 (constants.%pattern_type.2180b5.1)] -// CHECK:STDOUT: %ptr.loc13_32.1: type = ptr_type %V [symbolic = %ptr.loc13_32.1 (constants.%ptr.4f0b5c.2)] -// CHECK:STDOUT: %pattern_type.loc13_28: type = pattern_type %ptr.loc13_32.1 [symbolic = %pattern_type.loc13_28 (constants.%pattern_type.a603a0.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc13_28: = require_complete_type %ptr.loc13_32.1 [symbolic = %require_complete.loc13_28 (constants.%require_complete.482d3f.1)] -// CHECK:STDOUT: %require_complete.loc13_17: = require_complete_type %ptr.loc13_23.1 [symbolic = %require_complete.loc13_17 (constants.%require_complete.743ecf.1)] -// CHECK:STDOUT: %require_complete.loc14: = require_complete_type %A [symbolic = %require_complete.loc14 (constants.%require_complete.f6b5ff.1)] -// CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %V [symbolic = %A.elem (constants.%A.elem.ee5a68.2)] -// CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %ptr.loc13_32.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.c66)] -// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc13_32.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet.747)] -// CHECK:STDOUT: %.loc14_12.2: type = fn_type_with_self_type constants.%Copy.Op.type, %Copy.facet [symbolic = %.loc14_12.2 (constants.%.89d)] -// CHECK:STDOUT: %impl.elem0.loc14_12.2: @A.as.I.impl.F.%.loc14_12.2 (%.89d) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_12.2 (constants.%impl.elem0.928)] -// CHECK:STDOUT: %specific_impl_fn.loc14_12.2: = specific_impl_function %impl.elem0.loc14_12.2, @Copy.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc14_12.2 (constants.%specific_impl_fn.6a1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @A.as.I.impl.F.%ptr.loc13_23.1 (%ptr.6f46b6.1)) -> @A.as.I.impl.F.%ptr.loc13_32.1 (%ptr.4f0b5c.2) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @A.as.I.impl.F.%ptr.loc13_23.1 (%ptr.6f46b6.1) = name_ref self, %self -// CHECK:STDOUT: %.loc14_17.1: ref @A.as.I.impl.F.%A (%A.2ddf89.2) = deref %self.ref -// CHECK:STDOUT: %n.ref: @A.as.I.impl.F.%A.elem (%A.elem.ee5a68.2) = name_ref n, @A.%.loc4 [concrete = @A.%.loc4] -// CHECK:STDOUT: %.loc14_17.2: ref @A.as.I.impl.F.%V (%V.d9f) = class_element_access %.loc14_17.1, element0 -// CHECK:STDOUT: %addr: @A.as.I.impl.F.%ptr.loc13_32.1 (%ptr.4f0b5c.2) = addr_of %.loc14_17.2 -// CHECK:STDOUT: %impl.elem0.loc14_12.1: @A.as.I.impl.F.%.loc14_12.2 (%.89d) = impl_witness_access constants.%Copy.lookup_impl_witness.c66, element0 [symbolic = %impl.elem0.loc14_12.2 (constants.%impl.elem0.928)] -// CHECK:STDOUT: %bound_method.loc14_12.1: = bound_method %addr, %impl.elem0.loc14_12.1 -// CHECK:STDOUT: %specific_impl_fn.loc14_12.1: = specific_impl_function %impl.elem0.loc14_12.1, @Copy.Op(constants.%Copy.facet.747) [symbolic = %specific_impl_fn.loc14_12.2 (constants.%specific_impl_fn.6a1)] -// CHECK:STDOUT: %bound_method.loc14_12.2: = bound_method %addr, %specific_impl_fn.loc14_12.1 -// CHECK:STDOUT: %.loc14_12.1: init @A.as.I.impl.F.%ptr.loc13_32.1 (%ptr.4f0b5c.2) = call %bound_method.loc14_12.2(%addr) -// CHECK:STDOUT: return %.loc14_12.1 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestGeneric(%W.loc19_16.2: type) { -// CHECK:STDOUT: -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: %I.type.loc21_17.2: type = facet_type <@I, @I(%W.loc19_16.1)> [symbolic = %I.type.loc21_17.2 (constants.%I.type.07036d.3)] -// CHECK:STDOUT: %require_complete.loc21_18: = require_complete_type %I.type.loc21_17.2 [symbolic = %require_complete.loc21_18 (constants.%require_complete.c94ab4.2)] -// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%W.loc19_16.1) [symbolic = %I.assoc_type (constants.%I.assoc_type.b650b2.3)] -// CHECK:STDOUT: %assoc0: @TestGeneric.%I.assoc_type (%I.assoc_type.b650b2.3) = assoc_entity element0, @I.%I.F.decl [symbolic = %assoc0 (constants.%assoc0.b4fda0.3)] -// CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %A.loc19_32.1, @I, @I(%W.loc19_16.1) [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)] -// CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%W.loc19_16.1) [symbolic = %I.F.type (constants.%I.F.type.76d346.3)] -// CHECK:STDOUT: %I.facet: @TestGeneric.%I.type.loc21_17.2 (%I.type.07036d.3) = facet_value %A.loc19_32.1, (%I.lookup_impl_witness) [symbolic = %I.facet (constants.%I.facet.84d)] -// CHECK:STDOUT: %.loc21_11.2: type = fn_type_with_self_type %I.F.type, %I.facet [symbolic = %.loc21_11.2 (constants.%.e50)] -// CHECK:STDOUT: %impl.elem0.loc21_11.2: @TestGeneric.%.loc21_11.2 (%.e50) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_11.2 (constants.%impl.elem0.a9e)] -// CHECK:STDOUT: %specific_impl_fn.loc21_11.2: = specific_impl_function %impl.elem0.loc21_11.2, @I.F(%W.loc19_16.1, %I.facet) [symbolic = %specific_impl_fn.loc21_11.2 (constants.%specific_impl_fn.2e3)] -// CHECK:STDOUT: %require_complete.loc21_11: = require_complete_type %A.loc19_32.1 [symbolic = %require_complete.loc21_11 (constants.%require_complete.f6b5ff.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%a.param: @TestGeneric.%ptr.loc19_33.1 (%ptr.6f46b6.2)) -> @TestGeneric.%ptr.loc19_40.1 (%ptr.4f0b5c.4) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: @TestGeneric.%ptr.loc19_33.1 (%ptr.6f46b6.2) = name_ref a, %a -// CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %W.ref.loc21: type = name_ref W, %W.loc19_16.2 [symbolic = %W.loc19_16.1 (constants.%W)] -// CHECK:STDOUT: %I.type.loc21_17.1: type = facet_type <@I, @I(constants.%W)> [symbolic = %I.type.loc21_17.2 (constants.%I.type.07036d.3)] -// CHECK:STDOUT: %.loc21_18: @TestGeneric.%I.assoc_type (%I.assoc_type.b650b2.3) = specific_constant @I.%assoc0.loc8_33.1, @I(constants.%W) [symbolic = %assoc0 (constants.%assoc0.b4fda0.3)] -// CHECK:STDOUT: %F.ref: @TestGeneric.%I.assoc_type (%I.assoc_type.b650b2.3) = name_ref F, %.loc21_18 [symbolic = %assoc0 (constants.%assoc0.b4fda0.3)] -// CHECK:STDOUT: %.loc21_11.1: ref @TestGeneric.%A.loc19_32.1 (%A.2ddf89.3) = deref %a.ref -// CHECK:STDOUT: %impl.elem0.loc21_11.1: @TestGeneric.%.loc21_11.2 (%.e50) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc21_11.2 (constants.%impl.elem0.a9e)] -// CHECK:STDOUT: %bound_method.loc21_11: = bound_method %.loc21_11.1, %impl.elem0.loc21_11.1 -// CHECK:STDOUT: %specific_impl_fn.loc21_11.1: = specific_impl_function %impl.elem0.loc21_11.1, @I.F(constants.%W, constants.%I.facet.84d) [symbolic = %specific_impl_fn.loc21_11.2 (constants.%specific_impl_fn.2e3)] -// CHECK:STDOUT: %bound_method.loc21_22: = bound_method %.loc21_11.1, %specific_impl_fn.loc21_11.1 -// CHECK:STDOUT: %addr: @TestGeneric.%ptr.loc19_33.1 (%ptr.6f46b6.2) = addr_of %.loc21_11.1 -// CHECK:STDOUT: %.loc21_22: init @TestGeneric.%ptr.loc19_40.1 (%ptr.4f0b5c.4) = call %bound_method.loc21_22(%addr) -// CHECK:STDOUT: return %.loc21_22 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @TestSpecific(%a.param: %ptr.197) -> %ptr.c28 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref: %ptr.197 = name_ref a, %a -// CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %.loc27_17: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc27_18: type = converted %.loc27_17, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%empty_struct_type)> [concrete = constants.%I.type.399] -// CHECK:STDOUT: %.loc27_19: %I.assoc_type.22c = specific_constant @I.%assoc0.loc8_33.1, @I(constants.%empty_struct_type) [concrete = constants.%assoc0.a7f] -// CHECK:STDOUT: %F.ref: %I.assoc_type.22c = name_ref F, %.loc27_19 [concrete = constants.%assoc0.a7f] -// CHECK:STDOUT: %.loc27_11: ref %A.235 = deref %a.ref -// CHECK:STDOUT: %impl.elem0: %.824 = impl_witness_access constants.%I.impl_witness.915, element0 [concrete = constants.%A.as.I.impl.F.041] -// CHECK:STDOUT: %bound_method.loc27_11: = bound_method %.loc27_11, %impl.elem0 -// CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @A.as.I.impl.F(constants.%empty_struct_type) [concrete = constants.%A.as.I.impl.F.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_23: = bound_method %.loc27_11, %specific_fn -// CHECK:STDOUT: %addr: %ptr.197 = addr_of %.loc27_11 -// CHECK:STDOUT: %A.as.I.impl.F.call: init %ptr.c28 = call %bound_method.loc27_23(%addr) -// CHECK:STDOUT: return %A.as.I.impl.F.call to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.as.I.impl(constants.%V.d9f) { -// CHECK:STDOUT: %V.loc12_14.1 => constants.%V.d9f -// CHECK:STDOUT: %A.loc12_27.1 => constants.%A.2ddf89.2 -// CHECK:STDOUT: %I.type.loc12_35.1 => constants.%I.type.07036d.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete.c94ab4.1 -// CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.0c179e.1 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %A.as.I.impl.F.type => constants.%A.as.I.impl.F.type.2974bf.1 -// CHECK:STDOUT: %A.as.I.impl.F => constants.%A.as.I.impl.F.786476.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.as.I.impl.F(constants.%V.d9f) { -// CHECK:STDOUT: %V => constants.%V.d9f -// CHECK:STDOUT: %A => constants.%A.2ddf89.2 -// CHECK:STDOUT: %ptr.loc13_23.1 => constants.%ptr.6f46b6.1 -// CHECK:STDOUT: %pattern_type.loc13_13 => constants.%pattern_type.2180b5.1 -// CHECK:STDOUT: %ptr.loc13_32.1 => constants.%ptr.4f0b5c.2 -// CHECK:STDOUT: %pattern_type.loc13_28 => constants.%pattern_type.a603a0.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @TestGeneric(constants.%W) { -// CHECK:STDOUT: %W.loc19_16.1 => constants.%W -// CHECK:STDOUT: %A.loc19_32.1 => constants.%A.2ddf89.3 -// CHECK:STDOUT: %ptr.loc19_33.1 => constants.%ptr.6f46b6.2 -// CHECK:STDOUT: %pattern_type.loc19_26 => constants.%pattern_type.2180b5.2 -// CHECK:STDOUT: %ptr.loc19_40.1 => constants.%ptr.4f0b5c.4 -// CHECK:STDOUT: %pattern_type.loc19_36 => constants.%pattern_type.a603a0.4 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.as.I.impl(constants.%W) { -// CHECK:STDOUT: %V.loc12_14.1 => constants.%W -// CHECK:STDOUT: %A.loc12_27.1 => constants.%A.2ddf89.3 -// CHECK:STDOUT: %I.type.loc12_35.1 => constants.%I.type.07036d.3 -// CHECK:STDOUT: %require_complete => constants.%require_complete.c94ab4.2 -// CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.0c179e.2 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %A.as.I.impl.F.type => constants.%A.as.I.impl.F.type.2974bf.2 -// CHECK:STDOUT: %A.as.I.impl.F => constants.%A.as.I.impl.F.786476.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.as.I.impl(constants.%empty_struct_type) { -// CHECK:STDOUT: %V.loc12_14.1 => constants.%empty_struct_type -// CHECK:STDOUT: %A.loc12_27.1 => constants.%A.235 -// CHECK:STDOUT: %I.type.loc12_35.1 => constants.%I.type.399 -// CHECK:STDOUT: %require_complete => constants.%complete_type.e4b -// CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.915 -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %A.as.I.impl.F.type => constants.%A.as.I.impl.F.type.184 -// CHECK:STDOUT: %A.as.I.impl.F => constants.%A.as.I.impl.F.041 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.as.I.impl.F(constants.%empty_struct_type) { -// CHECK:STDOUT: %V => constants.%empty_struct_type -// CHECK:STDOUT: %A => constants.%A.235 -// CHECK:STDOUT: %ptr.loc13_23.1 => constants.%ptr.197 -// CHECK:STDOUT: %pattern_type.loc13_13 => constants.%pattern_type.e47 -// CHECK:STDOUT: %ptr.loc13_32.1 => constants.%ptr.c28 -// CHECK:STDOUT: %pattern_type.loc13_28 => constants.%pattern_type.1cc -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc13_28 => constants.%complete_type.38e -// CHECK:STDOUT: %require_complete.loc13_17 => constants.%complete_type.d27 -// CHECK:STDOUT: %require_complete.loc14 => constants.%complete_type.0a6 -// CHECK:STDOUT: %A.elem => constants.%A.elem.2af -// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.433 -// CHECK:STDOUT: %Copy.facet => constants.%Copy.facet.48c -// CHECK:STDOUT: %.loc14_12.2 => constants.%.fb0 -// CHECK:STDOUT: %impl.elem0.loc14_12.2 => constants.%ptr.as.Copy.impl.Op.15e -// CHECK:STDOUT: %specific_impl_fn.loc14_12.2 => constants.%ptr.as.Copy.impl.Op.specific_fn -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index 9d82940276bf..4ebd9dbdbfc4 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -87,26 +87,6 @@ fn Compound4(V:! L1, y: V, p: V*) { p->(L1.S1)(); } -// --- instance_addr.carbon -library "[[@TEST_NAME]]"; - -interface L1 { - fn R1[self: Self](); - fn S1[addr self: Self*](); -} - -// Simple member access. -fn Simple4(T:! L1, x: T, p: T*) { - x.R1(); - p->S1(); -} - -// This should be equivalent to `Simple4` above, but using compound member access. -fn Compound4(V:! L1, y: V, p: V*) { - y.(L1.R1)(); - p->(L1.S1)(); -} - // --- fail_interface_instance_caller_not.carbon library "[[@TEST_NAME]]"; @@ -150,49 +130,6 @@ fn Compound5(V:! L2) { V.(L2.S2)(); } -// --- fail_interface_instance_caller_not_addr.carbon - -library "[[@TEST_NAME]]"; - -interface L2 { - fn R2[self: Self](); - fn S2[addr self: Self*](); -} - -// Simple member access. Fails since calling an instance method without an object. -fn Simple5(T:! L2) { - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] - // CHECK:STDERR: T.R2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE-9]]:3: note: calling function declared here [InCallToFunction] - // CHECK:STDERR: fn R2[self: Self](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - T.R2(); - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] - // CHECK:STDERR: T.S2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE-16]]:3: note: calling function declared here [InCallToFunction] - // CHECK:STDERR: fn S2[addr self: Self*](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - T.S2(); -} - -// TODO: Expected to fail in the same way as `Simple5`. -fn Compound5(V:! L2) { - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.R2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: - V.(L2.R2)(); - // CHECK:STDERR: fail_interface_instance_caller_not_addr.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.S2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: - V.(L2.S2)(); -} - // --- fail_combine_non_instance.carbon library "[[@TEST_NAME]]"; @@ -1022,329 +959,6 @@ fn Works() { // CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- instance_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %L1.type: type = facet_type <@L1> [concrete] -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.1: type = pattern_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %L1.R1.type: type = fn_type @L1.R1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %L1.R1: %L1.R1.type = struct_value () [concrete] -// CHECK:STDOUT: %L1.assoc_type: type = assoc_entity_type @L1 [concrete] -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, @L1.%L1.R1.decl [concrete] -// CHECK:STDOUT: %ptr.5db4e7.1: type = ptr_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.f1f60b.1: type = pattern_type %ptr.5db4e7.1 [symbolic] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %L1.S1.type: type = fn_type @L1.S1 [concrete] -// CHECK:STDOUT: %L1.S1: %L1.S1.type = struct_value () [concrete] -// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, @L1.%L1.S1.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %L1.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.e3e: type = pattern_type %L1.type [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.2: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %ptr.5db4e7.2: type = ptr_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.f1f60b.2: type = pattern_type %ptr.5db4e7.2 [symbolic] -// CHECK:STDOUT: %Simple4.type: type = fn_type @Simple4 [concrete] -// CHECK:STDOUT: %Simple4: %Simple4.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.b98a62.1: = require_complete_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %require_complete.80837b.1: = require_complete_type %ptr.5db4e7.2 [symbolic] -// CHECK:STDOUT: %L1.lookup_impl_witness.497b38.1: = lookup_impl_witness %T, @L1 [symbolic] -// CHECK:STDOUT: %.2c3978.1: type = fn_type_with_self_type %L1.R1.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0.d3a613.1: %.2c3978.1 = impl_witness_access %L1.lookup_impl_witness.497b38.1, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.f8ac37.1: = specific_impl_function %impl.elem0.d3a613.1, @L1.R1(%T) [symbolic] -// CHECK:STDOUT: %.45c8db.1: type = fn_type_with_self_type %L1.S1.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem1.c3a14a.1: %.45c8db.1 = impl_witness_access %L1.lookup_impl_witness.497b38.1, element1 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.c2ec1e.1: = specific_impl_function %impl.elem1.c3a14a.1, @L1.S1(%T) [symbolic] -// CHECK:STDOUT: %V: %L1.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.3: type = pattern_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %ptr.5db4e7.3: type = ptr_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.f1f60b.3: type = pattern_type %ptr.5db4e7.3 [symbolic] -// CHECK:STDOUT: %Compound4.type: type = fn_type @Compound4 [concrete] -// CHECK:STDOUT: %Compound4: %Compound4.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.b98a62.2: = require_complete_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %require_complete.80837b.2: = require_complete_type %ptr.5db4e7.3 [symbolic] -// CHECK:STDOUT: %L1.lookup_impl_witness.497b38.2: = lookup_impl_witness %V, @L1 [symbolic] -// CHECK:STDOUT: %.2c3978.2: type = fn_type_with_self_type %L1.R1.type, %V [symbolic] -// CHECK:STDOUT: %impl.elem0.d3a613.2: %.2c3978.2 = impl_witness_access %L1.lookup_impl_witness.497b38.2, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.f8ac37.2: = specific_impl_function %impl.elem0.d3a613.2, @L1.R1(%V) [symbolic] -// CHECK:STDOUT: %.45c8db.2: type = fn_type_with_self_type %L1.S1.type, %V [symbolic] -// CHECK:STDOUT: %impl.elem1.c3a14a.2: %.45c8db.2 = impl_witness_access %L1.lookup_impl_witness.497b38.2, element1 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.c2ec1e.2: = specific_impl_function %impl.elem1.c3a14a.2, @L1.S1(%V) [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .L1 = %L1.decl -// CHECK:STDOUT: .Simple4 = %Simple4.decl -// CHECK:STDOUT: .Compound4 = %Compound4.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %L1.decl: type = interface_decl @L1 [concrete = constants.%L1.type] {} {} -// CHECK:STDOUT: %Simple4.decl: %Simple4.type = fn_decl @Simple4 [concrete = constants.%Simple4] { -// CHECK:STDOUT: %T.patt: %pattern_type.e3e = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: %x.patt: @Simple4.%pattern_type.loc9_20 (%pattern_type.510a66.2) = value_binding_pattern x [concrete] -// CHECK:STDOUT: %x.param_patt: @Simple4.%pattern_type.loc9_20 (%pattern_type.510a66.2) = value_param_pattern %x.patt, call_param0 [concrete] -// CHECK:STDOUT: %p.patt: @Simple4.%pattern_type.loc9_26 (%pattern_type.f1f60b.2) = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: @Simple4.%pattern_type.loc9_26 (%pattern_type.f1f60b.2) = value_param_pattern %p.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_16: type = splice_block %L1.ref [concrete = constants.%L1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L1.ref: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_12.2: %L1.type = symbolic_binding T, 0 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %x.param: @Simple4.%T.binding.as_type (%T.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc9_23.1: type = splice_block %.loc9_23.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] { -// CHECK:STDOUT: %T.ref.loc9_23: %L1.type = name_ref T, %T.loc9_12.2 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc9_23: type = facet_access_type %T.ref.loc9_23 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc9_23.2: type = converted %T.ref.loc9_23, %T.as_type.loc9_23 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x: @Simple4.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param -// CHECK:STDOUT: %p.param: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.2) = value_param call_param1 -// CHECK:STDOUT: %.loc9_30.1: type = splice_block %ptr.loc9_30.2 [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.2)] { -// CHECK:STDOUT: %T.ref.loc9_29: %L1.type = name_ref T, %T.loc9_12.2 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc9_30: type = facet_access_type %T.ref.loc9_29 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc9_30.2: type = converted %T.ref.loc9_29, %T.as_type.loc9_30 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %ptr.loc9_30.2: type = ptr_type %.loc9_30.2 [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.2)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.2) = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound4.decl: %Compound4.type = fn_decl @Compound4 [concrete = constants.%Compound4] { -// CHECK:STDOUT: %V.patt: %pattern_type.e3e = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: %y.patt: @Compound4.%pattern_type.loc15_22 (%pattern_type.510a66.3) = value_binding_pattern y [concrete] -// CHECK:STDOUT: %y.param_patt: @Compound4.%pattern_type.loc15_22 (%pattern_type.510a66.3) = value_param_pattern %y.patt, call_param0 [concrete] -// CHECK:STDOUT: %p.patt: @Compound4.%pattern_type.loc15_28 (%pattern_type.f1f60b.3) = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: @Compound4.%pattern_type.loc15_28 (%pattern_type.f1f60b.3) = value_param_pattern %p.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15_18: type = splice_block %L1.ref.loc15 [concrete = constants.%L1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L1.ref.loc15: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc15_14.2: %L1.type = symbolic_binding V, 0 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %y.param: @Compound4.%V.binding.as_type (%V.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc15_25.1: type = splice_block %.loc15_25.2 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] { -// CHECK:STDOUT: %V.ref.loc15_25: %L1.type = name_ref V, %V.loc15_14.2 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc15_25: type = facet_access_type %V.ref.loc15_25 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %.loc15_25.2: type = converted %V.ref.loc15_25, %V.as_type.loc15_25 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %y: @Compound4.%V.binding.as_type (%V.binding.as_type) = value_binding y, %y.param -// CHECK:STDOUT: %p.param: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.3) = value_param call_param1 -// CHECK:STDOUT: %.loc15_32.1: type = splice_block %ptr.loc15_32.2 [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.3)] { -// CHECK:STDOUT: %V.ref.loc15_31: %L1.type = name_ref V, %V.loc15_14.2 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc15_32: type = facet_access_type %V.ref.loc15_31 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %.loc15_32.2: type = converted %V.ref.loc15_31, %V.as_type.loc15_32 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %ptr.loc15_32.2: type = ptr_type %.loc15_32.2 [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.3)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.3) = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @L1 { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %L1.R1.decl: %L1.R1.type = fn_decl @L1.R1 [concrete = constants.%L1.R1] { -// CHECK:STDOUT: %self.patt: @L1.R1.%pattern_type (%pattern_type.510a66.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L1.R1.%pattern_type (%pattern_type.510a66.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L1.R1.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L1.R1.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %L1.R1.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: %L1.S1.decl: %L1.S1.type = fn_decl @L1.S1 [concrete = constants.%L1.S1] { -// CHECK:STDOUT: %self.patt: @L1.S1.%pattern_type (%pattern_type.f1f60b.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L1.S1.%pattern_type (%pattern_type.f1f60b.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc5_9: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L1.S1.%ptr.loc5_24.1 (%ptr.5db4e7.1) = value_param call_param0 -// CHECK:STDOUT: %.loc5_24.1: type = splice_block %ptr.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr.5db4e7.1)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %ptr.loc5_24.2: type = ptr_type %.loc5_24.2 [symbolic = %ptr.loc5_24.1 (constants.%ptr.5db4e7.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L1.S1.%ptr.loc5_24.1 (%ptr.5db4e7.1) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, %L1.S1.decl [concrete = constants.%assoc1] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .R1 = %assoc0 -// CHECK:STDOUT: .S1 = %assoc1 -// CHECK:STDOUT: witness = (%L1.R1.decl, %L1.S1.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L1.R1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.510a66.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L1.R1.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L1.S1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %ptr.loc5_24.1: type = ptr_type %Self.binding.as_type [symbolic = %ptr.loc5_24.1 (constants.%ptr.5db4e7.1)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc5_24.1 [symbolic = %pattern_type (constants.%pattern_type.f1f60b.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L1.S1.%ptr.loc5_24.1 (%ptr.5db4e7.1)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple4(%T.loc9_12.2: %L1.type) { -// CHECK:STDOUT: %T.loc9_12.1: %L1.type = symbolic_binding T, 0 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc9_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %pattern_type.loc9_20: type = pattern_type %T.binding.as_type [symbolic = %pattern_type.loc9_20 (constants.%pattern_type.510a66.2)] -// CHECK:STDOUT: %ptr.loc9_30.1: type = ptr_type %T.binding.as_type [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.2)] -// CHECK:STDOUT: %pattern_type.loc9_26: type = pattern_type %ptr.loc9_30.1 [symbolic = %pattern_type.loc9_26 (constants.%pattern_type.f1f60b.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc9_21: = require_complete_type %T.binding.as_type [symbolic = %require_complete.loc9_21 (constants.%require_complete.b98a62.1)] -// CHECK:STDOUT: %require_complete.loc9_27: = require_complete_type %ptr.loc9_30.1 [symbolic = %require_complete.loc9_27 (constants.%require_complete.80837b.1)] -// CHECK:STDOUT: %L1.lookup_impl_witness: = lookup_impl_witness %T.loc9_12.1, @L1 [symbolic = %L1.lookup_impl_witness (constants.%L1.lookup_impl_witness.497b38.1)] -// CHECK:STDOUT: %.loc10_4: type = fn_type_with_self_type constants.%L1.R1.type, %T.loc9_12.1 [symbolic = %.loc10_4 (constants.%.2c3978.1)] -// CHECK:STDOUT: %impl.elem0.loc10_4.2: @Simple4.%.loc10_4 (%.2c3978.1) = impl_witness_access %L1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0.d3a613.1)] -// CHECK:STDOUT: %specific_impl_fn.loc10_4.2: = specific_impl_function %impl.elem0.loc10_4.2, @L1.R1(%T.loc9_12.1) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn.f8ac37.1)] -// CHECK:STDOUT: %.loc11_4.2: type = fn_type_with_self_type constants.%L1.S1.type, %T.loc9_12.1 [symbolic = %.loc11_4.2 (constants.%.45c8db.1)] -// CHECK:STDOUT: %impl.elem1.loc11_4.2: @Simple4.%.loc11_4.2 (%.45c8db.1) = impl_witness_access %L1.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc11_4.2 (constants.%impl.elem1.c3a14a.1)] -// CHECK:STDOUT: %specific_impl_fn.loc11_4.2: = specific_impl_function %impl.elem1.loc11_4.2, @L1.S1(%T.loc9_12.1) [symbolic = %specific_impl_fn.loc11_4.2 (constants.%specific_impl_fn.c2ec1e.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @Simple4.%T.binding.as_type (%T.binding.as_type), %p.param: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.2)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Simple4.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_4.1: @Simple4.%.loc10_4 (%.2c3978.1) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.1, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0.d3a613.1)] -// CHECK:STDOUT: %bound_method.loc10_4: = bound_method %x.ref, %impl.elem0.loc10_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc10_4.1: = specific_impl_function %impl.elem0.loc10_4.1, @L1.R1(constants.%T) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn.f8ac37.1)] -// CHECK:STDOUT: %bound_method.loc10_8: = bound_method %x.ref, %specific_impl_fn.loc10_4.1 -// CHECK:STDOUT: %.loc10_8: init %empty_tuple.type = call %bound_method.loc10_8(%x.ref) -// CHECK:STDOUT: %p.ref: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.2) = name_ref p, %p -// CHECK:STDOUT: %.loc11_4.1: ref @Simple4.%T.binding.as_type (%T.binding.as_type) = deref %p.ref -// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_4.1: @Simple4.%.loc11_4.2 (%.45c8db.1) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.1, element1 [symbolic = %impl.elem1.loc11_4.2 (constants.%impl.elem1.c3a14a.1)] -// CHECK:STDOUT: %bound_method.loc11_4: = bound_method %.loc11_4.1, %impl.elem1.loc11_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc11_4.1: = specific_impl_function %impl.elem1.loc11_4.1, @L1.S1(constants.%T) [symbolic = %specific_impl_fn.loc11_4.2 (constants.%specific_impl_fn.c2ec1e.1)] -// CHECK:STDOUT: %bound_method.loc11_9: = bound_method %.loc11_4.1, %specific_impl_fn.loc11_4.1 -// CHECK:STDOUT: %addr: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.2) = addr_of %.loc11_4.1 -// CHECK:STDOUT: %.loc11_9: init %empty_tuple.type = call %bound_method.loc11_9(%addr) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound4(%V.loc15_14.2: %L1.type) { -// CHECK:STDOUT: %V.loc15_14.1: %L1.type = symbolic_binding V, 0 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V.loc15_14.1 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %pattern_type.loc15_22: type = pattern_type %V.binding.as_type [symbolic = %pattern_type.loc15_22 (constants.%pattern_type.510a66.3)] -// CHECK:STDOUT: %ptr.loc15_32.1: type = ptr_type %V.binding.as_type [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.3)] -// CHECK:STDOUT: %pattern_type.loc15_28: type = pattern_type %ptr.loc15_32.1 [symbolic = %pattern_type.loc15_28 (constants.%pattern_type.f1f60b.3)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc15_23: = require_complete_type %V.binding.as_type [symbolic = %require_complete.loc15_23 (constants.%require_complete.b98a62.2)] -// CHECK:STDOUT: %require_complete.loc15_29: = require_complete_type %ptr.loc15_32.1 [symbolic = %require_complete.loc15_29 (constants.%require_complete.80837b.2)] -// CHECK:STDOUT: %L1.lookup_impl_witness: = lookup_impl_witness %V.loc15_14.1, @L1 [symbolic = %L1.lookup_impl_witness (constants.%L1.lookup_impl_witness.497b38.2)] -// CHECK:STDOUT: %.loc16_4: type = fn_type_with_self_type constants.%L1.R1.type, %V.loc15_14.1 [symbolic = %.loc16_4 (constants.%.2c3978.2)] -// CHECK:STDOUT: %impl.elem0.loc16_4.2: @Compound4.%.loc16_4 (%.2c3978.2) = impl_witness_access %L1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0.d3a613.2)] -// CHECK:STDOUT: %specific_impl_fn.loc16_4.2: = specific_impl_function %impl.elem0.loc16_4.2, @L1.R1(%V.loc15_14.1) [symbolic = %specific_impl_fn.loc16_4.2 (constants.%specific_impl_fn.f8ac37.2)] -// CHECK:STDOUT: %.loc17_4.2: type = fn_type_with_self_type constants.%L1.S1.type, %V.loc15_14.1 [symbolic = %.loc17_4.2 (constants.%.45c8db.2)] -// CHECK:STDOUT: %impl.elem1.loc17_4.2: @Compound4.%.loc17_4.2 (%.45c8db.2) = impl_witness_access %L1.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc17_4.2 (constants.%impl.elem1.c3a14a.2)] -// CHECK:STDOUT: %specific_impl_fn.loc17_4.2: = specific_impl_function %impl.elem1.loc17_4.2, @L1.S1(%V.loc15_14.1) [symbolic = %specific_impl_fn.loc17_4.2 (constants.%specific_impl_fn.c2ec1e.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%y.param: @Compound4.%V.binding.as_type (%V.binding.as_type), %p.param: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.3)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %y.ref: @Compound4.%V.binding.as_type (%V.binding.as_type) = name_ref y, %y -// CHECK:STDOUT: %L1.ref.loc16: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc16_4.1: @Compound4.%.loc16_4 (%.2c3978.2) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.2, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0.d3a613.2)] -// CHECK:STDOUT: %bound_method.loc16_4: = bound_method %y.ref, %impl.elem0.loc16_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc16_4.1: = specific_impl_function %impl.elem0.loc16_4.1, @L1.R1(constants.%V) [symbolic = %specific_impl_fn.loc16_4.2 (constants.%specific_impl_fn.f8ac37.2)] -// CHECK:STDOUT: %bound_method.loc16_13: = bound_method %y.ref, %specific_impl_fn.loc16_4.1 -// CHECK:STDOUT: %.loc16_13: init %empty_tuple.type = call %bound_method.loc16_13(%y.ref) -// CHECK:STDOUT: %p.ref: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.3) = name_ref p, %p -// CHECK:STDOUT: %L1.ref.loc17: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc17_4.1: ref @Compound4.%V.binding.as_type (%V.binding.as_type) = deref %p.ref -// CHECK:STDOUT: %impl.elem1.loc17_4.1: @Compound4.%.loc17_4.2 (%.45c8db.2) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.2, element1 [symbolic = %impl.elem1.loc17_4.2 (constants.%impl.elem1.c3a14a.2)] -// CHECK:STDOUT: %bound_method.loc17_4: = bound_method %.loc17_4.1, %impl.elem1.loc17_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc17_4.1: = specific_impl_function %impl.elem1.loc17_4.1, @L1.S1(constants.%V) [symbolic = %specific_impl_fn.loc17_4.2 (constants.%specific_impl_fn.c2ec1e.2)] -// CHECK:STDOUT: %bound_method.loc17_14: = bound_method %.loc17_4.1, %specific_impl_fn.loc17_4.1 -// CHECK:STDOUT: %addr: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.3) = addr_of %.loc17_4.1 -// CHECK:STDOUT: %.loc17_14: init %empty_tuple.type = call %bound_method.loc17_14(%addr) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.5db4e7.1 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.f1f60b.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple4(constants.%T) { -// CHECK:STDOUT: %T.loc9_12.1 => constants.%T -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type.loc9_20 => constants.%pattern_type.510a66.2 -// CHECK:STDOUT: %ptr.loc9_30.1 => constants.%ptr.5db4e7.2 -// CHECK:STDOUT: %pattern_type.loc9_26 => constants.%pattern_type.f1f60b.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.5db4e7.2 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.f1f60b.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound4(constants.%V) { -// CHECK:STDOUT: %V.loc15_14.1 => constants.%V -// CHECK:STDOUT: %V.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type.loc15_22 => constants.%pattern_type.510a66.3 -// CHECK:STDOUT: %ptr.loc15_32.1 => constants.%ptr.5db4e7.3 -// CHECK:STDOUT: %pattern_type.loc15_28 => constants.%pattern_type.f1f60b.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%V) { -// CHECK:STDOUT: %Self => constants.%V -// CHECK:STDOUT: %Self.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%V) { -// CHECK:STDOUT: %Self => constants.%V -// CHECK:STDOUT: %Self.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %ptr.loc5_24.1 => constants.%ptr.5db4e7.3 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.f1f60b.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_interface_instance_caller_not.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -1552,224 +1166,6 @@ fn Works() { // CHECK:STDOUT: %V.loc30_14.1 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_interface_instance_caller_not_addr.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %L2.type: type = facet_type <@L2> [concrete] -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic] -// CHECK:STDOUT: %pattern_type.c87c75.1: type = pattern_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %L2.R2.type: type = fn_type @L2.R2 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %L2.R2: %L2.R2.type = struct_value () [concrete] -// CHECK:STDOUT: %L2.assoc_type: type = assoc_entity_type @L2 [concrete] -// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, @L2.%L2.R2.decl [concrete] -// CHECK:STDOUT: %ptr.707d07.1: type = ptr_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.2fa31b.1: type = pattern_type %ptr.707d07.1 [symbolic] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %L2.S2.type: type = fn_type @L2.S2 [concrete] -// CHECK:STDOUT: %L2.S2: %L2.S2.type = struct_value () [concrete] -// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, @L2.%L2.S2.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %L2.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.38f: type = pattern_type %L2.type [concrete] -// CHECK:STDOUT: %Simple5.type: type = fn_type @Simple5 [concrete] -// CHECK:STDOUT: %Simple5: %Simple5.type = struct_value () [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T, @L2 [symbolic] -// CHECK:STDOUT: %.6fc: type = fn_type_with_self_type %L2.R2.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0: %.6fc = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic] -// CHECK:STDOUT: %pattern_type.c87c75.2: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %specific_impl_fn.a65: = specific_impl_function %impl.elem0, @L2.R2(%T) [symbolic] -// CHECK:STDOUT: %.0b4: type = fn_type_with_self_type %L2.S2.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem1: %.0b4 = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic] -// CHECK:STDOUT: %ptr.707d07.2: type = ptr_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.2fa31b.2: type = pattern_type %ptr.707d07.2 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.b7b: = specific_impl_function %impl.elem1, @L2.S2(%T) [symbolic] -// CHECK:STDOUT: %V: %L2.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %Compound5.type: type = fn_type @Compound5 [concrete] -// CHECK:STDOUT: %Compound5: %Compound5.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .L2 = %L2.decl -// CHECK:STDOUT: .Simple5 = %Simple5.decl -// CHECK:STDOUT: .Compound5 = %Compound5.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %L2.decl: type = interface_decl @L2 [concrete = constants.%L2.type] {} {} -// CHECK:STDOUT: %Simple5.decl: %Simple5.type = fn_decl @Simple5 [concrete = constants.%Simple5] { -// CHECK:STDOUT: %T.patt: %pattern_type.38f = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %L2.ref [concrete = constants.%L2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L2.ref: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_12.2: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound5.decl: %Compound5.type = fn_decl @Compound5 [concrete = constants.%Compound5] { -// CHECK:STDOUT: %V.patt: %pattern_type.38f = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc30: type = splice_block %L2.ref.loc30 [concrete = constants.%L2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L2.ref.loc30: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc30_14.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @L2 { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %L2.R2.decl: %L2.R2.type = fn_decl @L2.R2 [concrete = constants.%L2.R2] { -// CHECK:STDOUT: %self.patt: @L2.R2.%pattern_type (%pattern_type.c87c75.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L2.R2.%pattern_type (%pattern_type.c87c75.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L2.R2.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L2.R2.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, %L2.R2.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: %L2.S2.decl: %L2.S2.type = fn_decl @L2.S2 [concrete = constants.%L2.S2] { -// CHECK:STDOUT: %self.patt: @L2.S2.%pattern_type (%pattern_type.2fa31b.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L2.S2.%pattern_type (%pattern_type.2fa31b.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc6_9: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L2.S2.%ptr.loc6_24.1 (%ptr.707d07.1) = value_param call_param0 -// CHECK:STDOUT: %.loc6_24.1: type = splice_block %ptr.loc6_24.2 [symbolic = %ptr.loc6_24.1 (constants.%ptr.707d07.1)] { -// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc6_24.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %ptr.loc6_24.2: type = ptr_type %.loc6_24.2 [symbolic = %ptr.loc6_24.1 (constants.%ptr.707d07.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L2.S2.%ptr.loc6_24.1 (%ptr.707d07.1) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, %L2.S2.decl [concrete = constants.%assoc1] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .R2 = %assoc0 -// CHECK:STDOUT: .S2 = %assoc1 -// CHECK:STDOUT: witness = (%L2.R2.decl, %L2.S2.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L2.R2(@L2.%Self: %L2.type) { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.c87c75.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L2.R2.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L2.S2(@L2.%Self: %L2.type) { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %ptr.loc6_24.1: type = ptr_type %Self.binding.as_type [symbolic = %ptr.loc6_24.1 (constants.%ptr.707d07.1)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc6_24.1 [symbolic = %pattern_type (constants.%pattern_type.2fa31b.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L2.S2.%ptr.loc6_24.1 (%ptr.707d07.1)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple5(%T.loc10_12.2: %L2.type) { -// CHECK:STDOUT: %T.loc10_12.1: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc10_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T.loc10_12.1, @L2 [symbolic = %L2.lookup_impl_witness (constants.%L2.lookup_impl_witness)] -// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type constants.%L2.R2.type, %T.loc10_12.1 [symbolic = %.loc18_4.2 (constants.%.6fc)] -// CHECK:STDOUT: %impl.elem0.loc18_4.2: @Simple5.%.loc18_4.2 (%.6fc) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc18_4.2: = specific_impl_function %impl.elem0.loc18_4.2, @L2.R2(%T.loc10_12.1) [symbolic = %specific_impl_fn.loc18_4.2 (constants.%specific_impl_fn.a65)] -// CHECK:STDOUT: %.loc26_4.2: type = fn_type_with_self_type constants.%L2.S2.type, %T.loc10_12.1 [symbolic = %.loc26_4.2 (constants.%.0b4)] -// CHECK:STDOUT: %impl.elem1.loc26_4.2: @Simple5.%.loc26_4.2 (%.0b4) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] -// CHECK:STDOUT: %specific_impl_fn.loc26_4.2: = specific_impl_function %impl.elem1.loc26_4.2, @L2.S2(%T.loc10_12.1) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.b7b)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_12.2 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem0.loc18_4.1: @Simple5.%.loc18_4.2 (%.6fc) = impl_witness_access constants.%L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc18_4.1: = specific_impl_function %impl.elem0.loc18_4.1, @L2.R2(constants.%T) [symbolic = %specific_impl_fn.loc18_4.2 (constants.%specific_impl_fn.a65)] -// CHECK:STDOUT: %.loc18_8: init %empty_tuple.type = call %specific_impl_fn.loc18_4.1() [concrete = ] -// CHECK:STDOUT: %T.ref.loc26: %L2.type = name_ref T, %T.loc10_12.2 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %T.as_type.loc26: type = facet_access_type %T.ref.loc26 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc26_4.1: type = converted %T.ref.loc26, %T.as_type.loc26 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem1.loc26_4.1: @Simple5.%.loc26_4.2 (%.0b4) = impl_witness_access constants.%L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] -// CHECK:STDOUT: %specific_impl_fn.loc26_4.1: = specific_impl_function %impl.elem1.loc26_4.1, @L2.S2(constants.%T) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.b7b)] -// CHECK:STDOUT: %addr: = addr_of [concrete = ] -// CHECK:STDOUT: %.loc26_8: init %empty_tuple.type = call %specific_impl_fn.loc26_4.1() [concrete = ] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound5(%V.loc30_14.2: %L2.type) { -// CHECK:STDOUT: %V.loc30_14.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %V.ref.loc35: %L2.type = name_ref V, %V.loc30_14.2 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc35: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.ref.loc40: %L2.type = name_ref V, %V.loc30_14.2 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc40: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.R2(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.S2(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %ptr.loc6_24.1 => constants.%ptr.707d07.1 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.2fa31b.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple5(constants.%T) { -// CHECK:STDOUT: %T.loc10_12.1 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.R2(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.S2(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %ptr.loc6_24.1 => constants.%ptr.707d07.2 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.2fa31b.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound5(constants.%V) { -// CHECK:STDOUT: %V.loc30_14.1 => constants.%V -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_combine_non_instance.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/interface/compound_member_access_addr.carbon b/toolchain/check/testdata/interface/compound_member_access_addr.carbon deleted file mode 100644 index b0edfe3f3387..000000000000 --- a/toolchain/check/testdata/interface/compound_member_access_addr.carbon +++ /dev/null @@ -1,1513 +0,0 @@ -// 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/convert.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/interface/compound_member_access_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/compound_member_access_addr.carbon - -// --- associated_constant.carbon -library "[[@TEST_NAME]]"; - -interface J { - let U:! type; -} - -// Simple member access. -fn Simple1(T:! J, S:! T.U) {} - -// This should be equivalent to `Simple1` above, but using compound member access. -fn Compound1(V:! J, W:! V.(J.U)) {} - -// --- non_instance.carbon -library "[[@TEST_NAME]]"; - -interface K1 { - fn Q1(); -} - -// Simple member access. -fn Simple2(T:! K1) { - T.Q1(); -} - -// This should be equivalent to `Simple2` above, but using compound member access. -fn Compound2(V:! K1) { - V.(K1.Q1)(); -} - -// --- fail_caller_instance_interface_not.carbon -library "[[@TEST_NAME]]"; - -interface K2 { - fn Q2(); -} - -// Simple member access allows this. -fn Simple3(T:! K2, x: T) { - x.Q2(); -} - -// Compound member access does not. It tries to convert `y` to `K2`, but only -// its type `V` can. -fn Compound3(V:! K2, y: V) { - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `V` into type implementing `K2` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: y.(K2.Q2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+4]]:3: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: y.(K2.Q2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: - y.(K2.Q2)(); -} - -// --- instance.carbon -library "[[@TEST_NAME]]"; - -interface L1 { - fn R1[self: Self](); - fn S1[ref self: Self](); -} - -// Simple member access. -fn Simple4(T:! L1, x: T, p: T*) { - x.R1(); - p->S1(); -} - -// This should be equivalent to `Simple4` above, but using compound member access. -fn Compound4(V:! L1, y: V, p: V*) { - y.(L1.R1)(); - p->(L1.S1)(); -} - -// --- fail_interface_instance_caller_not.carbon - -library "[[@TEST_NAME]]"; - -interface L2 { - fn R2[self: Self](); - fn S2[ref self: Self](); -} - -// Simple member access. Fails since calling an instance method without an object. -fn Simple5(T:! L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] - // CHECK:STDERR: T.R2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-9]]:3: note: calling function declared here [InCallToFunction] - // CHECK:STDERR: fn R2[self: Self](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - T.R2(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall] - // CHECK:STDERR: T.S2(); - // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-16]]:3: note: calling function declared here [InCallToFunction] - // CHECK:STDERR: fn S2[ref self: Self](); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - T.S2(); -} - -// TODO: Expected to fail in the same way as `Simple5`. -fn Compound5(V:! L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.R2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: - V.(L2.R2)(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+4]]:3: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] - // CHECK:STDERR: V.(L2.S2)(); - // CHECK:STDERR: ^~~~~~~~~ - // CHECK:STDERR: - V.(L2.S2)(); -} - -// --- fail_combine_non_instance.carbon -library "[[@TEST_NAME]]"; - -interface A { - fn G(); -} - -class C {} -impl C as A { - fn G() {} -} - -// Since `A.G` is a non-instance method, compound member access may only be -// used with a type, not an instance. -fn Fails() { - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - ({} as C).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+4]]:3: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: - (({} as C) as (C as (A & A))).(A.G)(); -} - -// --- allowed_combine_non_instance.carbon -library "[[@TEST_NAME]]"; - -interface A { - fn G(); -} - -class C {} -impl C as A { - fn G() {} -} - -fn Works() { - C.((A & A).G)(); - (C as (A & A)).((A & A).G)(); - (C as (A & A)).(A.G)(); -} - -// CHECK:STDOUT: --- associated_constant.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete] -// CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type @J [concrete] -// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %J.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.84b: type = pattern_type %J.type [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %J.lookup_impl_witness.cd2552.1: = lookup_impl_witness %T, @J [symbolic] -// CHECK:STDOUT: %impl.elem0.fa9e71.1: type = impl_witness_access %J.lookup_impl_witness.cd2552.1, element0 [symbolic] -// CHECK:STDOUT: %S: %impl.elem0.fa9e71.1 = symbolic_binding S, 1 [symbolic] -// CHECK:STDOUT: %pattern_type.345548.1: type = pattern_type %impl.elem0.fa9e71.1 [symbolic] -// CHECK:STDOUT: %Simple1.type: type = fn_type @Simple1 [concrete] -// CHECK:STDOUT: %Simple1: %Simple1.type = struct_value () [concrete] -// CHECK:STDOUT: %V: %J.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %J.lookup_impl_witness.cd2552.2: = lookup_impl_witness %V, @J [symbolic] -// CHECK:STDOUT: %impl.elem0.fa9e71.2: type = impl_witness_access %J.lookup_impl_witness.cd2552.2, element0 [symbolic] -// CHECK:STDOUT: %W: %impl.elem0.fa9e71.2 = symbolic_binding W, 1 [symbolic] -// CHECK:STDOUT: %pattern_type.345548.2: type = pattern_type %impl.elem0.fa9e71.2 [symbolic] -// CHECK:STDOUT: %Compound1.type: type = fn_type @Compound1 [concrete] -// CHECK:STDOUT: %Compound1: %Compound1.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .J = %J.decl -// CHECK:STDOUT: .Simple1 = %Simple1.decl -// CHECK:STDOUT: .Compound1 = %Compound1.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} -// CHECK:STDOUT: %Simple1.decl: %Simple1.type = fn_decl @Simple1 [concrete = constants.%Simple1] { -// CHECK:STDOUT: %T.patt: %pattern_type.84b = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: %S.patt: @Simple1.%pattern_type (%pattern_type.345548.1) = symbolic_binding_pattern S, 1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_16: type = splice_block %J.ref [concrete = constants.%J.type] { -// CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_12.2: %J.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %.loc8_24.1: type = splice_block %impl.elem0.loc8_24.2 [symbolic = %impl.elem0.loc8_24.1 (constants.%impl.elem0.fa9e71.1)] { -// CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %T.ref: %J.type = name_ref T, %T.loc8_12.2 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc8_24.2: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem0.loc8_24.2: type = impl_witness_access constants.%J.lookup_impl_witness.cd2552.1, element0 [symbolic = %impl.elem0.loc8_24.1 (constants.%impl.elem0.fa9e71.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %S.loc8_19.2: @Simple1.%impl.elem0.loc8_24.1 (%impl.elem0.fa9e71.1) = symbolic_binding S, 1 [symbolic = %S.loc8_19.1 (constants.%S)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound1.decl: %Compound1.type = fn_decl @Compound1 [concrete = constants.%Compound1] { -// CHECK:STDOUT: %V.patt: %pattern_type.84b = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: %W.patt: @Compound1.%pattern_type (%pattern_type.345548.2) = symbolic_binding_pattern W, 1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_18: type = splice_block %J.ref.loc11_18 [concrete = constants.%J.type] { -// CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %J.ref.loc11_18: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc11_14.2: %J.type = symbolic_binding V, 0 [symbolic = %V.loc11_14.1 (constants.%V)] -// CHECK:STDOUT: %.loc11_26: type = splice_block %impl.elem0.loc11_26.2 [symbolic = %impl.elem0.loc11_26.1 (constants.%impl.elem0.fa9e71.2)] { -// CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %V.ref: %J.type = name_ref V, %V.loc11_14.2 [symbolic = %V.loc11_14.1 (constants.%V)] -// CHECK:STDOUT: %J.ref.loc11_28: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_26.2: type = impl_witness_access constants.%J.lookup_impl_witness.cd2552.2, element0 [symbolic = %impl.elem0.loc11_26.1 (constants.%impl.elem0.fa9e71.2)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %W.loc11_21.2: @Compound1.%impl.elem0.loc11_26.1 (%impl.elem0.fa9e71.2) = symbolic_binding W, 1 [symbolic = %W.loc11_21.1 (constants.%W)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @J { -// CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %U: type = assoc_const_decl @U [concrete] { -// CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [concrete = constants.%assoc0] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .U = @U.%assoc0 -// CHECK:STDOUT: witness = (%U) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic assoc_const @U(@J.%Self: %J.type) { -// CHECK:STDOUT: assoc_const U:! type; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple1(%T.loc8_12.2: %J.type, %S.loc8_19.2: @Simple1.%impl.elem0.loc8_24.1 (%impl.elem0.fa9e71.1)) { -// CHECK:STDOUT: %T.loc8_12.1: %J.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc8_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %J.lookup_impl_witness: = lookup_impl_witness %T.loc8_12.1, @J [symbolic = %J.lookup_impl_witness (constants.%J.lookup_impl_witness.cd2552.1)] -// CHECK:STDOUT: %impl.elem0.loc8_24.1: type = impl_witness_access %J.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc8_24.1 (constants.%impl.elem0.fa9e71.1)] -// CHECK:STDOUT: %S.loc8_19.1: @Simple1.%impl.elem0.loc8_24.1 (%impl.elem0.fa9e71.1) = symbolic_binding S, 1 [symbolic = %S.loc8_19.1 (constants.%S)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %impl.elem0.loc8_24.1 [symbolic = %pattern_type (constants.%pattern_type.345548.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound1(%V.loc11_14.2: %J.type, %W.loc11_21.2: @Compound1.%impl.elem0.loc11_26.1 (%impl.elem0.fa9e71.2)) { -// CHECK:STDOUT: %V.loc11_14.1: %J.type = symbolic_binding V, 0 [symbolic = %V.loc11_14.1 (constants.%V)] -// CHECK:STDOUT: %J.lookup_impl_witness: = lookup_impl_witness %V.loc11_14.1, @J [symbolic = %J.lookup_impl_witness (constants.%J.lookup_impl_witness.cd2552.2)] -// CHECK:STDOUT: %impl.elem0.loc11_26.1: type = impl_witness_access %J.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_26.1 (constants.%impl.elem0.fa9e71.2)] -// CHECK:STDOUT: %W.loc11_21.1: @Compound1.%impl.elem0.loc11_26.1 (%impl.elem0.fa9e71.2) = symbolic_binding W, 1 [symbolic = %W.loc11_21.1 (constants.%W)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %impl.elem0.loc11_26.1 [symbolic = %pattern_type (constants.%pattern_type.345548.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%Self) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple1(constants.%T, constants.%S) { -// CHECK:STDOUT: %T.loc8_12.1 => constants.%T -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %J.lookup_impl_witness => constants.%J.lookup_impl_witness.cd2552.1 -// CHECK:STDOUT: %impl.elem0.loc8_24.1 => constants.%impl.elem0.fa9e71.1 -// CHECK:STDOUT: %S.loc8_19.1 => constants.%S -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.345548.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%V) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound1(constants.%V, constants.%W) { -// CHECK:STDOUT: %V.loc11_14.1 => constants.%V -// CHECK:STDOUT: %J.lookup_impl_witness => constants.%J.lookup_impl_witness.cd2552.2 -// CHECK:STDOUT: %impl.elem0.loc11_26.1 => constants.%impl.elem0.fa9e71.2 -// CHECK:STDOUT: %W.loc11_21.1 => constants.%W -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.345548.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- non_instance.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %K1.type: type = facet_type <@K1> [concrete] -// CHECK:STDOUT: %Self: %K1.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %K1.Q1.type: type = fn_type @K1.Q1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %K1.Q1: %K1.Q1.type = struct_value () [concrete] -// CHECK:STDOUT: %K1.assoc_type: type = assoc_entity_type @K1 [concrete] -// CHECK:STDOUT: %assoc0: %K1.assoc_type = assoc_entity element0, @K1.%K1.Q1.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %K1.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type: type = pattern_type %K1.type [concrete] -// CHECK:STDOUT: %Simple2.type: type = fn_type @Simple2 [concrete] -// CHECK:STDOUT: %Simple2: %Simple2.type = struct_value () [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %K1.lookup_impl_witness.a3a3f1.1: = lookup_impl_witness %T, @K1 [symbolic] -// CHECK:STDOUT: %.48862d.1: type = fn_type_with_self_type %K1.Q1.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0.33f0bc.1: %.48862d.1 = impl_witness_access %K1.lookup_impl_witness.a3a3f1.1, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.dd96c4.1: = specific_impl_function %impl.elem0.33f0bc.1, @K1.Q1(%T) [symbolic] -// CHECK:STDOUT: %V: %K1.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %Compound2.type: type = fn_type @Compound2 [concrete] -// CHECK:STDOUT: %Compound2: %Compound2.type = struct_value () [concrete] -// CHECK:STDOUT: %K1.lookup_impl_witness.a3a3f1.2: = lookup_impl_witness %V, @K1 [symbolic] -// CHECK:STDOUT: %.48862d.2: type = fn_type_with_self_type %K1.Q1.type, %V [symbolic] -// CHECK:STDOUT: %impl.elem0.33f0bc.2: %.48862d.2 = impl_witness_access %K1.lookup_impl_witness.a3a3f1.2, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.dd96c4.2: = specific_impl_function %impl.elem0.33f0bc.2, @K1.Q1(%V) [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .K1 = %K1.decl -// CHECK:STDOUT: .Simple2 = %Simple2.decl -// CHECK:STDOUT: .Compound2 = %Compound2.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %K1.decl: type = interface_decl @K1 [concrete = constants.%K1.type] {} {} -// CHECK:STDOUT: %Simple2.decl: %Simple2.type = fn_decl @Simple2 [concrete = constants.%Simple2] { -// CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8: type = splice_block %K1.ref [concrete = constants.%K1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %K1.ref: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_12.2: %K1.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound2.decl: %Compound2.type = fn_decl @Compound2 [concrete = constants.%Compound2] { -// CHECK:STDOUT: %V.patt: %pattern_type = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc13: type = splice_block %K1.ref.loc13 [concrete = constants.%K1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %K1.ref.loc13: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc13_14.2: %K1.type = symbolic_binding V, 0 [symbolic = %V.loc13_14.1 (constants.%V)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @K1 { -// CHECK:STDOUT: %Self: %K1.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %K1.Q1.decl: %K1.Q1.type = fn_decl @K1.Q1 [concrete = constants.%K1.Q1] {} {} -// CHECK:STDOUT: %assoc0: %K1.assoc_type = assoc_entity element0, %K1.Q1.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .Q1 = %assoc0 -// CHECK:STDOUT: witness = (%K1.Q1.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @K1.Q1(@K1.%Self: %K1.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple2(%T.loc8_12.2: %K1.type) { -// CHECK:STDOUT: %T.loc8_12.1: %K1.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc8_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %K1.lookup_impl_witness: = lookup_impl_witness %T.loc8_12.1, @K1 [symbolic = %K1.lookup_impl_witness (constants.%K1.lookup_impl_witness.a3a3f1.1)] -// CHECK:STDOUT: %.loc9_4.2: type = fn_type_with_self_type constants.%K1.Q1.type, %T.loc8_12.1 [symbolic = %.loc9_4.2 (constants.%.48862d.1)] -// CHECK:STDOUT: %impl.elem0.loc9_4.2: @Simple2.%.loc9_4.2 (%.48862d.1) = impl_witness_access %K1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.33f0bc.1)] -// CHECK:STDOUT: %specific_impl_fn.loc9_4.2: = specific_impl_function %impl.elem0.loc9_4.2, @K1.Q1(%T.loc8_12.1) [symbolic = %specific_impl_fn.loc9_4.2 (constants.%specific_impl_fn.dd96c4.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref: %K1.type = name_ref T, %T.loc8_12.2 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %Q1.ref: %K1.assoc_type = name_ref Q1, @K1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc9_4.1: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem0.loc9_4.1: @Simple2.%.loc9_4.2 (%.48862d.1) = impl_witness_access constants.%K1.lookup_impl_witness.a3a3f1.1, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0.33f0bc.1)] -// CHECK:STDOUT: %specific_impl_fn.loc9_4.1: = specific_impl_function %impl.elem0.loc9_4.1, @K1.Q1(constants.%T) [symbolic = %specific_impl_fn.loc9_4.2 (constants.%specific_impl_fn.dd96c4.1)] -// CHECK:STDOUT: %.loc9_8: init %empty_tuple.type = call %specific_impl_fn.loc9_4.1() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound2(%V.loc13_14.2: %K1.type) { -// CHECK:STDOUT: %V.loc13_14.1: %K1.type = symbolic_binding V, 0 [symbolic = %V.loc13_14.1 (constants.%V)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %K1.lookup_impl_witness: = lookup_impl_witness %V.loc13_14.1, @K1 [symbolic = %K1.lookup_impl_witness (constants.%K1.lookup_impl_witness.a3a3f1.2)] -// CHECK:STDOUT: %.loc14_4: type = fn_type_with_self_type constants.%K1.Q1.type, %V.loc13_14.1 [symbolic = %.loc14_4 (constants.%.48862d.2)] -// CHECK:STDOUT: %impl.elem0.loc14_4.2: @Compound2.%.loc14_4 (%.48862d.2) = impl_witness_access %K1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.33f0bc.2)] -// CHECK:STDOUT: %specific_impl_fn.loc14_4.2: = specific_impl_function %impl.elem0.loc14_4.2, @K1.Q1(%V.loc13_14.1) [symbolic = %specific_impl_fn.loc14_4.2 (constants.%specific_impl_fn.dd96c4.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %V.ref: %K1.type = name_ref V, %V.loc13_14.2 [symbolic = %V.loc13_14.1 (constants.%V)] -// CHECK:STDOUT: %K1.ref.loc14: type = name_ref K1, file.%K1.decl [concrete = constants.%K1.type] -// CHECK:STDOUT: %Q1.ref: %K1.assoc_type = name_ref Q1, @K1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc14_4.1: @Compound2.%.loc14_4 (%.48862d.2) = impl_witness_access constants.%K1.lookup_impl_witness.a3a3f1.2, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0.33f0bc.2)] -// CHECK:STDOUT: %specific_impl_fn.loc14_4.1: = specific_impl_function %impl.elem0.loc14_4.1, @K1.Q1(constants.%V) [symbolic = %specific_impl_fn.loc14_4.2 (constants.%specific_impl_fn.dd96c4.2)] -// CHECK:STDOUT: %.loc14_13: init %empty_tuple.type = call %specific_impl_fn.loc14_4.1() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @K1.Q1(constants.%Self) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple2(constants.%T) { -// CHECK:STDOUT: %T.loc8_12.1 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @K1.Q1(constants.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound2(constants.%V) { -// CHECK:STDOUT: %V.loc13_14.1 => constants.%V -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @K1.Q1(constants.%V) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_caller_instance_interface_not.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %K2.type: type = facet_type <@K2> [concrete] -// CHECK:STDOUT: %Self.98c: %K2.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %K2.Q2.type: type = fn_type @K2.Q2 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %K2.Q2: %K2.Q2.type = struct_value () [concrete] -// CHECK:STDOUT: %K2.assoc_type: type = assoc_entity_type @K2 [concrete] -// CHECK:STDOUT: %assoc0.d67: %K2.assoc_type = assoc_entity element0, @K2.%K2.Q2.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %K2.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.4d9: type = pattern_type %K2.type [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %pattern_type.91df25.1: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %Simple3.type: type = fn_type @Simple3 [concrete] -// CHECK:STDOUT: %Simple3: %Simple3.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.5fb80b.1: = require_complete_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %K2.lookup_impl_witness: = lookup_impl_witness %T, @K2 [symbolic] -// CHECK:STDOUT: %.19f: type = fn_type_with_self_type %K2.Q2.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0: %.19f = impl_witness_access %K2.lookup_impl_witness, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn: = specific_impl_function %impl.elem0, @K2.Q2(%T) [symbolic] -// CHECK:STDOUT: %V: %K2.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V [symbolic] -// CHECK:STDOUT: %pattern_type.91df25.2: type = pattern_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %Compound3.type: type = fn_type @Compound3 [concrete] -// CHECK:STDOUT: %Compound3: %Compound3.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.5fb80b.2: = require_complete_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .K2 = %K2.decl -// CHECK:STDOUT: .Simple3 = %Simple3.decl -// CHECK:STDOUT: .Compound3 = %Compound3.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %K2.decl: type = interface_decl @K2 [concrete = constants.%K2.type] {} {} -// CHECK:STDOUT: %Simple3.decl: %Simple3.type = fn_decl @Simple3 [concrete = constants.%Simple3] { -// CHECK:STDOUT: %T.patt: %pattern_type.4d9 = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: %x.patt: @Simple3.%pattern_type (%pattern_type.91df25.1) = value_binding_pattern x [concrete] -// CHECK:STDOUT: %x.param_patt: @Simple3.%pattern_type (%pattern_type.91df25.1) = value_param_pattern %x.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_16: type = splice_block %K2.ref [concrete = constants.%K2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %K2.ref: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_12.2: %K2.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %x.param: @Simple3.%T.binding.as_type (%T.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc8_23.1: type = splice_block %.loc8_23.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] { -// CHECK:STDOUT: %T.ref: %K2.type = name_ref T, %T.loc8_12.2 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc8_23.2: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x: @Simple3.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound3.decl: %Compound3.type = fn_decl @Compound3 [concrete = constants.%Compound3] { -// CHECK:STDOUT: %V.patt: %pattern_type.4d9 = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: %y.patt: @Compound3.%pattern_type (%pattern_type.91df25.2) = value_binding_pattern y [concrete] -// CHECK:STDOUT: %y.param_patt: @Compound3.%pattern_type (%pattern_type.91df25.2) = value_param_pattern %y.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14_18: type = splice_block %K2.ref.loc14 [concrete = constants.%K2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %K2.ref.loc14: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc14_14.2: %K2.type = symbolic_binding V, 0 [symbolic = %V.loc14_14.1 (constants.%V)] -// CHECK:STDOUT: %y.param: @Compound3.%V.binding.as_type (%V.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc14_25.1: type = splice_block %.loc14_25.2 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] { -// CHECK:STDOUT: %V.ref: %K2.type = name_ref V, %V.loc14_14.2 [symbolic = %V.loc14_14.1 (constants.%V)] -// CHECK:STDOUT: %V.as_type: type = facet_access_type %V.ref [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %.loc14_25.2: type = converted %V.ref, %V.as_type [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %y: @Compound3.%V.binding.as_type (%V.binding.as_type) = value_binding y, %y.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @K2 { -// CHECK:STDOUT: %Self: %K2.type = symbolic_binding Self, 0 [symbolic = constants.%Self.98c] -// CHECK:STDOUT: %K2.Q2.decl: %K2.Q2.type = fn_decl @K2.Q2 [concrete = constants.%K2.Q2] {} {} -// CHECK:STDOUT: %assoc0: %K2.assoc_type = assoc_entity element0, %K2.Q2.decl [concrete = constants.%assoc0.d67] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .Q2 = %assoc0 -// CHECK:STDOUT: witness = (%K2.Q2.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @K2.Q2(@K2.%Self: %K2.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple3(%T.loc8_12.2: %K2.type) { -// CHECK:STDOUT: %T.loc8_12.1: %K2.type = symbolic_binding T, 0 [symbolic = %T.loc8_12.1 (constants.%T)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc8_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.91df25.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.binding.as_type [symbolic = %require_complete (constants.%require_complete.5fb80b.1)] -// CHECK:STDOUT: %K2.lookup_impl_witness: = lookup_impl_witness %T.loc8_12.1, @K2 [symbolic = %K2.lookup_impl_witness (constants.%K2.lookup_impl_witness)] -// CHECK:STDOUT: %.loc9_4: type = fn_type_with_self_type constants.%K2.Q2.type, %T.loc8_12.1 [symbolic = %.loc9_4 (constants.%.19f)] -// CHECK:STDOUT: %impl.elem0.loc9_4.2: @Simple3.%.loc9_4 (%.19f) = impl_witness_access %K2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc9_4.2: = specific_impl_function %impl.elem0.loc9_4.2, @K2.Q2(%T.loc8_12.1) [symbolic = %specific_impl_fn.loc9_4.2 (constants.%specific_impl_fn)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @Simple3.%T.binding.as_type (%T.binding.as_type)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Simple3.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x -// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0.d67] -// CHECK:STDOUT: %impl.elem0.loc9_4.1: @Simple3.%.loc9_4 (%.19f) = impl_witness_access constants.%K2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc9_4.1: = specific_impl_function %impl.elem0.loc9_4.1, @K2.Q2(constants.%T) [symbolic = %specific_impl_fn.loc9_4.2 (constants.%specific_impl_fn)] -// CHECK:STDOUT: %.loc9_8: init %empty_tuple.type = call %specific_impl_fn.loc9_4.1() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound3(%V.loc14_14.2: %K2.type) { -// CHECK:STDOUT: %V.loc14_14.1: %K2.type = symbolic_binding V, 0 [symbolic = %V.loc14_14.1 (constants.%V)] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V.loc14_14.1 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %V.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.91df25.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %V.binding.as_type [symbolic = %require_complete (constants.%require_complete.5fb80b.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%y.param: @Compound3.%V.binding.as_type (%V.binding.as_type)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %y.ref: @Compound3.%V.binding.as_type (%V.binding.as_type) = name_ref y, %y -// CHECK:STDOUT: %K2.ref.loc22: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] -// CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.%assoc0 [concrete = constants.%assoc0.d67] -// CHECK:STDOUT: %.loc22: %K2.type = converted %y.ref, [concrete = ] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @K2.Q2(constants.%Self.98c) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple3(constants.%T) { -// CHECK:STDOUT: %T.loc8_12.1 => constants.%T -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.91df25.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @K2.Q2(constants.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound3(constants.%V) { -// CHECK:STDOUT: %V.loc14_14.1 => constants.%V -// CHECK:STDOUT: %V.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.91df25.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- instance.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %L1.type: type = facet_type <@L1> [concrete] -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.1: type = pattern_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %L1.R1.type: type = fn_type @L1.R1 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %L1.R1: %L1.R1.type = struct_value () [concrete] -// CHECK:STDOUT: %L1.assoc_type: type = assoc_entity_type @L1 [concrete] -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, @L1.%L1.R1.decl [concrete] -// CHECK:STDOUT: %L1.S1.type: type = fn_type @L1.S1 [concrete] -// CHECK:STDOUT: %L1.S1: %L1.S1.type = struct_value () [concrete] -// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, @L1.%L1.S1.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %L1.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.e3e: type = pattern_type %L1.type [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.2: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %ptr.5db4e7.1: type = ptr_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.f1f60b.1: type = pattern_type %ptr.5db4e7.1 [symbolic] -// CHECK:STDOUT: %Simple4.type: type = fn_type @Simple4 [concrete] -// CHECK:STDOUT: %Simple4: %Simple4.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.b98a62.1: = require_complete_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %require_complete.80837b.1: = require_complete_type %ptr.5db4e7.1 [symbolic] -// CHECK:STDOUT: %L1.lookup_impl_witness.497b38.1: = lookup_impl_witness %T, @L1 [symbolic] -// CHECK:STDOUT: %.2c3978.1: type = fn_type_with_self_type %L1.R1.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0.d3a613.1: %.2c3978.1 = impl_witness_access %L1.lookup_impl_witness.497b38.1, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.f8ac37.1: = specific_impl_function %impl.elem0.d3a613.1, @L1.R1(%T) [symbolic] -// CHECK:STDOUT: %.45c8db.1: type = fn_type_with_self_type %L1.S1.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem1.c3a14a.1: %.45c8db.1 = impl_witness_access %L1.lookup_impl_witness.497b38.1, element1 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.c2ec1e.1: = specific_impl_function %impl.elem1.c3a14a.1, @L1.S1(%T) [symbolic] -// CHECK:STDOUT: %V: %L1.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V [symbolic] -// CHECK:STDOUT: %pattern_type.510a66.3: type = pattern_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %ptr.5db4e7.2: type = ptr_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %pattern_type.f1f60b.2: type = pattern_type %ptr.5db4e7.2 [symbolic] -// CHECK:STDOUT: %Compound4.type: type = fn_type @Compound4 [concrete] -// CHECK:STDOUT: %Compound4: %Compound4.type = struct_value () [concrete] -// CHECK:STDOUT: %require_complete.b98a62.2: = require_complete_type %V.binding.as_type [symbolic] -// CHECK:STDOUT: %require_complete.80837b.2: = require_complete_type %ptr.5db4e7.2 [symbolic] -// CHECK:STDOUT: %L1.lookup_impl_witness.497b38.2: = lookup_impl_witness %V, @L1 [symbolic] -// CHECK:STDOUT: %.2c3978.2: type = fn_type_with_self_type %L1.R1.type, %V [symbolic] -// CHECK:STDOUT: %impl.elem0.d3a613.2: %.2c3978.2 = impl_witness_access %L1.lookup_impl_witness.497b38.2, element0 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.f8ac37.2: = specific_impl_function %impl.elem0.d3a613.2, @L1.R1(%V) [symbolic] -// CHECK:STDOUT: %.45c8db.2: type = fn_type_with_self_type %L1.S1.type, %V [symbolic] -// CHECK:STDOUT: %impl.elem1.c3a14a.2: %.45c8db.2 = impl_witness_access %L1.lookup_impl_witness.497b38.2, element1 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.c2ec1e.2: = specific_impl_function %impl.elem1.c3a14a.2, @L1.S1(%V) [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .L1 = %L1.decl -// CHECK:STDOUT: .Simple4 = %Simple4.decl -// CHECK:STDOUT: .Compound4 = %Compound4.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %L1.decl: type = interface_decl @L1 [concrete = constants.%L1.type] {} {} -// CHECK:STDOUT: %Simple4.decl: %Simple4.type = fn_decl @Simple4 [concrete = constants.%Simple4] { -// CHECK:STDOUT: %T.patt: %pattern_type.e3e = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: %x.patt: @Simple4.%pattern_type.loc9_20 (%pattern_type.510a66.2) = value_binding_pattern x [concrete] -// CHECK:STDOUT: %x.param_patt: @Simple4.%pattern_type.loc9_20 (%pattern_type.510a66.2) = value_param_pattern %x.patt, call_param0 [concrete] -// CHECK:STDOUT: %p.patt: @Simple4.%pattern_type.loc9_26 (%pattern_type.f1f60b.1) = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: @Simple4.%pattern_type.loc9_26 (%pattern_type.f1f60b.1) = value_param_pattern %p.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_16: type = splice_block %L1.ref [concrete = constants.%L1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L1.ref: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_12.2: %L1.type = symbolic_binding T, 0 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %x.param: @Simple4.%T.binding.as_type (%T.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc9_23.1: type = splice_block %.loc9_23.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] { -// CHECK:STDOUT: %T.ref.loc9_23: %L1.type = name_ref T, %T.loc9_12.2 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc9_23: type = facet_access_type %T.ref.loc9_23 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc9_23.2: type = converted %T.ref.loc9_23, %T.as_type.loc9_23 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x: @Simple4.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param -// CHECK:STDOUT: %p.param: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.1) = value_param call_param1 -// CHECK:STDOUT: %.loc9_30.1: type = splice_block %ptr.loc9_30.2 [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.1)] { -// CHECK:STDOUT: %T.ref.loc9_29: %L1.type = name_ref T, %T.loc9_12.2 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc9_30: type = facet_access_type %T.ref.loc9_29 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc9_30.2: type = converted %T.ref.loc9_29, %T.as_type.loc9_30 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %ptr.loc9_30.2: type = ptr_type %.loc9_30.2 [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.1)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.1) = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound4.decl: %Compound4.type = fn_decl @Compound4 [concrete = constants.%Compound4] { -// CHECK:STDOUT: %V.patt: %pattern_type.e3e = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: %y.patt: @Compound4.%pattern_type.loc15_22 (%pattern_type.510a66.3) = value_binding_pattern y [concrete] -// CHECK:STDOUT: %y.param_patt: @Compound4.%pattern_type.loc15_22 (%pattern_type.510a66.3) = value_param_pattern %y.patt, call_param0 [concrete] -// CHECK:STDOUT: %p.patt: @Compound4.%pattern_type.loc15_28 (%pattern_type.f1f60b.2) = value_binding_pattern p [concrete] -// CHECK:STDOUT: %p.param_patt: @Compound4.%pattern_type.loc15_28 (%pattern_type.f1f60b.2) = value_param_pattern %p.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15_18: type = splice_block %L1.ref.loc15 [concrete = constants.%L1.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L1.ref.loc15: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc15_14.2: %L1.type = symbolic_binding V, 0 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %y.param: @Compound4.%V.binding.as_type (%V.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc15_25.1: type = splice_block %.loc15_25.2 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] { -// CHECK:STDOUT: %V.ref.loc15_25: %L1.type = name_ref V, %V.loc15_14.2 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc15_25: type = facet_access_type %V.ref.loc15_25 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %.loc15_25.2: type = converted %V.ref.loc15_25, %V.as_type.loc15_25 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %y: @Compound4.%V.binding.as_type (%V.binding.as_type) = value_binding y, %y.param -// CHECK:STDOUT: %p.param: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.2) = value_param call_param1 -// CHECK:STDOUT: %.loc15_32.1: type = splice_block %ptr.loc15_32.2 [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.2)] { -// CHECK:STDOUT: %V.ref.loc15_31: %L1.type = name_ref V, %V.loc15_14.2 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.as_type.loc15_32: type = facet_access_type %V.ref.loc15_31 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %.loc15_32.2: type = converted %V.ref.loc15_31, %V.as_type.loc15_32 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %ptr.loc15_32.2: type = ptr_type %.loc15_32.2 [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.2)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %p: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.2) = value_binding p, %p.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @L1 { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %L1.R1.decl: %L1.R1.type = fn_decl @L1.R1 [concrete = constants.%L1.R1] { -// CHECK:STDOUT: %self.patt: @L1.R1.%pattern_type (%pattern_type.510a66.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L1.R1.%pattern_type (%pattern_type.510a66.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L1.R1.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc4_15.1: type = splice_block %.loc4_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc4_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L1.R1.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %L1.assoc_type = assoc_entity element0, %L1.R1.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: %L1.S1.decl: %L1.S1.type = fn_decl @L1.S1 [concrete = constants.%L1.S1] { -// CHECK:STDOUT: %self.patt: @L1.S1.%pattern_type (%pattern_type.510a66.1) = ref_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L1.S1.%pattern_type (%pattern_type.510a66.1) = ref_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref @L1.S1.%Self.binding.as_type (%Self.binding.as_type) = ref_param call_param0 -// CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L1.type = name_ref Self, @L1.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc5_19.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: ref @L1.S1.%Self.binding.as_type (%Self.binding.as_type) = ref_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc1: %L1.assoc_type = assoc_entity element1, %L1.S1.decl [concrete = constants.%assoc1] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .R1 = %assoc0 -// CHECK:STDOUT: .S1 = %assoc1 -// CHECK:STDOUT: witness = (%L1.R1.decl, %L1.S1.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L1.R1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.510a66.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L1.R1.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L1.S1(@L1.%Self: %L1.type) { -// CHECK:STDOUT: %Self: %L1.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.510a66.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L1.S1.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple4(%T.loc9_12.2: %L1.type) { -// CHECK:STDOUT: %T.loc9_12.1: %L1.type = symbolic_binding T, 0 [symbolic = %T.loc9_12.1 (constants.%T)] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc9_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %pattern_type.loc9_20: type = pattern_type %T.binding.as_type [symbolic = %pattern_type.loc9_20 (constants.%pattern_type.510a66.2)] -// CHECK:STDOUT: %ptr.loc9_30.1: type = ptr_type %T.binding.as_type [symbolic = %ptr.loc9_30.1 (constants.%ptr.5db4e7.1)] -// CHECK:STDOUT: %pattern_type.loc9_26: type = pattern_type %ptr.loc9_30.1 [symbolic = %pattern_type.loc9_26 (constants.%pattern_type.f1f60b.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc9_21: = require_complete_type %T.binding.as_type [symbolic = %require_complete.loc9_21 (constants.%require_complete.b98a62.1)] -// CHECK:STDOUT: %require_complete.loc9_27: = require_complete_type %ptr.loc9_30.1 [symbolic = %require_complete.loc9_27 (constants.%require_complete.80837b.1)] -// CHECK:STDOUT: %L1.lookup_impl_witness: = lookup_impl_witness %T.loc9_12.1, @L1 [symbolic = %L1.lookup_impl_witness (constants.%L1.lookup_impl_witness.497b38.1)] -// CHECK:STDOUT: %.loc10_4: type = fn_type_with_self_type constants.%L1.R1.type, %T.loc9_12.1 [symbolic = %.loc10_4 (constants.%.2c3978.1)] -// CHECK:STDOUT: %impl.elem0.loc10_4.2: @Simple4.%.loc10_4 (%.2c3978.1) = impl_witness_access %L1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0.d3a613.1)] -// CHECK:STDOUT: %specific_impl_fn.loc10_4.2: = specific_impl_function %impl.elem0.loc10_4.2, @L1.R1(%T.loc9_12.1) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn.f8ac37.1)] -// CHECK:STDOUT: %.loc11_4.2: type = fn_type_with_self_type constants.%L1.S1.type, %T.loc9_12.1 [symbolic = %.loc11_4.2 (constants.%.45c8db.1)] -// CHECK:STDOUT: %impl.elem1.loc11_4.2: @Simple4.%.loc11_4.2 (%.45c8db.1) = impl_witness_access %L1.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc11_4.2 (constants.%impl.elem1.c3a14a.1)] -// CHECK:STDOUT: %specific_impl_fn.loc11_4.2: = specific_impl_function %impl.elem1.loc11_4.2, @L1.S1(%T.loc9_12.1) [symbolic = %specific_impl_fn.loc11_4.2 (constants.%specific_impl_fn.c2ec1e.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @Simple4.%T.binding.as_type (%T.binding.as_type), %p.param: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.1)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: @Simple4.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_4.1: @Simple4.%.loc10_4 (%.2c3978.1) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.1, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0.d3a613.1)] -// CHECK:STDOUT: %bound_method.loc10_4: = bound_method %x.ref, %impl.elem0.loc10_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc10_4.1: = specific_impl_function %impl.elem0.loc10_4.1, @L1.R1(constants.%T) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn.f8ac37.1)] -// CHECK:STDOUT: %bound_method.loc10_8: = bound_method %x.ref, %specific_impl_fn.loc10_4.1 -// CHECK:STDOUT: %.loc10_8: init %empty_tuple.type = call %bound_method.loc10_8(%x.ref) -// CHECK:STDOUT: %p.ref: @Simple4.%ptr.loc9_30.1 (%ptr.5db4e7.1) = name_ref p, %p -// CHECK:STDOUT: %.loc11_4.1: ref @Simple4.%T.binding.as_type (%T.binding.as_type) = deref %p.ref -// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_4.1: @Simple4.%.loc11_4.2 (%.45c8db.1) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.1, element1 [symbolic = %impl.elem1.loc11_4.2 (constants.%impl.elem1.c3a14a.1)] -// CHECK:STDOUT: %bound_method.loc11_4: = bound_method %.loc11_4.1, %impl.elem1.loc11_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc11_4.1: = specific_impl_function %impl.elem1.loc11_4.1, @L1.S1(constants.%T) [symbolic = %specific_impl_fn.loc11_4.2 (constants.%specific_impl_fn.c2ec1e.1)] -// CHECK:STDOUT: %bound_method.loc11_9: = bound_method %.loc11_4.1, %specific_impl_fn.loc11_4.1 -// CHECK:STDOUT: %.loc11_9: init %empty_tuple.type = call %bound_method.loc11_9(%.loc11_4.1) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound4(%V.loc15_14.2: %L1.type) { -// CHECK:STDOUT: %V.loc15_14.1: %L1.type = symbolic_binding V, 0 [symbolic = %V.loc15_14.1 (constants.%V)] -// CHECK:STDOUT: %V.binding.as_type: type = symbolic_binding_type V, 0, %V.loc15_14.1 [symbolic = %V.binding.as_type (constants.%V.binding.as_type)] -// CHECK:STDOUT: %pattern_type.loc15_22: type = pattern_type %V.binding.as_type [symbolic = %pattern_type.loc15_22 (constants.%pattern_type.510a66.3)] -// CHECK:STDOUT: %ptr.loc15_32.1: type = ptr_type %V.binding.as_type [symbolic = %ptr.loc15_32.1 (constants.%ptr.5db4e7.2)] -// CHECK:STDOUT: %pattern_type.loc15_28: type = pattern_type %ptr.loc15_32.1 [symbolic = %pattern_type.loc15_28 (constants.%pattern_type.f1f60b.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc15_23: = require_complete_type %V.binding.as_type [symbolic = %require_complete.loc15_23 (constants.%require_complete.b98a62.2)] -// CHECK:STDOUT: %require_complete.loc15_29: = require_complete_type %ptr.loc15_32.1 [symbolic = %require_complete.loc15_29 (constants.%require_complete.80837b.2)] -// CHECK:STDOUT: %L1.lookup_impl_witness: = lookup_impl_witness %V.loc15_14.1, @L1 [symbolic = %L1.lookup_impl_witness (constants.%L1.lookup_impl_witness.497b38.2)] -// CHECK:STDOUT: %.loc16_4: type = fn_type_with_self_type constants.%L1.R1.type, %V.loc15_14.1 [symbolic = %.loc16_4 (constants.%.2c3978.2)] -// CHECK:STDOUT: %impl.elem0.loc16_4.2: @Compound4.%.loc16_4 (%.2c3978.2) = impl_witness_access %L1.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0.d3a613.2)] -// CHECK:STDOUT: %specific_impl_fn.loc16_4.2: = specific_impl_function %impl.elem0.loc16_4.2, @L1.R1(%V.loc15_14.1) [symbolic = %specific_impl_fn.loc16_4.2 (constants.%specific_impl_fn.f8ac37.2)] -// CHECK:STDOUT: %.loc17_4.2: type = fn_type_with_self_type constants.%L1.S1.type, %V.loc15_14.1 [symbolic = %.loc17_4.2 (constants.%.45c8db.2)] -// CHECK:STDOUT: %impl.elem1.loc17_4.2: @Compound4.%.loc17_4.2 (%.45c8db.2) = impl_witness_access %L1.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc17_4.2 (constants.%impl.elem1.c3a14a.2)] -// CHECK:STDOUT: %specific_impl_fn.loc17_4.2: = specific_impl_function %impl.elem1.loc17_4.2, @L1.S1(%V.loc15_14.1) [symbolic = %specific_impl_fn.loc17_4.2 (constants.%specific_impl_fn.c2ec1e.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%y.param: @Compound4.%V.binding.as_type (%V.binding.as_type), %p.param: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.2)) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %y.ref: @Compound4.%V.binding.as_type (%V.binding.as_type) = name_ref y, %y -// CHECK:STDOUT: %L1.ref.loc16: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %R1.ref: %L1.assoc_type = name_ref R1, @L1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc16_4.1: @Compound4.%.loc16_4 (%.2c3978.2) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.2, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0.d3a613.2)] -// CHECK:STDOUT: %bound_method.loc16_4: = bound_method %y.ref, %impl.elem0.loc16_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc16_4.1: = specific_impl_function %impl.elem0.loc16_4.1, @L1.R1(constants.%V) [symbolic = %specific_impl_fn.loc16_4.2 (constants.%specific_impl_fn.f8ac37.2)] -// CHECK:STDOUT: %bound_method.loc16_13: = bound_method %y.ref, %specific_impl_fn.loc16_4.1 -// CHECK:STDOUT: %.loc16_13: init %empty_tuple.type = call %bound_method.loc16_13(%y.ref) -// CHECK:STDOUT: %p.ref: @Compound4.%ptr.loc15_32.1 (%ptr.5db4e7.2) = name_ref p, %p -// CHECK:STDOUT: %L1.ref.loc17: type = name_ref L1, file.%L1.decl [concrete = constants.%L1.type] -// CHECK:STDOUT: %S1.ref: %L1.assoc_type = name_ref S1, @L1.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc17_4.1: ref @Compound4.%V.binding.as_type (%V.binding.as_type) = deref %p.ref -// CHECK:STDOUT: %impl.elem1.loc17_4.1: @Compound4.%.loc17_4.2 (%.45c8db.2) = impl_witness_access constants.%L1.lookup_impl_witness.497b38.2, element1 [symbolic = %impl.elem1.loc17_4.2 (constants.%impl.elem1.c3a14a.2)] -// CHECK:STDOUT: %bound_method.loc17_4: = bound_method %.loc17_4.1, %impl.elem1.loc17_4.1 -// CHECK:STDOUT: %specific_impl_fn.loc17_4.1: = specific_impl_function %impl.elem1.loc17_4.1, @L1.S1(constants.%V) [symbolic = %specific_impl_fn.loc17_4.2 (constants.%specific_impl_fn.c2ec1e.2)] -// CHECK:STDOUT: %bound_method.loc17_14: = bound_method %.loc17_4.1, %specific_impl_fn.loc17_4.1 -// CHECK:STDOUT: %.loc17_14: init %empty_tuple.type = call %bound_method.loc17_14(%.loc17_4.1) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple4(constants.%T) { -// CHECK:STDOUT: %T.loc9_12.1 => constants.%T -// CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type.loc9_20 => constants.%pattern_type.510a66.2 -// CHECK:STDOUT: %ptr.loc9_30.1 => constants.%ptr.5db4e7.1 -// CHECK:STDOUT: %pattern_type.loc9_26 => constants.%pattern_type.f1f60b.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound4(constants.%V) { -// CHECK:STDOUT: %V.loc15_14.1 => constants.%V -// CHECK:STDOUT: %V.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type.loc15_22 => constants.%pattern_type.510a66.3 -// CHECK:STDOUT: %ptr.loc15_32.1 => constants.%ptr.5db4e7.2 -// CHECK:STDOUT: %pattern_type.loc15_28 => constants.%pattern_type.f1f60b.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.R1(constants.%V) { -// CHECK:STDOUT: %Self => constants.%V -// CHECK:STDOUT: %Self.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L1.S1(constants.%V) { -// CHECK:STDOUT: %Self => constants.%V -// CHECK:STDOUT: %Self.binding.as_type => constants.%V.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.510a66.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_interface_instance_caller_not.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %L2.type: type = facet_type <@L2> [concrete] -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic] -// CHECK:STDOUT: %pattern_type.c87c75.1: type = pattern_type %Self.binding.as_type [symbolic] -// CHECK:STDOUT: %L2.R2.type: type = fn_type @L2.R2 [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %L2.R2: %L2.R2.type = struct_value () [concrete] -// CHECK:STDOUT: %L2.assoc_type: type = assoc_entity_type @L2 [concrete] -// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, @L2.%L2.R2.decl [concrete] -// CHECK:STDOUT: %L2.S2.type: type = fn_type @L2.S2 [concrete] -// CHECK:STDOUT: %L2.S2: %L2.S2.type = struct_value () [concrete] -// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, @L2.%L2.S2.decl [concrete] -// CHECK:STDOUT: %type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %T: %L2.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %pattern_type.38f: type = pattern_type %L2.type [concrete] -// CHECK:STDOUT: %Simple5.type: type = fn_type @Simple5 [concrete] -// CHECK:STDOUT: %Simple5: %Simple5.type = struct_value () [concrete] -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic] -// CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T, @L2 [symbolic] -// CHECK:STDOUT: %.6fc: type = fn_type_with_self_type %L2.R2.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem0: %.6fc = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic] -// CHECK:STDOUT: %pattern_type.c87c75.2: type = pattern_type %T.binding.as_type [symbolic] -// CHECK:STDOUT: %specific_impl_fn.a65: = specific_impl_function %impl.elem0, @L2.R2(%T) [symbolic] -// CHECK:STDOUT: %.0b4: type = fn_type_with_self_type %L2.S2.type, %T [symbolic] -// CHECK:STDOUT: %impl.elem1: %.0b4 = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic] -// CHECK:STDOUT: %specific_impl_fn.b7b: = specific_impl_function %impl.elem1, @L2.S2(%T) [symbolic] -// CHECK:STDOUT: %V: %L2.type = symbolic_binding V, 0 [symbolic] -// CHECK:STDOUT: %Compound5.type: type = fn_type @Compound5 [concrete] -// CHECK:STDOUT: %Compound5: %Compound5.type = struct_value () [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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 [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .L2 = %L2.decl -// CHECK:STDOUT: .Simple5 = %Simple5.decl -// CHECK:STDOUT: .Compound5 = %Compound5.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %L2.decl: type = interface_decl @L2 [concrete = constants.%L2.type] {} {} -// CHECK:STDOUT: %Simple5.decl: %Simple5.type = fn_decl @Simple5 [concrete = constants.%Simple5] { -// CHECK:STDOUT: %T.patt: %pattern_type.38f = symbolic_binding_pattern T, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %L2.ref [concrete = constants.%L2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L2.ref: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_12.2: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Compound5.decl: %Compound5.type = fn_decl @Compound5 [concrete = constants.%Compound5] { -// CHECK:STDOUT: %V.patt: %pattern_type.38f = symbolic_binding_pattern V, 0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc30: type = splice_block %L2.ref.loc30 [concrete = constants.%L2.type] { -// CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %L2.ref.loc30: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc30_14.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @L2 { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %L2.R2.decl: %L2.R2.type = fn_decl @L2.R2 [concrete = constants.%L2.R2] { -// CHECK:STDOUT: %self.patt: @L2.R2.%pattern_type (%pattern_type.c87c75.1) = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L2.R2.%pattern_type (%pattern_type.c87c75.1) = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @L2.R2.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @L2.R2.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, %L2.R2.decl [concrete = constants.%assoc0] -// CHECK:STDOUT: %L2.S2.decl: %L2.S2.type = fn_decl @L2.S2 [concrete = constants.%L2.S2] { -// CHECK:STDOUT: %self.patt: @L2.S2.%pattern_type (%pattern_type.c87c75.1) = ref_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: @L2.S2.%pattern_type (%pattern_type.c87c75.1) = ref_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref @L2.S2.%Self.binding.as_type (%Self.binding.as_type) = ref_param call_param0 -// CHECK:STDOUT: %.loc6_19.1: type = splice_block %.loc6_19.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] { -// CHECK:STDOUT: %Self.ref: %L2.type = name_ref Self, @L2.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %.loc6_19.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: ref @L2.S2.%Self.binding.as_type (%Self.binding.as_type) = ref_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc1: %L2.assoc_type = assoc_entity element1, %L2.S2.decl [concrete = constants.%assoc1] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .R2 = %assoc0 -// CHECK:STDOUT: .S2 = %assoc1 -// CHECK:STDOUT: witness = (%L2.R2.decl, %L2.S2.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L2.R2(@L2.%Self: %L2.type) { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.c87c75.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L2.R2.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @L2.S2(@L2.%Self: %L2.type) { -// CHECK:STDOUT: %Self: %L2.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.c87c75.1)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @L2.S2.%Self.binding.as_type (%Self.binding.as_type)); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Simple5(%T.loc10_12.2: %L2.type) { -// CHECK:STDOUT: %T.loc10_12.1: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc10_12.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T.loc10_12.1, @L2 [symbolic = %L2.lookup_impl_witness (constants.%L2.lookup_impl_witness)] -// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type constants.%L2.R2.type, %T.loc10_12.1 [symbolic = %.loc18_4.2 (constants.%.6fc)] -// CHECK:STDOUT: %impl.elem0.loc18_4.2: @Simple5.%.loc18_4.2 (%.6fc) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc18_4.2: = specific_impl_function %impl.elem0.loc18_4.2, @L2.R2(%T.loc10_12.1) [symbolic = %specific_impl_fn.loc18_4.2 (constants.%specific_impl_fn.a65)] -// CHECK:STDOUT: %.loc26_4.2: type = fn_type_with_self_type constants.%L2.S2.type, %T.loc10_12.1 [symbolic = %.loc26_4.2 (constants.%.0b4)] -// CHECK:STDOUT: %impl.elem1.loc26_4.2: @Simple5.%.loc26_4.2 (%.0b4) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] -// CHECK:STDOUT: %specific_impl_fn.loc26_4.2: = specific_impl_function %impl.elem1.loc26_4.2, @L2.S2(%T.loc10_12.1) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.b7b)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_12.2 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem0.loc18_4.1: @Simple5.%.loc18_4.2 (%.6fc) = impl_witness_access constants.%L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %specific_impl_fn.loc18_4.1: = specific_impl_function %impl.elem0.loc18_4.1, @L2.R2(constants.%T) [symbolic = %specific_impl_fn.loc18_4.2 (constants.%specific_impl_fn.a65)] -// CHECK:STDOUT: %.loc18_8: init %empty_tuple.type = call %specific_impl_fn.loc18_4.1() [concrete = ] -// CHECK:STDOUT: %T.ref.loc26: %L2.type = name_ref T, %T.loc10_12.2 [symbolic = %T.loc10_12.1 (constants.%T)] -// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %T.as_type.loc26: type = facet_access_type %T.ref.loc26 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %.loc26_4.1: type = converted %T.ref.loc26, %T.as_type.loc26 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] -// CHECK:STDOUT: %impl.elem1.loc26_4.1: @Simple5.%.loc26_4.2 (%.0b4) = impl_witness_access constants.%L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc26_4.2 (constants.%impl.elem1)] -// CHECK:STDOUT: %specific_impl_fn.loc26_4.1: = specific_impl_function %impl.elem1.loc26_4.1, @L2.S2(constants.%T) [symbolic = %specific_impl_fn.loc26_4.2 (constants.%specific_impl_fn.b7b)] -// CHECK:STDOUT: %.loc26_8: init %empty_tuple.type = call %specific_impl_fn.loc26_4.1() [concrete = ] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound5(%V.loc30_14.2: %L2.type) { -// CHECK:STDOUT: %V.loc30_14.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %V.ref.loc35: %L2.type = name_ref V, %V.loc30_14.2 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc35: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.ref.loc40: %L2.type = name_ref V, %V.loc30_14.2 [symbolic = %V.loc30_14.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc40: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] -// CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.R2(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.S2(constants.%Self) { -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.1 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Simple5(constants.%T) { -// CHECK:STDOUT: %T.loc10_12.1 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.R2(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @L2.S2(constants.%T) { -// CHECK:STDOUT: %Self => constants.%T -// CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.c87c75.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Compound5(constants.%V) { -// CHECK:STDOUT: %V.loc30_14.1 => constants.%V -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_combine_non_instance.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] -// CHECK:STDOUT: %Self.803: %A.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %A.G.type: type = fn_type @A.G [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %A.G: %A.G.type = struct_value () [concrete] -// CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete] -// CHECK:STDOUT: %assoc0.d52: %A.assoc_type = assoc_entity element0, @A.%A.G.decl [concrete] -// CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %A.impl_witness: = impl_witness file.%A.impl_witness_table [concrete] -// CHECK:STDOUT: %C.as.A.impl.G.type: type = fn_type @C.as.A.impl.G [concrete] -// CHECK:STDOUT: %C.as.A.impl.G: %C.as.A.impl.G.type = struct_value () [concrete] -// CHECK:STDOUT: %A.facet: %A.type = facet_value %C, (%A.impl_witness) [concrete] -// CHECK:STDOUT: %Fails.type: type = fn_type @Fails [concrete] -// CHECK:STDOUT: %Fails: %Fails.type = struct_value () [concrete] -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] -// CHECK:STDOUT: %C.val: %C = struct_value () [concrete] -// 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.8a6: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete] -// CHECK:STDOUT: %BitAndWith.Op.type.9a3: type = fn_type @BitAndWith.Op, @BitAndWith(type) [concrete] -// CHECK:STDOUT: %BitAndWith.impl_witness: = impl_witness imports.%BitAndWith.impl_witness_table [concrete] -// CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.8a6 = facet_value type, (%BitAndWith.impl_witness) [concrete] -// CHECK:STDOUT: %.fa7: type = fn_type_with_self_type %BitAndWith.Op.type.9a3, %BitAndWith.facet [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.type: type = fn_type @type.as.BitAndWith.impl.Op [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op: %type.as.BitAndWith.impl.Op.type = struct_value () [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.bound: = bound_method %A.type, %type.as.BitAndWith.impl.Op [concrete] -// CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] -// CHECK:STDOUT: %type_where: type = facet_type > [concrete] -// CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.eeb: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.88a: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.eeb = struct_value () [concrete] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.88a, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .BitAndWith = %Core.BitAndWith -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs -// CHECK:STDOUT: .Destroy = %Core.Destroy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude/parts/as, BitAndWith, loaded [concrete = constants.%BitAndWith.generic] -// CHECK:STDOUT: %Core.import_ref.636: %type.as.BitAndWith.impl.Op.type = import_ref Core//prelude/parts/as, loc{{\d+_\d+}}, loaded [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.636), @type.as.BitAndWith.impl [concrete] -// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] -// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .A = %A.decl -// CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Fails = %Fails.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} -// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @C.as.A.impl [concrete] {} { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@C.as.A.impl.%C.as.A.impl.G.decl), @C.as.A.impl [concrete] -// CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness] -// CHECK:STDOUT: %Fails.decl: %Fails.type = fn_decl @Fails [concrete = constants.%Fails] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @A { -// CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self.803] -// CHECK:STDOUT: %A.G.decl: %A.G.type = fn_decl @A.G [concrete = constants.%A.G] {} {} -// CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %A.G.decl [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .G = %assoc0 -// CHECK:STDOUT: witness = (%A.G.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @C.as.A.impl: %C.ref as %A.ref { -// CHECK:STDOUT: %C.as.A.impl.G.decl: %C.as.A.impl.G.type = fn_decl @C.as.A.impl.G [concrete = constants.%C.as.A.impl.G] {} {} -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .G = %C.as.A.impl.G.decl -// CHECK:STDOUT: witness = file.%A.impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @C { -// CHECK:STDOUT: %complete_type: = 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.%C -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A.G(@A.%Self: %A.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.A.impl.G() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Fails() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc22_5.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc22_5.3: init %C = class_init (), %.loc22_5.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc22_5.4: ref %C = temporary %.loc22_5.2, %.loc22_5.3 -// CHECK:STDOUT: %.loc22_7: ref %C = converted %.loc22_5.1, %.loc22_5.4 -// CHECK:STDOUT: %A.ref.loc22_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc22_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc22: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc22_17: = bound_method %A.ref.loc22_15, %impl.elem0.loc22 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22: init type = call %bound_method.loc22_17(%A.ref.loc22_15, %A.ref.loc22_19) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc22: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %.loc22_12: %A.type = converted %.loc22_7, [concrete = ] -// CHECK:STDOUT: %.loc30_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc30_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc30_6.3: init %C = class_init (), %.loc30_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc30_6.4: ref %C = temporary %.loc30_6.2, %.loc30_6.3 -// CHECK:STDOUT: %.loc30_8: ref %C = converted %.loc30_6.1, %.loc30_6.4 -// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc30_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc30_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc30_26: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc30_26: = bound_method %A.ref.loc30_24, %impl.elem0.loc30_26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc30_26: init type = call %bound_method.loc30_26(%A.ref.loc30_24, %A.ref.loc30_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc30_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc30_26 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc30_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc30_26, %.loc30_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc30: %A.type = facet_value %C.ref.loc30_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc30_20: %A.type = converted %C.ref.loc30_18, %A.facet.loc30 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc30: type = facet_access_type %.loc30_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc30_30: type = converted %.loc30_20, %as_type.loc30 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc30_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc30_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc30_37: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc30_37: = bound_method %A.ref.loc30_35, %impl.elem0.loc30_37 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc30_37: init type = call %bound_method.loc30_37(%A.ref.loc30_35, %A.ref.loc30_39) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc30: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %.loc30_32: %A.type = converted %.loc30_8, [concrete = ] -// CHECK:STDOUT: %.loc38_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc38_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc38_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc38_6.3: init %C = class_init (), %.loc38_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc38_6.4: ref %C = temporary %.loc38_6.2, %.loc38_6.3 -// CHECK:STDOUT: %.loc38_8: ref %C = converted %.loc38_6.1, %.loc38_6.4 -// CHECK:STDOUT: %C.ref.loc38_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc38_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc38_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc38: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc38_26: = bound_method %A.ref.loc38_24, %impl.elem0.loc38 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc38: init type = call %bound_method.loc38_26(%A.ref.loc38_24, %A.ref.loc38_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc38_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc38 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc38_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc38, %.loc38_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc38: %A.type = facet_value %C.ref.loc38_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc38_20: %A.type = converted %C.ref.loc38_18, %A.facet.loc38 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc38: type = facet_access_type %.loc38_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc38_30: type = converted %.loc38_20, %as_type.loc38 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc38_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc38: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %.loc38_32: %A.type = converted %.loc38_8, [concrete = ] -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc38: = bound_method %.loc38_6.4, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc38_6: = bound_method %.loc38_6.4, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc38: init %empty_tuple.type = call %bound_method.loc38_6(%.loc38_6.4) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc30: = bound_method %.loc30_6.4, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc30_6: = bound_method %.loc30_6.4, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc30: init %empty_tuple.type = call %bound_method.loc30_6(%.loc30_6.4) -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc22: = bound_method %.loc22_5.4, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3: = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.88a, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc22_5: = bound_method %.loc22_5.4, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3 -// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc22: init %empty_tuple.type = call %bound_method.loc22_5(%.loc22_5.4) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.G(constants.%Self.803) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.G(constants.%A.facet) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- allowed_combine_non_instance.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete] -// CHECK:STDOUT: %Self.803: %A.type = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %A.G.type: type = fn_type @A.G [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %A.G: %A.G.type = struct_value () [concrete] -// CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete] -// CHECK:STDOUT: %assoc0.d52: %A.assoc_type = assoc_entity element0, @A.%A.G.decl [concrete] -// CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %A.impl_witness: = impl_witness file.%A.impl_witness_table [concrete] -// CHECK:STDOUT: %C.as.A.impl.G.type: type = fn_type @C.as.A.impl.G [concrete] -// CHECK:STDOUT: %C.as.A.impl.G: %C.as.A.impl.G.type = struct_value () [concrete] -// CHECK:STDOUT: %A.facet: %A.type = facet_value %C, (%A.impl_witness) [concrete] -// CHECK:STDOUT: %Works.type: type = fn_type @Works [concrete] -// CHECK:STDOUT: %Works: %Works.type = struct_value () [concrete] -// 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.8a6: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete] -// CHECK:STDOUT: %BitAndWith.Op.type.9a3: type = fn_type @BitAndWith.Op, @BitAndWith(type) [concrete] -// CHECK:STDOUT: %BitAndWith.impl_witness: = impl_witness imports.%BitAndWith.impl_witness_table [concrete] -// CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.8a6 = facet_value type, (%BitAndWith.impl_witness) [concrete] -// CHECK:STDOUT: %.fa7: type = fn_type_with_self_type %BitAndWith.Op.type.9a3, %BitAndWith.facet [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.type: type = fn_type @type.as.BitAndWith.impl.Op [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op: %type.as.BitAndWith.impl.Op.type = struct_value () [concrete] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.bound: = bound_method %A.type, %type.as.BitAndWith.impl.Op [concrete] -// CHECK:STDOUT: %.69a: type = fn_type_with_self_type %A.G.type, %A.facet [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = 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/parts/as, BitAndWith, loaded [concrete = constants.%BitAndWith.generic] -// CHECK:STDOUT: %Core.import_ref.636: %type.as.BitAndWith.impl.Op.type = import_ref Core//prelude/parts/as, loc{{\d+_\d+}}, loaded [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.636), @type.as.BitAndWith.impl [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .A = %A.decl -// CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Works = %Works.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} -// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @C.as.A.impl [concrete] {} { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (@C.as.A.impl.%C.as.A.impl.G.decl), @C.as.A.impl [concrete] -// CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness] -// CHECK:STDOUT: %Works.decl: %Works.type = fn_decl @Works [concrete = constants.%Works] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @A { -// CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self.803] -// CHECK:STDOUT: %A.G.decl: %A.G.type = fn_decl @A.G [concrete = constants.%A.G] {} {} -// CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %A.G.decl [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .G = %assoc0 -// CHECK:STDOUT: witness = (%A.G.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @C.as.A.impl: %C.ref as %A.ref { -// CHECK:STDOUT: %C.as.A.impl.G.decl: %C.as.A.impl.G.type = fn_decl @C.as.A.impl.G [concrete = constants.%C.as.A.impl.G] {} {} -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .G = %C.as.A.impl.G.decl -// CHECK:STDOUT: witness = file.%A.impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @C { -// CHECK:STDOUT: %complete_type: = 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.%C -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @A.G(@A.%Self: %A.type) { -// CHECK:STDOUT: fn(); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.A.impl.G() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Works() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc13_7: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc13_11: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc13_9: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc13: = bound_method %A.ref.loc13_7, %impl.elem0.loc13_9 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc13: init type = call %bound_method.loc13(%A.ref.loc13_7, %A.ref.loc13_11) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc13: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %A.facet.loc13: %A.type = facet_value %C.ref.loc13, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc13: %A.type = converted %C.ref.loc13, %A.facet.loc13 [concrete = constants.%A.facet] -// CHECK:STDOUT: %impl.elem0.loc13_4: %.69a = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%C.as.A.impl.G] -// CHECK:STDOUT: %C.as.A.impl.G.call.loc13: init %empty_tuple.type = call %impl.elem0.loc13_4() -// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc14_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc14_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc14_12: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc14_12: = bound_method %A.ref.loc14_10, %impl.elem0.loc14_12 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc14_12: init type = call %bound_method.loc14_12(%A.ref.loc14_10, %A.ref.loc14_14) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc14_12 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc14_15.2: type = converted %type.as.BitAndWith.impl.Op.call.loc14_12, %.loc14_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc14: %A.type = facet_value %C.ref.loc14, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc14_6: %A.type = converted %C.ref.loc14, %A.facet.loc14 [concrete = constants.%A.facet] -// CHECK:STDOUT: %A.ref.loc14_20: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc14_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc14_22: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc14_22: = bound_method %A.ref.loc14_20, %impl.elem0.loc14_22 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc14_22: init type = call %bound_method.loc14_22(%A.ref.loc14_20, %A.ref.loc14_24) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc14: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %impl.elem0.loc14_17: %.69a = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%C.as.A.impl.G] -// CHECK:STDOUT: %C.as.A.impl.G.call.loc14: init %empty_tuple.type = call %impl.elem0.loc14_17() -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc15_10: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc15_14: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc15_12: %.fa7 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc15: = bound_method %A.ref.loc15_10, %impl.elem0.loc15_12 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc15: init type = call %bound_method.loc15(%A.ref.loc15_10, %A.ref.loc15_14) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc15 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc15_15.2: type = converted %type.as.BitAndWith.impl.Op.call.loc15, %.loc15_15.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc15: %A.type = facet_value %C.ref.loc15, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc15_6: %A.type = converted %C.ref.loc15, %A.facet.loc15 [concrete = constants.%A.facet] -// CHECK:STDOUT: %A.ref.loc15_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc15: %A.assoc_type = name_ref G, @A.%assoc0 [concrete = constants.%assoc0.d52] -// CHECK:STDOUT: %impl.elem0.loc15_17: %.69a = impl_witness_access constants.%A.impl_witness, element0 [concrete = constants.%C.as.A.impl.G] -// CHECK:STDOUT: %C.as.A.impl.G.call.loc15: init %empty_tuple.type = call %impl.elem0.loc15_17() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.G(constants.%Self.803) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @A.G(constants.%A.facet) {} -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_generic_default_fn.carbon b/toolchain/check/testdata/interface/fail_todo_generic_default_fn.carbon index aa7df08721cf..6f32c7b8219f 100644 --- a/toolchain/check/testdata/interface/fail_todo_generic_default_fn.carbon +++ b/toolchain/check/testdata/interface/fail_todo_generic_default_fn.carbon @@ -12,14 +12,14 @@ interface I(T:! type) { // TODO: Use `default` here. - fn F[addr self: Self*]() -> Self*; + fn F[ref self: Self]() -> Self*; } // CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE+7]]:16: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn I(T:! type).F[addr self: Self*]() -> Self* { return self; } +// CHECK:STDERR: fn I(T:! type).F[ref self: Self]() -> Self* { return &self; } // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE-6]]:3: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: fn F[addr self: Self*]() -> Self*; -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: fn F[ref self: Self]() -> Self*; +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: -fn I(T:! type).F[addr self: Self*]() -> Self* { return self; } +fn I(T:! type).F[ref self: Self]() -> Self* { return &self; } diff --git a/toolchain/check/testdata/interop/cpp/class/abstract.carbon b/toolchain/check/testdata/interop/cpp/class/abstract.carbon index c676be1a3613..1a9cb80c2abb 100644 --- a/toolchain/check/testdata/interop/cpp/class/abstract.carbon +++ b/toolchain/check/testdata/interop/cpp/class/abstract.carbon @@ -47,10 +47,10 @@ import Cpp library "abstract.h"; class C { extend base: Cpp.A; // CHECK:STDERR: fail_todo_impl_abstract_member.carbon:[[@LINE+4]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: override fn f[addr self: Self*]() {} - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: override fn f[ref self: Self]() {} + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - override fn f[addr self: Self*]() {} + override fn f[ref self: Self]() {} } // --- abstract_final.h diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index b4503f2e74ad..9743c8ff04a5 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -24,7 +24,7 @@ impl C as Core.AddWith(C) where .Result = C { } } impl C as Core.AddAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %AddAssignWith.type.133: type = facet_type <@AddAssignWith, @AddAssignWith(%C)> [concrete] // CHECK:STDOUT: %AddAssignWith.Op.type.5af: type = fn_type @AddAssignWith.Op, @AddAssignWith(%C) [concrete] // CHECK:STDOUT: %AddAssignWith.impl_witness: = impl_witness file.%AddAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type.c84368.1: type = fn_type @C.as.AddAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.4b9a01.1: %C.as.AddAssignWith.impl.Op.type.c84368.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type: type = fn_type @C.as.AddAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op: %C.as.AddAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %AddAssignWith.facet: %AddAssignWith.type.133 = facet_value %C, (%AddAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type.c84368.2: type = fn_type @C.as.AddAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.4b9a01.2: %C.as.AddAssignWith.impl.Op.type.c84368.2 = struct_value () [concrete] // CHECK:STDOUT: %.7f4: type = fn_type_with_self_type %AddWith.Op.type.45e, %AddWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.277: type = fn_type_with_self_type %AddAssignWith.Op.type.5af, %AddAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.277 = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.2] +// CHECK:STDOUT: %impl.elem0: %.277 = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%C.as.AddAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.AddAssignWith.impl.Op.type.c84368.1 = name_ref Op, @C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.1] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.AddAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/binary_op.carbon.tmpl b/toolchain/check/testdata/operators/overloaded/binary_op.carbon.tmpl index ab37f8839991..29d5ff243ab1 100644 --- a/toolchain/check/testdata/operators/overloaded/binary_op.carbon.tmpl +++ b/toolchain/check/testdata/operators/overloaded/binary_op.carbon.tmpl @@ -2,6 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -19,7 +20,7 @@ impl C as Core.INTERFACEWith(C) where .Result = C { } } impl C as Core.INTERFACEAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index f5dbe51932aa..00c23416c511 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -24,7 +24,7 @@ impl C as Core.BitAndWith(C) where .Result = C { } } impl C as Core.BitAndAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %BitAndAssignWith.type.bc6: type = facet_type <@BitAndAssignWith, @BitAndAssignWith(%C)> [concrete] // CHECK:STDOUT: %BitAndAssignWith.Op.type.73d: type = fn_type @BitAndAssignWith.Op, @BitAndAssignWith(%C) [concrete] // CHECK:STDOUT: %BitAndAssignWith.impl_witness: = impl_witness file.%BitAndAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.type.d236d7.1: type = fn_type @C.as.BitAndAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.83e29f.1: %C.as.BitAndAssignWith.impl.Op.type.d236d7.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.type: type = fn_type @C.as.BitAndAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op: %C.as.BitAndAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %BitAndAssignWith.facet: %BitAndAssignWith.type.bc6 = facet_value %C, (%BitAndAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.type.d236d7.2: type = fn_type @C.as.BitAndAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.83e29f.2: %C.as.BitAndAssignWith.impl.Op.type.d236d7.2 = struct_value () [concrete] // CHECK:STDOUT: %.f52: type = fn_type_with_self_type %BitAndWith.Op.type.914, %BitAndWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.ef9: type = fn_type_with_self_type %BitAndAssignWith.Op.type.73d, %BitAndAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.ef9 = impl_witness_access constants.%BitAndAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitAndAssignWith.impl.Op.83e29f.2] +// CHECK:STDOUT: %impl.elem0: %.ef9 = impl_witness_access constants.%BitAndAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitAndAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.BitAndAssignWith.impl.Op.type.d236d7.1 = name_ref Op, @C.as.BitAndAssignWith.impl.%C.as.BitAndAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.BitAndAssignWith.impl.Op.83e29f.1] -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.BitAndAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.BitAndAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index c222f38e61aa..56abee7c2c4e 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -24,7 +24,7 @@ impl C as Core.BitOrWith(C) where .Result = C { } } impl C as Core.BitOrAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %BitOrAssignWith.type.de7: type = facet_type <@BitOrAssignWith, @BitOrAssignWith(%C)> [concrete] // CHECK:STDOUT: %BitOrAssignWith.Op.type.efc: type = fn_type @BitOrAssignWith.Op, @BitOrAssignWith(%C) [concrete] // CHECK:STDOUT: %BitOrAssignWith.impl_witness: = impl_witness file.%BitOrAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.type.ded844.1: type = fn_type @C.as.BitOrAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.d88626.1: %C.as.BitOrAssignWith.impl.Op.type.ded844.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.type: type = fn_type @C.as.BitOrAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op: %C.as.BitOrAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %BitOrAssignWith.facet: %BitOrAssignWith.type.de7 = facet_value %C, (%BitOrAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.type.ded844.2: type = fn_type @C.as.BitOrAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.d88626.2: %C.as.BitOrAssignWith.impl.Op.type.ded844.2 = struct_value () [concrete] // CHECK:STDOUT: %.6a1: type = fn_type_with_self_type %BitOrWith.Op.type.501, %BitOrWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.59c: type = fn_type_with_self_type %BitOrAssignWith.Op.type.efc, %BitOrAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.59c = impl_witness_access constants.%BitOrAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitOrAssignWith.impl.Op.d88626.2] +// CHECK:STDOUT: %impl.elem0: %.59c = impl_witness_access constants.%BitOrAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitOrAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.BitOrAssignWith.impl.Op.type.ded844.1 = name_ref Op, @C.as.BitOrAssignWith.impl.%C.as.BitOrAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.BitOrAssignWith.impl.Op.d88626.1] -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.BitOrAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.BitOrAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index a723d02ea3cf..d02eaa6bcb16 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -24,7 +24,7 @@ impl C as Core.BitXorWith(C) where .Result = C { } } impl C as Core.BitXorAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %BitXorAssignWith.type.38a: type = facet_type <@BitXorAssignWith, @BitXorAssignWith(%C)> [concrete] // CHECK:STDOUT: %BitXorAssignWith.Op.type.ad0: type = fn_type @BitXorAssignWith.Op, @BitXorAssignWith(%C) [concrete] // CHECK:STDOUT: %BitXorAssignWith.impl_witness: = impl_witness file.%BitXorAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.type.82422e.1: type = fn_type @C.as.BitXorAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.0d9889.1: %C.as.BitXorAssignWith.impl.Op.type.82422e.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.type: type = fn_type @C.as.BitXorAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op: %C.as.BitXorAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %BitXorAssignWith.facet: %BitXorAssignWith.type.38a = facet_value %C, (%BitXorAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.type.82422e.2: type = fn_type @C.as.BitXorAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.0d9889.2: %C.as.BitXorAssignWith.impl.Op.type.82422e.2 = struct_value () [concrete] // CHECK:STDOUT: %.afd: type = fn_type_with_self_type %BitXorWith.Op.type.502, %BitXorWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.d84: type = fn_type_with_self_type %BitXorAssignWith.Op.type.ad0, %BitXorAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.d84 = impl_witness_access constants.%BitXorAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitXorAssignWith.impl.Op.0d9889.2] +// CHECK:STDOUT: %impl.elem0: %.d84 = impl_witness_access constants.%BitXorAssignWith.impl_witness, element0 [concrete = constants.%C.as.BitXorAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.BitXorAssignWith.impl.Op.type.82422e.1 = name_ref Op, @C.as.BitXorAssignWith.impl.%C.as.BitXorAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.BitXorAssignWith.impl.Op.0d9889.1] -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.BitXorAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.BitXorAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index b2bf71ef4292..dbf1fd9c8e06 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -19,7 +19,7 @@ package User; class C {}; impl C as Core.Dec { - fn Op[addr self: C*](); + fn Op[ref self: C](); } fn TestOp() { @@ -37,12 +37,9 @@ fn TestOp() { // CHECK:STDOUT: %Dec.type: type = facet_type <@Dec> [concrete] // CHECK:STDOUT: %Dec.Op.type: type = fn_type @Dec.Op [concrete] // CHECK:STDOUT: %Dec.impl_witness: = impl_witness file.%Dec.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.Dec.impl.Op.type.987e49.1: type = fn_type @C.as.Dec.impl.Op.loc22_25.1 [concrete] -// CHECK:STDOUT: %C.as.Dec.impl.Op.26619b.1: %C.as.Dec.impl.Op.type.987e49.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.Dec.impl.Op.type: type = fn_type @C.as.Dec.impl.Op [concrete] +// CHECK:STDOUT: %C.as.Dec.impl.Op: %C.as.Dec.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %Dec.facet: %Dec.type = facet_value %C, (%Dec.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.Dec.impl.Op.type.987e49.2: type = fn_type @C.as.Dec.impl.Op.loc22_25.2 [concrete] -// CHECK:STDOUT: %C.as.Dec.impl.Op.26619b.2: %C.as.Dec.impl.Op.type.987e49.2 = struct_value () [concrete] // CHECK:STDOUT: %.475: type = fn_type_with_self_type %Dec.Op.type, %Dec.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -53,12 +50,9 @@ fn TestOp() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c -// CHECK:STDOUT: %impl.elem0: %.475 = impl_witness_access constants.%Dec.impl_witness, element0 [concrete = constants.%C.as.Dec.impl.Op.26619b.2] +// CHECK:STDOUT: %impl.elem0: %.475 = impl_witness_access constants.%Dec.impl_witness, element0 [concrete = constants.%C.as.Dec.impl.Op] // CHECK:STDOUT: %bound_method.loc28: = bound_method %c.ref, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.Dec.impl.Op.type.987e49.1 = name_ref Op, @C.as.Dec.impl.%C.as.Dec.impl.Op.decl.loc22_25.1 [concrete = constants.%C.as.Dec.impl.Op.26619b.1] -// CHECK:STDOUT: %C.as.Dec.impl.Op.bound: = bound_method %c.ref, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %c.ref -// CHECK:STDOUT: %C.as.Dec.impl.Op.call: init %empty_tuple.type = call %C.as.Dec.impl.Op.bound(%addr) +// CHECK:STDOUT: %C.as.Dec.impl.Op.call: init %empty_tuple.type = call %bound_method.loc28(%c.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index 33e820acd6a4..97567edfc03b 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -24,7 +24,7 @@ impl C as Core.DivWith(C) where .Result = C { } } impl C as Core.DivAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %DivAssignWith.type.226: type = facet_type <@DivAssignWith, @DivAssignWith(%C)> [concrete] // CHECK:STDOUT: %DivAssignWith.Op.type.629: type = fn_type @DivAssignWith.Op, @DivAssignWith(%C) [concrete] // CHECK:STDOUT: %DivAssignWith.impl_witness: = impl_witness file.%DivAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.type.5f57b0.1: type = fn_type @C.as.DivAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.2223e8.1: %C.as.DivAssignWith.impl.Op.type.5f57b0.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.type: type = fn_type @C.as.DivAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op: %C.as.DivAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %DivAssignWith.facet: %DivAssignWith.type.226 = facet_value %C, (%DivAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.type.5f57b0.2: type = fn_type @C.as.DivAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.2223e8.2: %C.as.DivAssignWith.impl.Op.type.5f57b0.2 = struct_value () [concrete] // CHECK:STDOUT: %.b0b: type = fn_type_with_self_type %DivWith.Op.type.c4b, %DivWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.5f7: type = fn_type_with_self_type %DivAssignWith.Op.type.629, %DivAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.5f7 = impl_witness_access constants.%DivAssignWith.impl_witness, element0 [concrete = constants.%C.as.DivAssignWith.impl.Op.2223e8.2] +// CHECK:STDOUT: %impl.elem0: %.5f7 = impl_witness_access constants.%DivAssignWith.impl_witness, element0 [concrete = constants.%C.as.DivAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.DivAssignWith.impl.Op.type.5f57b0.1 = name_ref Op, @C.as.DivAssignWith.impl.%C.as.DivAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.DivAssignWith.impl.Op.2223e8.1] -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.DivAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.DivAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index 47c917349cb3..5f62248160f6 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -17,19 +17,19 @@ package User; class C {}; impl C as Core.Inc { - fn Op[addr self: C*](); + fn Op[ref self: C](); } impl C as Core.AddAssignWith(C) { - fn Op[addr self: C*](other: C); + fn Op[ref self: C](other: C); } fn TestIncNonRef(a: C) { // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+7]]:5: error: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: ++a; // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/operators/arithmetic.carbon:34:9: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Op[ref self: Self](); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-10]]:9: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fn Op[ref self: C](); + // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: ++a; } @@ -38,9 +38,9 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+7]]:3: error: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: a += b; // CHECK:STDERR: ^ - // CHECK:STDERR: {{.*}}/prelude/operators/arithmetic.carbon:29:9: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fn Op[ref self: Self](other: Other); - // CHECK:STDERR: ^~~~~~~~~~~~~~ + // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-18]]:9: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: fn Op[ref self: C](other: C); + // CHECK:STDERR: ^~~~~~~~~~~ // CHECK:STDERR: a += b; } @@ -55,25 +55,18 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [concrete] // CHECK:STDOUT: %Inc.Op.type: type = fn_type @Inc.Op [concrete] // CHECK:STDOUT: %Inc.impl_witness: = impl_witness file.%Inc.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete] -// CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.type.739936.1: type = fn_type @C.as.Inc.impl.Op.loc20_25.1 [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.6c8e2d.1: %C.as.Inc.impl.Op.type.739936.1 = struct_value () [concrete] -// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %C, (%Inc.impl_witness) [concrete] // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.type.739936.2: type = fn_type @C.as.Inc.impl.Op.loc20_25.2 [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.6c8e2d.2: %C.as.Inc.impl.Op.type.739936.2 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.Inc.impl.Op.type: type = fn_type @C.as.Inc.impl.Op [concrete] +// CHECK:STDOUT: %C.as.Inc.impl.Op: %C.as.Inc.impl.Op.type = struct_value () [concrete] +// CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %C, (%Inc.impl_witness) [concrete] // CHECK:STDOUT: %AddAssignWith.type.fc6: type = generic_interface_type @AddAssignWith [concrete] // CHECK:STDOUT: %AddAssignWith.generic: %AddAssignWith.type.fc6 = struct_value () [concrete] // CHECK:STDOUT: %AddAssignWith.type.133: type = facet_type <@AddAssignWith, @AddAssignWith(%C)> [concrete] // CHECK:STDOUT: %AddAssignWith.Op.type.5af: type = fn_type @AddAssignWith.Op, @AddAssignWith(%C) [concrete] // CHECK:STDOUT: %AddAssignWith.impl_witness: = impl_witness file.%AddAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type.c84368.1: type = fn_type @C.as.AddAssignWith.impl.Op.loc23_33.1 [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.4b9a01.1: %C.as.AddAssignWith.impl.Op.type.c84368.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type: type = fn_type @C.as.AddAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op: %C.as.AddAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %AddAssignWith.facet: %AddAssignWith.type.133 = facet_value %C, (%AddAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.type.c84368.2: type = fn_type @C.as.AddAssignWith.impl.Op.loc23_33.2 [concrete] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.4b9a01.2: %C.as.AddAssignWith.impl.Op.type.c84368.2 = struct_value () [concrete] // CHECK:STDOUT: %TestIncNonRef.type: type = fn_type @TestIncNonRef [concrete] // CHECK:STDOUT: %TestIncNonRef: %TestIncNonRef.type = struct_value () [concrete] // CHECK:STDOUT: %.35f: type = fn_type_with_self_type %Inc.Op.type, %Inc.facet [concrete] @@ -107,7 +100,7 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, imports.%Core.Inc [concrete = constants.%Inc.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %Inc.impl_witness_table = impl_witness_table (@C.as.Inc.impl.%C.as.Inc.impl.Op.decl.loc20_25.2), @C.as.Inc.impl [concrete] +// CHECK:STDOUT: %Inc.impl_witness_table = impl_witness_table (@C.as.Inc.impl.%C.as.Inc.impl.Op.decl), @C.as.Inc.impl [concrete] // CHECK:STDOUT: %Inc.impl_witness: = impl_witness %Inc.impl_witness_table [concrete = constants.%Inc.impl_witness] // CHECK:STDOUT: impl_decl @C.as.AddAssignWith.impl [concrete] {} { // CHECK:STDOUT: %C.ref.loc22_6: type = name_ref C, file.%C.decl [concrete = constants.%C] @@ -116,7 +109,7 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %C.ref.loc22_30: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %AddAssignWith.type: type = facet_type <@AddAssignWith, @AddAssignWith(constants.%C)> [concrete = constants.%AddAssignWith.type.133] // CHECK:STDOUT: } -// CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (@C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl.loc23_33.2), @C.as.AddAssignWith.impl [concrete] +// CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (@C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl), @C.as.AddAssignWith.impl [concrete] // CHECK:STDOUT: %AddAssignWith.impl_witness: = impl_witness %AddAssignWith.impl_witness_table [concrete = constants.%AddAssignWith.impl_witness] // CHECK:STDOUT: %TestIncNonRef.decl: %TestIncNonRef.type = fn_decl @TestIncNonRef [concrete = constants.%TestIncNonRef] { // CHECK:STDOUT: %a.patt: %pattern_type.c48 = value_binding_pattern a [concrete] @@ -142,65 +135,39 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @C.as.Inc.impl: %C.ref as %Inc.ref { -// CHECK:STDOUT: %C.as.Inc.impl.Op.decl.loc20_25.1: %C.as.Inc.impl.Op.type.739936.1 = fn_decl @C.as.Inc.impl.Op.loc20_25.1 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.1] { -// CHECK:STDOUT: %self.patt: %pattern_type.44a = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.44a = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc20_9: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.019 = value_param call_param0 -// CHECK:STDOUT: %.loc20_21: type = splice_block %ptr [concrete = constants.%ptr.019] { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr: type = ptr_type %C.ref [concrete = constants.%ptr.019] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.019 = value_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %C.as.Inc.impl.Op.decl.loc20_25.2: %C.as.Inc.impl.Op.type.739936.2 = fn_decl @C.as.Inc.impl.Op.loc20_25.2 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.2] { +// CHECK:STDOUT: %C.as.Inc.impl.Op.decl: %C.as.Inc.impl.Op.type = fn_decl @C.as.Inc.impl.Op [concrete = constants.%C.as.Inc.impl.Op] { // CHECK:STDOUT: %self.patt: %pattern_type.c48 = ref_binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = ref_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %C = ref_param call_param0 +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %self: ref %C = ref_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = -// CHECK:STDOUT: .Op = %C.as.Inc.impl.Op.decl.loc20_25.1 +// CHECK:STDOUT: .Op = %C.as.Inc.impl.Op.decl // CHECK:STDOUT: witness = file.%Inc.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @C.as.AddAssignWith.impl: %C.ref.loc22_6 as %AddAssignWith.type { -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.decl.loc23_33.1: %C.as.AddAssignWith.impl.Op.type.c84368.1 = fn_decl @C.as.AddAssignWith.impl.Op.loc23_33.1 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.1] { -// CHECK:STDOUT: %self.patt: %pattern_type.44a = value_binding_pattern self [concrete] -// CHECK:STDOUT: %self.param_patt: %pattern_type.44a = value_param_pattern %self.patt, call_param0 [concrete] -// CHECK:STDOUT: %.loc23_9: %pattern_type.f6d = addr_pattern %self.param_patt [concrete] -// CHECK:STDOUT: %other.patt: %pattern_type.c48 = value_binding_pattern other [concrete] -// CHECK:STDOUT: %other.param_patt: %pattern_type.c48 = value_param_pattern %other.patt, call_param1 [concrete] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: %ptr.019 = value_param call_param0 -// CHECK:STDOUT: %.loc23_21: type = splice_block %ptr [concrete = constants.%ptr.019] { -// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr: type = ptr_type %C.ref.loc23_20 [concrete = constants.%ptr.019] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: %ptr.019 = value_binding self, %self.param -// CHECK:STDOUT: %other.param: %C = value_param call_param1 -// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %other: %C = value_binding other, %other.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.decl.loc23_33.2: %C.as.AddAssignWith.impl.Op.type.c84368.2 = fn_decl @C.as.AddAssignWith.impl.Op.loc23_33.2 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.2] { +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.decl: %C.as.AddAssignWith.impl.Op.type = fn_decl @C.as.AddAssignWith.impl.Op [concrete = constants.%C.as.AddAssignWith.impl.Op] { // CHECK:STDOUT: %self.patt: %pattern_type.c48 = ref_binding_pattern self [concrete] // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = ref_param_pattern %self.patt, call_param0 [concrete] // CHECK:STDOUT: %other.patt: %pattern_type.c48 = value_binding_pattern other [concrete] // CHECK:STDOUT: %other.param_patt: %pattern_type.c48 = value_param_pattern %other.patt, call_param1 [concrete] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: ref %C = ref_param call_param0 +// CHECK:STDOUT: %C.ref.loc23_19: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %self: ref %C = ref_binding self, %self.param // CHECK:STDOUT: %other.param: %C = value_param call_param1 +// CHECK:STDOUT: %C.ref.loc23_29: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %other: %C = value_binding other, %other.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = -// CHECK:STDOUT: .Op = %C.as.AddAssignWith.impl.Op.decl.loc23_33.1 +// CHECK:STDOUT: .Op = %C.as.AddAssignWith.impl.Op.decl // CHECK:STDOUT: witness = file.%AddAssignWith.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: @@ -212,40 +179,16 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.Inc.impl.Op.loc20_25.1(%self.param: %ptr.019); +// CHECK:STDOUT: fn @C.as.Inc.impl.Op(%self.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.Inc.impl.Op.loc20_25.2(%self.param: %C) [thunk @C.as.Inc.impl.%C.as.Inc.impl.Op.decl.loc20_25.1] { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Op.ref: %C.as.Inc.impl.Op.type.739936.1 = name_ref Op, @C.as.Inc.impl.%C.as.Inc.impl.Op.decl.loc20_25.1 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.1] -// CHECK:STDOUT: %self.ref: ref %C = name_ref self, %self.param -// CHECK:STDOUT: %C.as.Inc.impl.Op.bound: = bound_method %self.ref, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %self.ref -// CHECK:STDOUT: %C.as.Inc.impl.Op.call: init %empty_tuple.type = call %C.as.Inc.impl.Op.bound(%addr) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.AddAssignWith.impl.Op.loc23_33.1(%self.param: %ptr.019, %other.param: %C); -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.AddAssignWith.impl.Op.loc23_33.2(%self.param: %C, %other.param: %C) [thunk @C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl.loc23_33.1] { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Op.ref: %C.as.AddAssignWith.impl.Op.type.c84368.1 = name_ref Op, @C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl.loc23_33.1 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.1] -// CHECK:STDOUT: %self.ref: ref %C = name_ref self, %self.param -// CHECK:STDOUT: %other.ref: %C = name_ref other, %other.param -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.bound: = bound_method %self.ref, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %self.ref -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.AddAssignWith.impl.Op.bound(%addr, %other.ref) -// CHECK:STDOUT: return -// CHECK:STDOUT: } +// CHECK:STDOUT: fn @C.as.AddAssignWith.impl.Op(%self.param: %C, %other.param: %C); // CHECK:STDOUT: // CHECK:STDOUT: fn @TestIncNonRef(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %C = name_ref a, %a -// CHECK:STDOUT: %impl.elem0: %.35f = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.2] +// CHECK:STDOUT: %impl.elem0: %.35f = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%C.as.Inc.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.Inc.impl.Op.type.739936.1 = name_ref Op, @C.as.Inc.impl.%C.as.Inc.impl.Op.decl.loc20_25.1 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.1] -// CHECK:STDOUT: %C.as.Inc.impl.Op.bound: = bound_method , %Op.ref [concrete = ] -// CHECK:STDOUT: %addr: = addr_of [concrete = ] -// CHECK:STDOUT: %C.as.Inc.impl.Op.call: init %empty_tuple.type = call %C.as.Inc.impl.Op.bound() [concrete = ] +// CHECK:STDOUT: %C.as.Inc.impl.Op.call: init %empty_tuple.type = call %bound_method() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,12 +196,9 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %C = name_ref a, %a // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.277 = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.2] +// CHECK:STDOUT: %impl.elem0: %.277 = impl_witness_access constants.%AddAssignWith.impl_witness, element0 [concrete = constants.%C.as.AddAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %a.ref, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.AddAssignWith.impl.Op.type.c84368.1 = name_ref Op, @C.as.AddAssignWith.impl.%C.as.AddAssignWith.impl.Op.decl.loc23_33.1 [concrete = constants.%C.as.AddAssignWith.impl.Op.4b9a01.1] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.bound: = bound_method , %Op.ref [concrete = ] -// CHECK:STDOUT: %addr: = addr_of [concrete = ] -// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.AddAssignWith.impl.Op.bound(, %b.ref) +// CHECK:STDOUT: %C.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 0a3e4b115f3a..cac8f5785349 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -19,7 +19,7 @@ impl C as Core.AddWith(C) where .Result = C { fn Op[self: C](other: C) -> C { return {}; } } impl C as Core.AddAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn Test(a: C, b: D, z: bool) -> C { diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index ad580e767443..5ba358fb33e7 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -19,7 +19,7 @@ package User; class C {}; impl C as Core.Inc { - fn Op[addr self: C*](); + fn Op[ref self: C](); } fn TestOp() { @@ -37,12 +37,9 @@ fn TestOp() { // CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [concrete] // CHECK:STDOUT: %Inc.Op.type: type = fn_type @Inc.Op [concrete] // CHECK:STDOUT: %Inc.impl_witness: = impl_witness file.%Inc.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.type.739936.1: type = fn_type @C.as.Inc.impl.Op.loc22_25.1 [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.6c8e2d.1: %C.as.Inc.impl.Op.type.739936.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.Inc.impl.Op.type: type = fn_type @C.as.Inc.impl.Op [concrete] +// CHECK:STDOUT: %C.as.Inc.impl.Op: %C.as.Inc.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %Inc.facet: %Inc.type = facet_value %C, (%Inc.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.type.739936.2: type = fn_type @C.as.Inc.impl.Op.loc22_25.2 [concrete] -// CHECK:STDOUT: %C.as.Inc.impl.Op.6c8e2d.2: %C.as.Inc.impl.Op.type.739936.2 = struct_value () [concrete] // CHECK:STDOUT: %.35f: type = fn_type_with_self_type %Inc.Op.type, %Inc.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -53,12 +50,9 @@ fn TestOp() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: %c.ref: ref %C = name_ref c, %c -// CHECK:STDOUT: %impl.elem0: %.35f = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.2] +// CHECK:STDOUT: %impl.elem0: %.35f = impl_witness_access constants.%Inc.impl_witness, element0 [concrete = constants.%C.as.Inc.impl.Op] // CHECK:STDOUT: %bound_method.loc28: = bound_method %c.ref, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.Inc.impl.Op.type.739936.1 = name_ref Op, @C.as.Inc.impl.%C.as.Inc.impl.Op.decl.loc22_25.1 [concrete = constants.%C.as.Inc.impl.Op.6c8e2d.1] -// CHECK:STDOUT: %C.as.Inc.impl.Op.bound: = bound_method %c.ref, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %c.ref -// CHECK:STDOUT: %C.as.Inc.impl.Op.call: init %empty_tuple.type = call %C.as.Inc.impl.Op.bound(%addr) +// CHECK:STDOUT: %C.as.Inc.impl.Op.call: init %empty_tuple.type = call %bound_method.loc28(%c.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index e3765029658a..4be2228f346e 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -24,7 +24,7 @@ impl C as Core.LeftShiftWith(C) where .Result = C { } } impl C as Core.LeftShiftAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %LeftShiftAssignWith.type.981: type = facet_type <@LeftShiftAssignWith, @LeftShiftAssignWith(%C)> [concrete] // CHECK:STDOUT: %LeftShiftAssignWith.Op.type.30f: type = fn_type @LeftShiftAssignWith.Op, @LeftShiftAssignWith(%C) [concrete] // CHECK:STDOUT: %LeftShiftAssignWith.impl_witness: = impl_witness file.%LeftShiftAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.type.872f1d.1: type = fn_type @C.as.LeftShiftAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.6f2693.1: %C.as.LeftShiftAssignWith.impl.Op.type.872f1d.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.type: type = fn_type @C.as.LeftShiftAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op: %C.as.LeftShiftAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %LeftShiftAssignWith.facet: %LeftShiftAssignWith.type.981 = facet_value %C, (%LeftShiftAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.type.872f1d.2: type = fn_type @C.as.LeftShiftAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.6f2693.2: %C.as.LeftShiftAssignWith.impl.Op.type.872f1d.2 = struct_value () [concrete] // CHECK:STDOUT: %.944: type = fn_type_with_self_type %LeftShiftWith.Op.type.097, %LeftShiftWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.f59: type = fn_type_with_self_type %LeftShiftAssignWith.Op.type.30f, %LeftShiftAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.f59 = impl_witness_access constants.%LeftShiftAssignWith.impl_witness, element0 [concrete = constants.%C.as.LeftShiftAssignWith.impl.Op.6f2693.2] +// CHECK:STDOUT: %impl.elem0: %.f59 = impl_witness_access constants.%LeftShiftAssignWith.impl_witness, element0 [concrete = constants.%C.as.LeftShiftAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.LeftShiftAssignWith.impl.Op.type.872f1d.1 = name_ref Op, @C.as.LeftShiftAssignWith.impl.%C.as.LeftShiftAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.LeftShiftAssignWith.impl.Op.6f2693.1] -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.LeftShiftAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.LeftShiftAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index 51bb07a28454..6c89a60bfe85 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -24,7 +24,7 @@ impl C as Core.ModWith(C) where .Result = C { } } impl C as Core.ModAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %ModAssignWith.type.444: type = facet_type <@ModAssignWith, @ModAssignWith(%C)> [concrete] // CHECK:STDOUT: %ModAssignWith.Op.type.dd0: type = fn_type @ModAssignWith.Op, @ModAssignWith(%C) [concrete] // CHECK:STDOUT: %ModAssignWith.impl_witness: = impl_witness file.%ModAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.type.c83a47.1: type = fn_type @C.as.ModAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.e210c4.1: %C.as.ModAssignWith.impl.Op.type.c83a47.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.type: type = fn_type @C.as.ModAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op: %C.as.ModAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %ModAssignWith.facet: %ModAssignWith.type.444 = facet_value %C, (%ModAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.type.c83a47.2: type = fn_type @C.as.ModAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.e210c4.2: %C.as.ModAssignWith.impl.Op.type.c83a47.2 = struct_value () [concrete] // CHECK:STDOUT: %.e00: type = fn_type_with_self_type %ModWith.Op.type.140, %ModWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.a3f: type = fn_type_with_self_type %ModAssignWith.Op.type.dd0, %ModAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.a3f = impl_witness_access constants.%ModAssignWith.impl_witness, element0 [concrete = constants.%C.as.ModAssignWith.impl.Op.e210c4.2] +// CHECK:STDOUT: %impl.elem0: %.a3f = impl_witness_access constants.%ModAssignWith.impl_witness, element0 [concrete = constants.%C.as.ModAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.ModAssignWith.impl.Op.type.c83a47.1 = name_ref Op, @C.as.ModAssignWith.impl.%C.as.ModAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.ModAssignWith.impl.Op.e210c4.1] -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.ModAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.ModAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index fc35f5590921..15af57ee1184 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -24,7 +24,7 @@ impl C as Core.MulWith(C) where .Result = C { } } impl C as Core.MulAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %MulAssignWith.type.c63: type = facet_type <@MulAssignWith, @MulAssignWith(%C)> [concrete] // CHECK:STDOUT: %MulAssignWith.Op.type.5c8: type = fn_type @MulAssignWith.Op, @MulAssignWith(%C) [concrete] // CHECK:STDOUT: %MulAssignWith.impl_witness: = impl_witness file.%MulAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.type.3680c3.1: type = fn_type @C.as.MulAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.594175.1: %C.as.MulAssignWith.impl.Op.type.3680c3.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.type: type = fn_type @C.as.MulAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op: %C.as.MulAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %MulAssignWith.facet: %MulAssignWith.type.c63 = facet_value %C, (%MulAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.type.3680c3.2: type = fn_type @C.as.MulAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.594175.2: %C.as.MulAssignWith.impl.Op.type.3680c3.2 = struct_value () [concrete] // CHECK:STDOUT: %.498: type = fn_type_with_self_type %MulWith.Op.type.2c9, %MulWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.78a: type = fn_type_with_self_type %MulAssignWith.Op.type.5c8, %MulAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.78a = impl_witness_access constants.%MulAssignWith.impl_witness, element0 [concrete = constants.%C.as.MulAssignWith.impl.Op.594175.2] +// CHECK:STDOUT: %impl.elem0: %.78a = impl_witness_access constants.%MulAssignWith.impl_witness, element0 [concrete = constants.%C.as.MulAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.MulAssignWith.impl.Op.type.3680c3.1 = name_ref Op, @C.as.MulAssignWith.impl.%C.as.MulAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.MulAssignWith.impl.Op.594175.1] -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.MulAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.MulAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index 779a3a4b66f8..12ad44d0cd6e 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index de3973c68a41..fbd699acea3d 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -24,7 +24,7 @@ impl C as Core.RightShiftWith(C) where .Result = C { } } impl C as Core.RightShiftAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %RightShiftAssignWith.type.df5: type = facet_type <@RightShiftAssignWith, @RightShiftAssignWith(%C)> [concrete] // CHECK:STDOUT: %RightShiftAssignWith.Op.type.ae9: type = fn_type @RightShiftAssignWith.Op, @RightShiftAssignWith(%C) [concrete] // CHECK:STDOUT: %RightShiftAssignWith.impl_witness: = impl_witness file.%RightShiftAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.type.be40ae.1: type = fn_type @C.as.RightShiftAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.4f8a47.1: %C.as.RightShiftAssignWith.impl.Op.type.be40ae.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.type: type = fn_type @C.as.RightShiftAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op: %C.as.RightShiftAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %RightShiftAssignWith.facet: %RightShiftAssignWith.type.df5 = facet_value %C, (%RightShiftAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.type.be40ae.2: type = fn_type @C.as.RightShiftAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.4f8a47.2: %C.as.RightShiftAssignWith.impl.Op.type.be40ae.2 = struct_value () [concrete] // CHECK:STDOUT: %.919: type = fn_type_with_self_type %RightShiftWith.Op.type.19b, %RightShiftWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.a3c: type = fn_type_with_self_type %RightShiftAssignWith.Op.type.ae9, %RightShiftAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.a3c = impl_witness_access constants.%RightShiftAssignWith.impl_witness, element0 [concrete = constants.%C.as.RightShiftAssignWith.impl.Op.4f8a47.2] +// CHECK:STDOUT: %impl.elem0: %.a3c = impl_witness_access constants.%RightShiftAssignWith.impl_witness, element0 [concrete = constants.%C.as.RightShiftAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.RightShiftAssignWith.impl.Op.type.be40ae.1 = name_ref Op, @C.as.RightShiftAssignWith.impl.%C.as.RightShiftAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.RightShiftAssignWith.impl.Op.4f8a47.1] -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.RightShiftAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.RightShiftAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index b15c267494e7..4c882623a94d 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -24,7 +24,7 @@ impl C as Core.SubWith(C) where .Result = C { } } impl C as Core.SubAssignWith(C) { - fn Op[addr self: C*](other: C) {} + fn Op[ref self: C](other: C) {} } fn TestOp(a: C, b: C) -> C { @@ -53,13 +53,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %SubAssignWith.type.9f4: type = facet_type <@SubAssignWith, @SubAssignWith(%C)> [concrete] // CHECK:STDOUT: %SubAssignWith.Op.type.ffe: type = fn_type @SubAssignWith.Op, @SubAssignWith(%C) [concrete] // CHECK:STDOUT: %SubAssignWith.impl_witness: = impl_witness file.%SubAssignWith.impl_witness_table [concrete] -// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.type.b0e0ea.1: type = fn_type @C.as.SubAssignWith.impl.Op.loc27_34.1 [concrete] -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.d1a6c4.1: %C.as.SubAssignWith.impl.Op.type.b0e0ea.1 = struct_value () [concrete] +// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.type: type = fn_type @C.as.SubAssignWith.impl.Op [concrete] +// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op: %C.as.SubAssignWith.impl.Op.type = struct_value () [concrete] // CHECK:STDOUT: %SubAssignWith.facet: %SubAssignWith.type.9f4 = facet_value %C, (%SubAssignWith.impl_witness) [concrete] -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.type.b0e0ea.2: type = fn_type @C.as.SubAssignWith.impl.Op.loc27_34.2 [concrete] -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.d1a6c4.2: %C.as.SubAssignWith.impl.Op.type.b0e0ea.2 = struct_value () [concrete] // CHECK:STDOUT: %.d5f: type = fn_type_with_self_type %SubWith.Op.type.fc0, %SubWith.facet [concrete] +// CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete] // CHECK:STDOUT: %.52c: type = fn_type_with_self_type %SubAssignWith.Op.type.ffe, %SubAssignWith.facet [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,12 +80,9 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: %ptr.019 = name_ref a, %a // CHECK:STDOUT: %.loc38: ref %C = deref %a.ref // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %impl.elem0: %.52c = impl_witness_access constants.%SubAssignWith.impl_witness, element0 [concrete = constants.%C.as.SubAssignWith.impl.Op.d1a6c4.2] +// CHECK:STDOUT: %impl.elem0: %.52c = impl_witness_access constants.%SubAssignWith.impl_witness, element0 [concrete = constants.%C.as.SubAssignWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %.loc38, %impl.elem0 -// CHECK:STDOUT: %Op.ref: %C.as.SubAssignWith.impl.Op.type.b0e0ea.1 = name_ref Op, @C.as.SubAssignWith.impl.%C.as.SubAssignWith.impl.Op.decl.loc27_34.1 [concrete = constants.%C.as.SubAssignWith.impl.Op.d1a6c4.1] -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.bound: = bound_method %.loc38, %Op.ref -// CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc38 -// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.call: init %empty_tuple.type = call %C.as.SubAssignWith.impl.Op.bound(%addr, %b.ref) +// CHECK:STDOUT: %C.as.SubAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method(%.loc38, %b.ref) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/unary_op.carbon.tmpl b/toolchain/check/testdata/operators/overloaded/unary_op.carbon.tmpl index b34b5f6d13de..ffbda5811eb7 100644 --- a/toolchain/check/testdata/operators/overloaded/unary_op.carbon.tmpl +++ b/toolchain/check/testdata/operators/overloaded/unary_op.carbon.tmpl @@ -2,6 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // diff --git a/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.tmpl b/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.tmpl index 360411f6024c..8e584fe409a9 100644 --- a/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.tmpl +++ b/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.tmpl @@ -2,6 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". // EXTRA-ARGS: --dump-sem-ir-ranges=if-present // @@ -14,7 +15,7 @@ package User; class C {}; impl C as Core.INTERFACE { - fn Op[addr self: C*](); + fn Op[ref self: C](); } fn TestOp() { diff --git a/toolchain/check/thunk.cpp b/toolchain/check/thunk.cpp index cc5a6e95c37a..1c34b1586d08 100644 --- a/toolchain/check/thunk.cpp +++ b/toolchain/check/thunk.cpp @@ -99,10 +99,6 @@ static auto ClonePattern(Context& context, SemIR::SpecificId specific_id, // Decompose the pattern. The forms we allow for patterns in a function // parameter list are currently fairly restrictive. - // Optional `addr`, only for `self`. - auto [addr, addr_id] = context.insts().TryUnwrap( - pattern, pattern_id, &SemIR::AddrPattern::inner_id); - // Optional parameter pattern. auto [param, param_id] = context.insts().TryUnwrap( pattern, pattern_id, &SemIR::AnyParamPattern::subpattern_id); @@ -133,13 +129,6 @@ static auto ClonePattern(Context& context, SemIR::SpecificId specific_id, .index = SemIR::CallParamIndex::None}); } - // Rebuild `addr`. - if (addr) { - new_pattern_id = RebuildPatternInst( - context, addr_id, - {.type_id = get_type(addr_id), .inner_id = new_pattern_id}); - } - return new_pattern_id; } @@ -291,10 +280,6 @@ static auto BuildPatternRef(Context& context, SemIR::InstId pattern_id) -> SemIR::InstId { auto pattern = context.insts().Get(pattern_id); - auto addr = context.insts() - .TryUnwrap(pattern, pattern_id, &SemIR::AddrPattern::inner_id) - .first; - auto pattern_ref_id = SemIR::InstId::None; if (auto value_param = pattern.TryAs(); value_param.has_value() && @@ -309,13 +294,6 @@ static auto BuildPatternRef(Context& context, return SemIR::ErrorInst::InstId; } - if (addr) { - pattern_ref_id = PerformPointerDereference( - context, SemIR::LocId(pattern_id), pattern_ref_id, [](SemIR::TypeId) { - CARBON_FATAL("addr subpattern is not a pointer"); - }); - } - return pattern_ref_id; } diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index 7c21fd5b9e5d..e0a4284ef3a3 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -245,7 +245,6 @@ CARBON_DIAGNOSTIC_KIND(ExternRequiresDeclInApiFile) CARBON_DIAGNOSTIC_KIND(NamespaceDeclNotAtTopLevel) // Function call checking. -CARBON_DIAGNOSTIC_KIND(AddrSelfIsNonRef) CARBON_DIAGNOSTIC_KIND(CallArgCountMismatch) CARBON_DIAGNOSTIC_KIND(CallToNonCallable) CARBON_DIAGNOSTIC_KIND(CppCallArgTypeNotSupported) @@ -399,8 +398,6 @@ CARBON_DIAGNOSTIC_KIND(AbstractTypeInFunctionReturnType) CARBON_DIAGNOSTIC_KIND(AbstractTypeInInit) CARBON_DIAGNOSTIC_KIND(AbstractTypeInVarPattern) CARBON_DIAGNOSTIC_KIND(AddrOfNonRef) -CARBON_DIAGNOSTIC_KIND(AddrOnNonSelfParam) -CARBON_DIAGNOSTIC_KIND(AddrOnNonPointerType) CARBON_DIAGNOSTIC_KIND(ArrayBoundTooLarge) CARBON_DIAGNOSTIC_KIND(ArrayBoundNegative) CARBON_DIAGNOSTIC_KIND(ArrayIndexOutOfBounds) diff --git a/toolchain/lex/token_kind.def b/toolchain/lex/token_kind.def index fe8b98b31e71..6802c8211dc6 100644 --- a/toolchain/lex/token_kind.def +++ b/toolchain/lex/token_kind.def @@ -168,7 +168,6 @@ CARBON_TOKEN_WITH_VIRTUAL_NODE( CARBON_DECL_INTRODUCER_TOKEN(Var, "var")) CARBON_KEYWORD_TOKEN(Abstract, "abstract") -CARBON_KEYWORD_TOKEN(Addr, "addr") CARBON_TOKEN_WITH_VIRTUAL_NODE( CARBON_KEYWORD_TOKEN(And, "and")) CARBON_KEYWORD_TOKEN(Array, "array") diff --git a/toolchain/lower/testdata/array/field_addr.carbon b/toolchain/lower/testdata/array/field_addr.carbon deleted file mode 100644 index cd6d58fdb0b9..000000000000 --- a/toolchain/lower/testdata/array/field_addr.carbon +++ /dev/null @@ -1,89 +0,0 @@ -// 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/int.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/array/field_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/array/field_addr.carbon - -class A { - var v: array(i32, 2); - - fn Init() -> A { return {.v = (1, 2)}; } - - fn Access[self: Self]() -> i32 { - return self.v[0]; - } - - fn Use[addr self: Self*]() -> i32 { - self->v[0] = 1; - return self->v[1]; - } -} - -// CHECK:STDOUT: ; ModuleID = 'field_addr.carbon' -// CHECK:STDOUT: source_filename = "field_addr.carbon" -// CHECK:STDOUT: -// CHECK:STDOUT: @A.val.loc16_40 = internal constant { [2 x i32] } { [2 x i32] [i32 1, i32 2] } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) #0 !dbg !4 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc16_39.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc16_38.3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 0, !dbg !8 -// CHECK:STDOUT: %.loc16_38.6.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 1, !dbg !8 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @A.val.loc16_40, i64 8, i1 false), !dbg !9 -// CHECK:STDOUT: ret void, !dbg !9 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) #0 !dbg !10 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc19_16.1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11 -// CHECK:STDOUT: %.loc19_20.2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16.1.v, i32 0, i32 0, !dbg !11 -// CHECK:STDOUT: %.loc19_20.3 = load i32, ptr %.loc19_20.2.array.index, align 4, !dbg !11 -// CHECK:STDOUT: ret i32 %.loc19_20.3, !dbg !12 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) #0 !dbg !13 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc23_9.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14 -// CHECK:STDOUT: %.loc23_14.array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9.2.v, i32 0, i32 0, !dbg !14 -// CHECK:STDOUT: store i32 1, ptr %.loc23_14.array.index, align 4, !dbg !14 -// CHECK:STDOUT: %.loc24_16.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !15 -// CHECK:STDOUT: %.loc24_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc24_16.2.v, i32 0, i32 1, !dbg !15 -// CHECK:STDOUT: %.loc24_21.2 = load i32, ptr %.loc24_21.1.array.index, align 4, !dbg !15 -// CHECK:STDOUT: ret i32 %.loc24_21.2, !dbg !16 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nounwind } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: -// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} -// CHECK:STDOUT: !llvm.dbg.cu = !{!2} -// CHECK:STDOUT: -// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} -// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} -// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "field_addr.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Init", linkageName: "_CInit.A.Main", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) -// CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 27, scope: !4) -// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 33, scope: !4) -// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 20, scope: !4) -// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Access", linkageName: "_CAccess.A.Main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !11 = !DILocation(line: 19, column: 12, scope: !10) -// CHECK:STDOUT: !12 = !DILocation(line: 19, column: 5, scope: !10) -// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Use", linkageName: "_CUse.A.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !14 = !DILocation(line: 23, column: 5, scope: !13) -// CHECK:STDOUT: !15 = !DILocation(line: 24, column: 12, scope: !13) -// CHECK:STDOUT: !16 = !DILocation(line: 24, column: 5, scope: !13) diff --git a/toolchain/lower/testdata/class/method_addr.carbon b/toolchain/lower/testdata/class/method_addr.carbon deleted file mode 100644 index 5d0c35faa983..000000000000 --- a/toolchain/lower/testdata/class/method_addr.carbon +++ /dev/null @@ -1,54 +0,0 @@ -// 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/int.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/method_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/method_addr.carbon - -class C { - var a: i32; - - fn Get[self: C]() -> i32; - fn Set[addr self: C*](n: i32); -} - -fn F(p: C*) { - let n: i32 = (*p).Get(); - (*p).Set(n); -} - -// CHECK:STDOUT: ; ModuleID = 'method_addr.carbon' -// CHECK:STDOUT: source_filename = "method_addr.carbon" -// CHECK:STDOUT: -// CHECK:STDOUT: declare i32 @_CGet.C.Main(ptr) -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CSet.C.Main(ptr, i32) -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CF.Main(ptr %p) #0 !dbg !4 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %C.Get.call = call i32 @_CGet.C.Main(ptr %p), !dbg !7 -// CHECK:STDOUT: call void @_CSet.C.Main(ptr %p, i32 %C.Get.call), !dbg !8 -// CHECK:STDOUT: ret void, !dbg !9 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nounwind } -// CHECK:STDOUT: -// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} -// CHECK:STDOUT: !llvm.dbg.cu = !{!2} -// CHECK:STDOUT: -// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} -// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} -// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "method_addr.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.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: 21, column: 16, scope: !4) -// CHECK:STDOUT: !8 = !DILocation(line: 22, column: 3, scope: !4) -// CHECK:STDOUT: !9 = !DILocation(line: 20, column: 1, scope: !4) diff --git a/toolchain/lower/testdata/class/self_addr.carbon b/toolchain/lower/testdata/class/self_addr.carbon deleted file mode 100644 index d757c5a4dc66..000000000000 --- a/toolchain/lower/testdata/class/self_addr.carbon +++ /dev/null @@ -1,63 +0,0 @@ -// 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/int.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/self_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/self_addr.carbon - -class C { - var a: i32; - - fn Get[self: C]() -> i32; - fn Set[addr self: C*](); -} - -fn C.Get[self: C]() -> i32 { - return self.a; -} - -fn C.Set[addr self: C*]() { - (*self).a = 1; -} - -// CHECK:STDOUT: ; ModuleID = 'self_addr.carbon' -// CHECK:STDOUT: source_filename = "self_addr.carbon" -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CGet.C.Main(ptr %self) #0 !dbg !4 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc21_14.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 -// CHECK:STDOUT: %.loc21_14.2 = load i32, ptr %.loc21_14.1.a, align 4, !dbg !7 -// CHECK:STDOUT: ret i32 %.loc21_14.2, !dbg !8 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CSet.C.Main(ptr %self) #0 !dbg !9 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc25_10.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !10 -// CHECK:STDOUT: store i32 1, ptr %.loc25_10.a, align 4, !dbg !10 -// CHECK:STDOUT: ret void, !dbg !11 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nounwind } -// CHECK:STDOUT: -// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} -// CHECK:STDOUT: !llvm.dbg.cu = !{!2} -// CHECK:STDOUT: -// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} -// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} -// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "self_addr.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.C.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: 21, column: 10, scope: !4) -// CHECK:STDOUT: !8 = !DILocation(line: 21, column: 3, scope: !4) -// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Set", linkageName: "_CSet.C.Main", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !10 = !DILocation(line: 25, column: 3, scope: !9) -// CHECK:STDOUT: !11 = !DILocation(line: 24, column: 1, scope: !9) diff --git a/toolchain/lower/testdata/impl/instance_method_addr.carbon b/toolchain/lower/testdata/impl/instance_method_addr.carbon deleted file mode 100644 index b1a82e79d6bd..000000000000 --- a/toolchain/lower/testdata/impl/instance_method_addr.carbon +++ /dev/null @@ -1,62 +0,0 @@ -// 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/convert.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/instance_method_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/instance_method_addr.carbon - -class A; - -interface GetSelf { - fn Get[addr self: Self*]() -> Self*; -} - -class A { - extend impl as GetSelf { - fn Get[addr self: Self*]() -> Self* { - return self; - } - } -} - -fn Call(a: A*) -> A* { - return (*a).Get(); -} - -// CHECK:STDOUT: ; ModuleID = 'instance_method_addr.carbon' -// CHECK:STDOUT: source_filename = "instance_method_addr.carbon" -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @"_CGet.A.Main:GetSelf.Main"(ptr %self) #0 !dbg !4 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret ptr %self, !dbg !7 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CCall.Main(ptr %a) #0 !dbg !8 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %A.as.GetSelf.impl.Get.call = call ptr @"_CGet.A.Main:GetSelf.Main"(ptr %a), !dbg !9 -// CHECK:STDOUT: ret ptr %A.as.GetSelf.impl.Get.call, !dbg !10 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nounwind } -// CHECK:STDOUT: -// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} -// CHECK:STDOUT: !llvm.dbg.cu = !{!2} -// CHECK:STDOUT: -// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} -// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} -// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) -// CHECK:STDOUT: !3 = !DIFile(filename: "instance_method_addr.carbon", directory: "") -// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.A.Main:GetSelf.Main", scope: null, file: !3, line: 21, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) -// CHECK:STDOUT: !6 = !{} -// CHECK:STDOUT: !7 = !DILocation(line: 22, column: 7, scope: !4) -// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !3, line: 27, type: !5, spFlags: DISPFlagDefinition, unit: !2) -// CHECK:STDOUT: !9 = !DILocation(line: 28, column: 10, scope: !8) -// CHECK:STDOUT: !10 = !DILocation(line: 28, column: 3, scope: !8) diff --git a/toolchain/parse/handle_binding_pattern.cpp b/toolchain/parse/handle_binding_pattern.cpp index 6f321ae0d0d1..daccaff97169 100644 --- a/toolchain/parse/handle_binding_pattern.cpp +++ b/toolchain/parse/handle_binding_pattern.cpp @@ -11,15 +11,6 @@ namespace Carbon::Parse { auto HandleBindingPattern(Context& context) -> void { auto state = context.PopState(); - // An `addr` pattern may wrap the binding, and becomes the parent of the - // `BindingPattern`. - if (auto token = context.ConsumeIf(Lex::TokenKind::Addr)) { - context.PushState({.kind = StateKind::BindingPatternAddr, - .in_var_pattern = state.in_var_pattern, - .token = *token, - .subtree_start = state.subtree_start}); - } - // Handle an invalid pattern introducer for parameters and variables. auto on_error = [&](bool expected_name) { if (!state.has_error) { @@ -145,15 +136,4 @@ auto HandleBindingPatternFinishAsRegular(Context& context) -> void { HandleBindingPatternFinish(context, /*is_compile_time=*/false); } -auto HandleBindingPatternAddr(Context& context) -> void { - auto state = context.PopState(); - - context.AddNode(NodeKind::Addr, state.token, state.has_error); - - // If an error was encountered, propagate it while adding a node. - if (state.has_error) { - context.ReturnErrorOnState(); - } -} - } // namespace Carbon::Parse diff --git a/toolchain/parse/node_kind.def b/toolchain/parse/node_kind.def index 44856e118671..aa89331acf2c 100644 --- a/toolchain/parse/node_kind.def +++ b/toolchain/parse/node_kind.def @@ -176,7 +176,6 @@ CARBON_PARSE_NODE_KIND(VarBindingPattern) CARBON_PARSE_NODE_KIND(TemplateBindingName) CARBON_PARSE_NODE_KIND(CompileTimeBindingPatternStart) CARBON_PARSE_NODE_KIND(CompileTimeBindingPattern) -CARBON_PARSE_NODE_KIND(Addr) CARBON_PARSE_NODE_KIND(LetIntroducer) CARBON_PARSE_NODE_KIND(LetInitializer) diff --git a/toolchain/parse/state.def b/toolchain/parse/state.def index dd8002506eb5..b86bca2d89c7 100644 --- a/toolchain/parse/state.def +++ b/toolchain/parse/state.def @@ -1040,12 +1040,6 @@ CARBON_PARSE_STATE(Pattern) // Handles the initial part of a binding pattern, enqueuing type expression // processing. // -// addr (variant is not Variable) -// ^~~~ -// 3. BindingPatternAddr -// -// THEN -// // [ref] name: ... // ^~~~~ // [ref] self: ... @@ -1069,13 +1063,6 @@ CARBON_PARSE_STATE(Pattern) // 1. BindingPatternFinishAsRegular CARBON_PARSE_STATE(BindingPattern) -// Handles `addr` in a binding pattern. -// -// addr name: type -// ^ -// (state done) -CARBON_PARSE_STATE(BindingPatternAddr) - // Finishes binding pattern processing. // // name: type diff --git a/toolchain/parse/testdata/class/fn_definitions.carbon b/toolchain/parse/testdata/class/fn_definitions.carbon index 4d91aa5c62af..f13b836b9fad 100644 --- a/toolchain/parse/testdata/class/fn_definitions.carbon +++ b/toolchain/parse/testdata/class/fn_definitions.carbon @@ -13,7 +13,7 @@ class Foo { fn Baz[self: Self]() -> i32 { return self.x; } - fn Modify[addr self: Self*]() { self->x = 1; } + fn Modify[ref self: Self]() { self->x = 1; } } // CHECK:STDOUT: - filename: fn_definitions.carbon @@ -60,21 +60,20 @@ class Foo { // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'Modify'}, // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['}, // CHECK:STDOUT: {kind: 'SelfValueName', text: 'self'}, -// CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, -// CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, -// CHECK:STDOUT: {kind: 'Addr', text: 'addr', subtree_size: 5}, -// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 7}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', subtree_size: 2}, +// CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, +// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 6}, // CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, // CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 12}, +// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 11}, // CHECK:STDOUT: {kind: 'SelfValueNameExpr', text: 'self'}, // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'x'}, // CHECK:STDOUT: {kind: 'PointerMemberAccessExpr', text: '->', subtree_size: 3}, // CHECK:STDOUT: {kind: 'IntLiteral', text: '1'}, // CHECK:STDOUT: {kind: 'InfixOperatorEqual', text: '=', subtree_size: 5}, // CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 6}, -// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 19}, -// CHECK:STDOUT: {kind: 'ClassDefinition', text: '}', subtree_size: 57}, +// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18}, +// CHECK:STDOUT: {kind: 'ClassDefinition', text: '}', subtree_size: 56}, // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] diff --git a/toolchain/parse/testdata/function/declaration.carbon b/toolchain/parse/testdata/function/declaration.carbon index b49e48d1e8ee..39e6ff94bc0a 100644 --- a/toolchain/parse/testdata/function/declaration.carbon +++ b/toolchain/parse/testdata/function/declaration.carbon @@ -12,9 +12,9 @@ fn F(); -// --- addr.carbon +// --- ref.carbon -fn foo(addr a: i32*); +fn foo(ref a: i32); // --- implicit_empty.carbon @@ -172,19 +172,18 @@ fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z); // CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 5}, // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDOUT: - filename: addr.carbon +// CHECK:STDOUT: - filename: ref.carbon // CHECK:STDOUT: parse_tree: [ // CHECK:STDOUT: {kind: 'FileStart', text: ''}, // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'foo'}, // CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'a'}, -// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'}, -// CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, -// CHECK:STDOUT: {kind: 'Addr', text: 'addr', subtree_size: 5}, -// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 7}, -// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 10}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', subtree_size: 2}, +// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, +// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 6}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 9}, // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] // CHECK:STDOUT: - filename: implicit_empty.carbon diff --git a/toolchain/parse/testdata/generics/generic_params/template.carbon b/toolchain/parse/testdata/generics/generic_params/template.carbon index f248350dbd2c..06693c761f7f 100644 --- a/toolchain/parse/testdata/generics/generic_params/template.carbon +++ b/toolchain/parse/testdata/generics/generic_params/template.carbon @@ -8,9 +8,31 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/generic_params/template.carbon +// --- basic.carbon + fn foo(template a:! i32); -// CHECK:STDOUT: - filename: template.carbon +// --- fail_template_ref.carbon + +// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+4]]:17: error: expected `:` binding after `ref` [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: fn foo(template ref a:! i32); +// CHECK:STDERR: ^~~ +// CHECK:STDERR: +fn foo(template ref a:! i32); + +// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+4]]:8: error: expected `:!` binding after `template` [ExpectedGenericBindingPatternAfterTemplate] +// CHECK:STDERR: fn foo(template ref a: i32); +// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: +fn foo(template ref a: i32); + +// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+4]]:12: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: fn foo(ref template a:! i32); +// CHECK:STDERR: ^~~~~~~~ +// CHECK:STDERR: +fn foo(ref template a:! i32); + +// CHECK:STDOUT: - filename: basic.carbon // CHECK:STDOUT: parse_tree: [ // CHECK:STDOUT: {kind: 'FileStart', text: ''}, // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, @@ -25,3 +47,37 @@ fn foo(template a:! i32); // CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 10}, // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] +// CHECK:STDOUT: - filename: fail_template_ref.carbon +// CHECK:STDOUT: parse_tree: [ +// CHECK:STDOUT: {kind: 'FileStart', text: ''}, +// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, +// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'foo'}, +// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, +// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'a'}, +// CHECK:STDOUT: {kind: 'TemplateBindingName', text: 'template', subtree_size: 2}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', has_error: yes, subtree_size: 3}, +// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternStart', text: ':!', has_error: yes, subtree_size: 4}, +// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'}, +// CHECK:STDOUT: {kind: 'CompileTimeBindingPattern', text: ':!', has_error: yes, subtree_size: 6}, +// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 8}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 11}, +// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, +// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'foo'}, +// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, +// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'a'}, +// CHECK:STDOUT: {kind: 'TemplateBindingName', text: 'template', has_error: yes, subtree_size: 2}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', has_error: yes, subtree_size: 3}, +// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', has_error: yes, subtree_size: 5}, +// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 7}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 10}, +// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, +// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'foo'}, +// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, +// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'template', has_error: yes}, +// CHECK:STDOUT: {kind: 'InvalidParse', text: 'template', has_error: yes}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: 'ref', has_error: yes, subtree_size: 3}, +// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 5}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8}, +// CHECK:STDOUT: {kind: 'FileEnd', text: ''}, +// CHECK:STDOUT: ] diff --git a/toolchain/parse/testdata/generics/generic_params/template_addr.carbon b/toolchain/parse/testdata/generics/generic_params/template_addr.carbon deleted file mode 100644 index 791fecf524b8..000000000000 --- a/toolchain/parse/testdata/generics/generic_params/template_addr.carbon +++ /dev/null @@ -1,51 +0,0 @@ -// 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/parse/testdata/generics/generic_params/template_addr.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/generic_params/template_addr.carbon - -// --- fail_wrong_order.carbon - -// CHECK:STDERR: fail_wrong_order.carbon:[[@LINE+4]]:17: error: expected name in binding pattern [ExpectedBindingPattern] -// CHECK:STDERR: fn foo(template addr a:! i32); -// CHECK:STDERR: ^~~~ -// CHECK:STDERR: -fn foo(template addr a:! i32); - -// --- correct_order.carbon - -fn bar(addr template b:! i32); - -// CHECK:STDOUT: - filename: fail_wrong_order.carbon -// CHECK:STDOUT: parse_tree: [ -// CHECK:STDOUT: {kind: 'FileStart', text: ''}, -// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, -// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'foo'}, -// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, -// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'addr', has_error: yes}, -// CHECK:STDOUT: {kind: 'InvalidParse', text: 'addr', has_error: yes}, -// CHECK:STDOUT: {kind: 'LetBindingPattern', text: 'template', has_error: yes, subtree_size: 3}, -// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', has_error: yes, subtree_size: 5}, -// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 8}, -// CHECK:STDOUT: {kind: 'FileEnd', text: ''}, -// CHECK:STDOUT: ] -// CHECK:STDOUT: - filename: correct_order.carbon -// CHECK:STDOUT: parse_tree: [ -// CHECK:STDOUT: {kind: 'FileStart', text: ''}, -// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, -// CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'bar'}, -// CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, -// CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'}, -// CHECK:STDOUT: {kind: 'TemplateBindingName', text: 'template', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'CompileTimeBindingPatternStart', text: ':!', subtree_size: 3}, -// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'}, -// CHECK:STDOUT: {kind: 'CompileTimeBindingPattern', text: ':!', subtree_size: 5}, -// CHECK:STDOUT: {kind: 'Addr', text: 'addr', subtree_size: 6}, -// CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 8}, -// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 11}, -// CHECK:STDOUT: {kind: 'FileEnd', text: ''}, -// CHECK:STDOUT: ] diff --git a/toolchain/parse/testdata/generics/interface/self_pointer.carbon b/toolchain/parse/testdata/generics/interface/self_ref.carbon similarity index 74% rename from toolchain/parse/testdata/generics/interface/self_pointer.carbon rename to toolchain/parse/testdata/generics/interface/self_ref.carbon index e78385460090..ccaf7aee3f9b 100644 --- a/toolchain/parse/testdata/generics/interface/self_pointer.carbon +++ b/toolchain/parse/testdata/generics/interface/self_ref.carbon @@ -4,16 +4,16 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/self_pointer.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/self_ref.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/self_pointer.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/self_ref.carbon interface Foo { - fn Sub[addr self: Self*](b: Self) -> Self; - fn Sub[addr self: foo*](b: Self) -> Self; + fn Sub[ref self: Self](b: Self) -> Self; + fn Sub[ref self: foo](b: Self) -> Self; } -// CHECK:STDOUT: - filename: self_pointer.carbon +// CHECK:STDOUT: - filename: self_ref.carbon // CHECK:STDOUT: parse_tree: [ // CHECK:STDOUT: {kind: 'FileStart', text: ''}, // CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'}, @@ -23,11 +23,10 @@ interface Foo { // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'Sub'}, // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['}, // CHECK:STDOUT: {kind: 'SelfValueName', text: 'self'}, -// CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, -// CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, -// CHECK:STDOUT: {kind: 'Addr', text: 'addr', subtree_size: 5}, -// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 7}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', subtree_size: 2}, +// CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, +// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 6}, // CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'}, // CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, @@ -35,16 +34,15 @@ interface Foo { // CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5}, // CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, // CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 17}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 16}, // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'}, // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'Sub'}, // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['}, // CHECK:STDOUT: {kind: 'SelfValueName', text: 'self'}, -// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'foo'}, -// CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, -// CHECK:STDOUT: {kind: 'Addr', text: 'addr', subtree_size: 5}, -// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 7}, +// CHECK:STDOUT: {kind: 'RefBindingName', text: 'ref', subtree_size: 2}, +// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'foo'}, +// CHECK:STDOUT: {kind: 'LetBindingPattern', text: ':', subtree_size: 4}, +// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 6}, // CHECK:STDOUT: {kind: 'ExplicitParamListStart', text: '('}, // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'}, // CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, @@ -52,7 +50,7 @@ interface Foo { // CHECK:STDOUT: {kind: 'ExplicitParamList', text: ')', subtree_size: 5}, // CHECK:STDOUT: {kind: 'SelfTypeNameExpr', text: 'Self'}, // CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2}, -// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 17}, -// CHECK:STDOUT: {kind: 'InterfaceDefinition', text: '}', subtree_size: 38}, +// CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 16}, +// CHECK:STDOUT: {kind: 'InterfaceDefinition', text: '}', subtree_size: 36}, // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] diff --git a/toolchain/parse/typed_nodes.h b/toolchain/parse/typed_nodes.h index f30ed22d7f17..b9f246c5ee3f 100644 --- a/toolchain/parse/typed_nodes.h +++ b/toolchain/parse/typed_nodes.h @@ -387,15 +387,6 @@ struct CompileTimeBindingPattern { AnyExprId type; }; -// An address-of binding: `addr self: Self*`. -struct Addr { - static constexpr auto Kind = NodeKind::Addr.Define( - {.category = NodeCategory::Pattern, .child_count = 1}); - - Lex::AddrTokenIndex token; - AnyPatternId inner; -}; - using TuplePatternStart = LeafNode; using PatternListComma = diff --git a/toolchain/sem_ir/expr_info.cpp b/toolchain/sem_ir/expr_info.cpp index cc2ddfbdb312..da9f9a507680 100644 --- a/toolchain/sem_ir/expr_info.cpp +++ b/toolchain/sem_ir/expr_info.cpp @@ -21,7 +21,6 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { auto untyped_inst = ir->insts().Get(inst_id); CARBON_KIND_SWITCH(untyped_inst) { case AdaptDecl::Kind: - case AddrPattern::Kind: case Assign::Kind: case BaseDecl::Kind: case Branch::Kind: diff --git a/toolchain/sem_ir/function.cpp b/toolchain/sem_ir/function.cpp index 59da7397469e..6157ba444049 100644 --- a/toolchain/sem_ir/function.cpp +++ b/toolchain/sem_ir/function.cpp @@ -113,7 +113,6 @@ auto Function::GetParamPatternInfoFromPatternId(const File& sem_ir, auto inst_id = pattern_id; auto inst = sem_ir.insts().Get(inst_id); - sem_ir.insts().TryUnwrap(inst, inst_id, &AddrPattern::inner_id); sem_ir.insts().TryUnwrap(inst, inst_id, &VarPattern::subpattern_id); auto [param_pattern, param_pattern_id] = sem_ir.insts().TryUnwrap(inst, inst_id, &AnyParamPattern::subpattern_id); diff --git a/toolchain/sem_ir/inst_kind.def b/toolchain/sem_ir/inst_kind.def index 37d6143037b0..03a1b3bbcf1e 100644 --- a/toolchain/sem_ir/inst_kind.def +++ b/toolchain/sem_ir/inst_kind.def @@ -23,7 +23,6 @@ CARBON_SEM_IR_INST_KIND(AccessOptionalMemberAction) CARBON_SEM_IR_INST_KIND(AcquireValue) CARBON_SEM_IR_INST_KIND(AdaptDecl) CARBON_SEM_IR_INST_KIND(AddrOf) -CARBON_SEM_IR_INST_KIND(AddrPattern) CARBON_SEM_IR_INST_KIND(AliasBinding) CARBON_SEM_IR_INST_KIND(ArrayIndex) CARBON_SEM_IR_INST_KIND(ArrayInit) diff --git a/toolchain/sem_ir/pattern.cpp b/toolchain/sem_ir/pattern.cpp index b20dbce83686..8571eb631043 100644 --- a/toolchain/sem_ir/pattern.cpp +++ b/toolchain/sem_ir/pattern.cpp @@ -10,7 +10,7 @@ namespace Carbon::SemIR { // Returns the pattern instruction corresponding to the given ID, after -// unwrapping any simple pattern operators such as `var` and `addr`. +// unwrapping any simple pattern operators such as `var`. static auto GetUnwrapped(const File& sem_ir, InstId pattern_id) -> std::pair { auto inst_id = pattern_id; @@ -21,11 +21,6 @@ static auto GetUnwrapped(const File& sem_ir, InstId pattern_id) inst = sem_ir.insts().Get(inst_id); } - if (auto addr_pattern = inst.TryAs()) { - inst_id = addr_pattern->inner_id; - inst = sem_ir.insts().Get(inst_id); - } - if (auto param_pattern_inst = inst.TryAs()) { inst_id = param_pattern_inst->subpattern_id; inst = sem_ir.insts().Get(inst_id); diff --git a/toolchain/sem_ir/typed_insts.h b/toolchain/sem_ir/typed_insts.h index dcd29cf39142..f41542d00b0c 100644 --- a/toolchain/sem_ir/typed_insts.h +++ b/toolchain/sem_ir/typed_insts.h @@ -133,21 +133,6 @@ struct AddrOf { InstId lvalue_id; }; -// An `addr` pattern, such as `addr self: Self*`. Structurally, `inner_id` will -// generally be a pattern inst. -struct AddrPattern { - static constexpr auto Kind = InstKind::AddrPattern.Define( - {.ir_name = "addr_pattern", - .constant_kind = InstConstantKind::AlwaysUnique, - .is_lowered = false}); - - // Always a PatternType whose scrutinee type represents the pointee type - // corresponding to the pointer type of `inner_id`. - TypeId type_id; - // The `self` binding pattern. - InstId inner_id; -}; - // Binds a name as an alias. See AnyBinding for member documentation. struct AliasBinding { static constexpr auto Kind = InstKind::AliasBinding.Define(