Skip to content
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

Make name resolution errors non-fatal #30320

Merged
merged 1 commit into from
Dec 16, 2015
Merged

Make name resolution errors non-fatal #30320

merged 1 commit into from
Dec 16, 2015

Conversation

nrc
Copy link
Member

@nrc nrc commented Dec 11, 2015

We can now handle name resolution errors and get past type checking (if we're a bit lucky). This is the first step towards doing code completion for partial programs (we need error recovery in the parser and early access to save-analysis).

@rust-highfive
Copy link
Collaborator

r? @jroesch

(rust_highfive has picked a reviewer for you, use r? to override)

@nrc
Copy link
Member Author

nrc commented Dec 11, 2015

r? @nikomatsakis

cc @rust-lang/compiler anyone can review this, I don't think it needs any special knowledge. I'd be grateful if anyone has the time.

@@ -16,6 +16,7 @@ fn matcher1(x: opts) {
match x {
opts::a(ref i) | opts::b(i) => {}
//~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
//~^^ ERROR mismatched types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like these should be kept as typeck errors and removed from resolve.

@nikomatsakis
Copy link
Contributor

This looks good to me. I agree with @eddyb that reporting an error in the case of ref i vs i is unfortunate -- it feels like a "downstream error" which would be best to suppress, though it might be a pain. Could we move that "mode" checking into typeck easily enough?

@nikomatsakis
Copy link
Contributor

r+ modulo that question.

@nrc
Copy link
Member Author

nrc commented Dec 15, 2015

Seems easy enough to change to only giving a type mismatch error in that case (I hacked the change and we didn't fail any tests). However the error message is a fair bit less informative and it seems tricky to add that information to the type mismatch error, so in this case I'd be in favour of leaving the duplicate errors (or trying to suppress the type mismatch, but that is trickier and best left as a follow-up).

@nrc
Copy link
Member Author

nrc commented Dec 15, 2015

@bors: r=@nikomatsakis

@bors
Copy link
Contributor

bors commented Dec 15, 2015

📌 Commit 18b4fe0 has been approved by @nikomatsakis

@bors
Copy link
Contributor

bors commented Dec 15, 2015

⌛ Testing commit 18b4fe0 with merge 7aa94a2...

@bors
Copy link
Contributor

bors commented Dec 15, 2015

💔 Test failed - auto-mac-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Dec 14, 2015 at 7:59 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-mac-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/7446


Reply to this email directly or view it on GitHub
#30320 (comment).

bors added a commit that referenced this pull request Dec 15, 2015
We can now handle name resolution errors and get past type checking (if we're a bit lucky). This is the first step towards doing code completion for partial programs (we need error recovery in the parser and early access to save-analysis).
@bors
Copy link
Contributor

bors commented Dec 15, 2015

⌛ Testing commit 18b4fe0 with merge bf8caf1...

@nikomatsakis
Copy link
Contributor

@nrc

Seems easy enough to change to only giving a type mismatch error in that case (I hacked the change and we didn't fail any tests). However the error message is a fair bit less informative and it seems tricky to add that information to the type mismatch error, so in this case I'd be in favour of leaving the duplicate errors (or trying to suppress the type mismatch, but that is trickier and best left as a follow-up).

I was thinking of trying to suppress the type mismatch, yes. OK.

Manishearth added a commit to Manishearth/rust that referenced this pull request Dec 16, 2015
We can now handle name resolution errors and get past type checking (if we're a bit lucky). This is the first step towards doing code completion for partial programs (we need error recovery in the parser and early access to save-analysis).
Manishearth added a commit to Manishearth/rust that referenced this pull request Dec 16, 2015
We can now handle name resolution errors and get past type checking (if we're a bit lucky). This is the first step towards doing code completion for partial programs (we need error recovery in the parser and early access to save-analysis).
bors added a commit that referenced this pull request Dec 16, 2015
@bors bors merged commit 18b4fe0 into rust-lang:master Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants