-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add late name resolution pass #2620
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
8c6d4da
immutable nrctx: new
CohenArthur ab87d01
sesh: [wip][from here tests don't work] Add late name resolution 2.0
CohenArthur 12e8a39
tests: [wip] [fmeup] delete failing tests for now
CohenArthur 22115df
session-manager: [fix me] Start dumping name resolution pass
CohenArthur af8c0bd
session manager: Init Immutable name resolver
CohenArthur 7da69cb
nrctx: add resolved lookup
CohenArthur 5a19a7c
typecheck: [tests fail from here] [needs f'ed up commits] Fetch Immut…
CohenArthur 62f1371
typecheck: Start using nr2.0 properly
CohenArthur 29b7c5d
backend: Use new name resolver where necessary [needs f'ed up commits]
CohenArthur f49671c
nr2.0: Start using newtype pattern for Usage and Declaration
CohenArthur c04726a
late: Setup builtin types properly, change Rib API
CohenArthur 67f1b28
typecheck path: wip
CohenArthur df77f79
toplevel: Add note about resolving glob imports
CohenArthur 230a037
default: Visit external functions properly
CohenArthur 1719fb3
add more name res test casaes
CohenArthur ee4ac05
Fix duplicate detection
P-E-P 723cc17
Change to new resolution 2.0
P-E-P 5ba2a90
Change to name resolution 2.0
P-E-P 4783b1f
Emit error on identical use declarations
P-E-P fbfca21
Change unresolved import error text
P-E-P cae4a70
Change name resolution version in test
P-E-P d60af27
Change name resolution algorithm in one test
P-E-P 825b224
Change name resolution algorithm in test
P-E-P 966932c
Prevent error emission on resolver reentry
P-E-P 15afef4
late: Add bool builtin type
CohenArthur 022d75c
tests: Re-add macro nr2.0 test cases
CohenArthur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
gcc/rust/resolve/rust-immutable-name-resolution-context.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (C) 2020-2023 Free Software Foundation, Inc. | ||
|
||
// This file is part of GCC. | ||
|
||
// GCC is free software; you can redistribute it and/or modify it under | ||
// the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 3, or (at your option) any later | ||
// version. | ||
|
||
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
// for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with GCC; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
#include "rust-immutable-name-resolution-context.h" | ||
|
||
namespace Rust { | ||
namespace Resolver2_0 { | ||
|
||
static ImmutableNameResolutionContext *instance = nullptr; | ||
|
||
const ImmutableNameResolutionContext & | ||
ImmutableNameResolutionContext::init (const NameResolutionContext &ctx) | ||
{ | ||
rust_assert (!instance); | ||
|
||
instance = new ImmutableNameResolutionContext (ctx); | ||
|
||
return *instance; | ||
} | ||
|
||
const ImmutableNameResolutionContext & | ||
ImmutableNameResolutionContext::get () | ||
{ | ||
rust_assert (instance); | ||
|
||
return *instance; | ||
} | ||
|
||
const NameResolutionContext & | ||
ImmutableNameResolutionContext::resolver () const | ||
{ | ||
return ctx; | ||
} | ||
|
||
ImmutableNameResolutionContext::ImmutableNameResolutionContext ( | ||
const NameResolutionContext &ctx) | ||
: ctx (ctx) | ||
{} | ||
|
||
} // namespace Resolver2_0 | ||
} // namespace Rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (C) 2020-2023 Free Software Foundation, Inc. | ||
|
||
// This file is part of GCC. | ||
|
||
// GCC is free software; you can redistribute it and/or modify it under | ||
// the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 3, or (at your option) any later | ||
// version. | ||
|
||
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
// for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with GCC; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
#ifndef RUST_IMMUTABLE_NRCTX_H | ||
#define RUST_IMMUTABLE_NRCTX_H | ||
|
||
#include "rust-name-resolution-context.h" | ||
|
||
namespace Rust { | ||
namespace Resolver2_0 { | ||
|
||
/** | ||
* Once the name resolution pass is complete, the typechecker can access it | ||
* | ||
* FIXME: More documentation | ||
*/ | ||
class ImmutableNameResolutionContext | ||
{ | ||
public: | ||
/** FIXME: Documentation */ | ||
static const ImmutableNameResolutionContext & | ||
init (const NameResolutionContext &ctx); | ||
|
||
/** FIXME: Documentation */ | ||
static const ImmutableNameResolutionContext &get (); | ||
|
||
const NameResolutionContext &resolver () const; | ||
|
||
private: | ||
ImmutableNameResolutionContext (const NameResolutionContext &ctx); | ||
ImmutableNameResolutionContext (const ImmutableNameResolutionContext &other) | ||
= default; | ||
|
||
const NameResolutionContext &ctx; | ||
}; | ||
|
||
} // namespace Resolver2_0 | ||
} // namespace Rust | ||
|
||
#endif //! RUST_IMMUTABLE_NRCTX_H |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rustc will parse any pattern, but it's an error if the pattern is anything other than an identifier or
_
after expansion.