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

Error message change for type not found is not correct #7493

Closed
leppie opened this issue Dec 15, 2015 · 4 comments
Closed

Error message change for type not found is not correct #7493

leppie opened this issue Dec 15, 2015 · 4 comments
Assignees
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Milestone

Comments

@leppie
Copy link
Contributor

leppie commented Dec 15, 2015

using A = List<Bar>;

Reports in Roslyn:

Error CS0246: The type or namespace name 'List<Bar>' could not be found (are you missing a using directive or an assembly reference?)

In legacy compiler:

Error CS0246: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

To me, this is possibly confusing. In this case it is List<T> that could not be found. Not List<Bar>. And especially when going into some silly variations, eg List<"moo">.

I can understand it was a possible enhancement, but it would be better to say no generic type 'List' taking 1 argument.

Unfortunately, the Git history does not go back far enough to say why this change was done.

The point of interest is the whereText parameter in Binder.NotFound(...). See: https://github.com/dotnet/roslyn/blob/master/src%2FCompilers%2FCSharp%2FPortable%2FBinder%2FBinder_Symbols.cs#L1742

Related: #7387

@AdamMaras
Copy link

I agree, this is kind of strange. It may not be completely obvious to everybody that, in your example, it's List that can't be found, not Bar. Perhaps we can split the difference between the two?

The type or namespace name 'List' taking 1 generic argument could not be found (are you missing a using directive or an assembly reference?)

@YuvalItzchakov
Copy link

+1 for @AdamMaras suggestion. LGTM.

@gafter gafter added Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Dec 15, 2015
@leppie
Copy link
Contributor Author

leppie commented Dec 15, 2015

@AdamMaras The or namespace name bit should be dropped from the error message else it stays nonsensical :)

@leppie
Copy link
Contributor Author

leppie commented Dec 15, 2015

It might even be a good idea to try separate that error message completely to have a proper distinction between namespaces and types.

@gafter gafter added 4 - In Review A fix for the issue is submitted for review. and removed help wanted The issue is "up for grabs" - add a comment if you are interested in working on it labels Dec 30, 2015
@gafter gafter self-assigned this Dec 30, 2015
@gafter gafter added this to the 1.2 milestone Dec 30, 2015
gafter added a commit to gafter/roslyn that referenced this issue Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Projects
None yet
Development

No branches or pull requests

4 participants