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

Suggestion: Display a honest message when inference cannot be done correctly #3055

Closed
zpdDG4gta8XKpMCd opened this issue May 6, 2015 · 5 comments
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead Duplicate An existing issue was already created

Comments

@zpdDG4gta8XKpMCd
Copy link

Currently (TS v.1.5.2) the compiler does not do inference correctly for certain cases:

#3038

Although it is by design, reflected in the spec and there is no viable way for doing it correctly, I think the compiler has to be honest to the developer and instead of generating faulty code, it has to break with an error message that would say that the inferred types cannot be resolved.

@RyanCavanaugh RyanCavanaugh added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label May 6, 2015
@RyanCavanaugh
Copy link
Member

This would be throwing a lot of babies out with very little bathwater. There is tons of code that hits that part of the spec where the types are correct and it would be counterproductive to issue an error in those cases.

@zpdDG4gta8XKpMCd
Copy link
Author

For those parts that are correct no errors are necessary, for other parts that cannot be resolved properly such issue would be very much appreciated. Is there a problem with detecting what can and what cannot be inferred ahead, so that both correct cases with generated code and incorrect ones with error messages are properly covered?

@RyanCavanaugh
Copy link
Member

The entire problem is that we don't have an algorithm for determining what's an error and what isn't.

We didn't have that capability and then randomly decide to not issue errors in some cases, of course.

@zpdDG4gta8XKpMCd
Copy link
Author

So we might want to keep this issue open please, don't we? It is certainly a problem that the compiler doesn't work property and it deserves some attention from the community. There are a lot of open requests that ask for much sillier features than this one and yet they don't get closed.

@JsonFreeman
Copy link
Contributor

This is a duplicate of #3038.

@JsonFreeman JsonFreeman added the Duplicate An existing issue was already created label May 7, 2015
@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
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants