mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:11:05 +01:00
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.
This commit is contained in:
@@ -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<SemIR::PointerType>(param_type_id);
|
||||
if (pointer_type) {
|
||||
auto addr_pattern_id = AddPatternInst<SemIR::AddrPattern>(
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user