Skip to content

Complain about inferring UninhabitedType for a variable - #4112

Merged
JukkaL merged 1 commit into
masterfrom
infer-uninhabited
Oct 13, 2017
Merged

JukkaL merged 1 commit into
masterfrom
infer-uninhabited

Conversation

@JukkaL

@JukkaL JukkaL commented Oct 13, 2017 •

Copy link
Copy Markdown
Collaborator

These don't really make sense as variable types, most of the time.
Also, don't turn them into partial None types, since UninhabitedType
and None no longer have any correspondence.

Fixes #4104.

These don't really make sense as variable types, most of the time.
Also, don't turn them into partial None types, since UninhabitedType
and None no longer have any correspondence.
@JukkaL

JukkaL commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator Author

Don't merge yet -- I want to fix an issue in internal Dropbox code first.

@ilevkivskyi

Copy link
Copy Markdown
Member

So does this fix the problem with:

def f() -> T: pass

x = f()
reveal_type(x)  # None

If yes then maybe it makes sense to add a test for this?

@JukkaL

JukkaL commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator Author

Yes, there is an existing test case that was skipped (testUnderspecifiedInferenceResult).

@JukkaL

JukkaL commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator Author

Updated the description to mention that this fixes #4104.

@ilevkivskyi

Copy link
Copy Markdown
Member

Ah, OK, but then #4059 should be updated after you merge this, since the reveal_type you added will start working.

@JukkaL
JukkaL merged commit 1993fdf into master Oct 13, 2017
@gvanrossum
gvanrossum deleted the infer-uninhabited branch October 13, 2017 18:04
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.

2 participants