Skip to content

Report circular type inference errors with -noImplicitAny #665

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

Merged
merged 2 commits into from
Sep 12, 2014

Conversation

ahejlsberg
Copy link
Member

Fixes #476.

@ahejlsberg
Copy link
Member Author

I should add that if we implement #647 the errors reported with -noImplicitAny for circular uses of typeof in a type annotation would instead always be errors. I definitely think that would be more meaningful.

"Function implicitly has return type 'any' because type inference encountered a circularity.": {
"category": "Error",
"code": 7023
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the error message a bit more explicit. I do not find "circularity" particularly helpful, specially that we do not print the cycle. how about:
'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its initializer.

Function implicitly has return type 'any' because it does not have a return type annotation and it is referenced directly or indirectly in at least one if its return expressions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. I will change the error messages.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 12, 2014

I find the error message un-actionable, but other than that looks good to me. thanks.

@sheetalkamat
Copy link
Member

👍

ahejlsberg added a commit that referenced this pull request Sep 12, 2014
Report circular type inference errors with -noImplicitAny
@ahejlsberg ahejlsberg merged commit b9ebb36 into master Sep 12, 2014
@ahejlsberg ahejlsberg deleted the circularTypeInferenceErrors branch September 12, 2014 20:15
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No noImplicitAny error for self referencing values
3 participants