mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Handle parsing of require...impls declarations (#6255)
Check is not implemented yet, but some tests are added.
This commit is contained in:
@@ -433,7 +433,7 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
|
||||
const auto& impl = context.impls().Get(impl_id);
|
||||
|
||||
if (context.parse_tree().node_kind(self_type_node_id) ==
|
||||
Parse::NodeKind::TypeImplAs) {
|
||||
Parse::NodeKind::ImplTypeAs) {
|
||||
CARBON_DIAGNOSTIC(ExtendImplSelfAs, Error,
|
||||
"cannot `extend` an `impl` with an explicit self type");
|
||||
auto diag = context.emitter().Build(extend_node, ExtendImplSelfAs);
|
||||
@@ -448,7 +448,7 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
|
||||
// The explicit self type is the same as the default self type, so suggest
|
||||
// removing it and recover as if it were not present.
|
||||
if (auto self_as =
|
||||
context.parse_tree_and_subtrees().ExtractAs<Parse::TypeImplAs>(
|
||||
context.parse_tree_and_subtrees().ExtractAs<Parse::ImplTypeAs>(
|
||||
self_type_node_id)) {
|
||||
CARBON_DIAGNOSTIC(ExtendImplSelfAsDefault, Note,
|
||||
"remove the explicit `Self` type here");
|
||||
|
||||
Reference in New Issue
Block a user