From 06e1d43c2f8a05af9fd862e6497c21741fce85c7 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 3 Mar 2023 18:01:01 +0000 Subject: gccrs: Fix name-resolution to be permissive and carry on There are a few edge cases when resolving TypePaths that we cannot fully resolve to an explicit node_id and this is expected. So for example ::foo A and B are simple Type paths and thats 100% but the segment foo cannot be 100% resolved to an explicit node id as this requires type-resolution to find the correct path. So when we have complex paths such as: <::foo as C> The ::foo part will return UNKNOWN_NODEId and we return early and think its a failure case but its not necessarily a failure but we need to make sure to name resolve C so when we do type-resolution we can resolve C properly. Addresses #1524 Signed-off-by: Philip Herron gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveRelativeQualTypePath::resolve_qual_seg): fix gcc/testsuite/ChangeLog: * rust/compile/parse_associated_type_as_generic_arg3.rs: remove -fsyntax-only --- gcc/rust/resolve/rust-ast-resolve-type.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'gcc/rust/resolve') diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc index 28ab069..f315985 100644 --- a/gcc/rust/resolve/rust-ast-resolve-type.cc +++ b/gcc/rust/resolve/rust-ast-resolve-type.cc @@ -321,16 +321,10 @@ ResolveRelativeQualTypePath::resolve_qual_seg (AST::QualifiedPathType &seg) } auto type = seg.get_type ().get (); - NodeId type_resolved_node = ResolveType::go (type); - if (type_resolved_node == UNKNOWN_NODEID) - return false; - - if (!seg.has_as_clause ()) - return true; + ResolveType::go (type); - NodeId trait_resolved_node = ResolveType::go (&seg.get_as_type_path ()); - if (trait_resolved_node == UNKNOWN_NODEID) - return false; + if (seg.has_as_clause ()) + ResolveType::go (&seg.get_as_type_path ()); return true; } -- cgit v1.1