Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Conversation

CTrando
Copy link
Contributor

@CTrando CTrando commented Jun 20, 2019

No description provided.

@CTrando CTrando changed the title #1229: Adding diagnostic message when using TypeVar with no arguments [WIP] Adding diagnostic message when using TypeVar with no arguments Jun 20, 2019
…ring, moving tests to new file, adding more tests
@CTrando CTrando changed the title [WIP] Adding diagnostic message when using TypeVar with no arguments [WIP] Adding diagnostic message when using TypeVar improperly Jun 20, 2019
@CTrando CTrando changed the title [WIP] Adding diagnostic message when using TypeVar improperly Adding diagnostic message when using TypeVar improperly Jun 24, 2019
@CTrando
Copy link
Contributor Author

CTrando commented Jun 28, 2019

After more thought, should leave this PR for now.

We have the current issue:

T = TypeVar('T', bound='Comparator')

bound = ... essentially means that T must be a subtype of whatever was passed in. I believe bound is actually a keyword only argument, which we do not handle in the instantiation of the Arguments in the constructor in ArgumentSet.

Currently, bound is seen as a second parameter to TypeVar, which we flag as a bad type because (in our example) 'Comparator' is a string value and not the string type which is required.

For an example look at test TypeVarStringConstraint .

@CTrando
Copy link
Contributor Author

CTrando commented Jun 28, 2019

Delayed until #1263 merges.

@CTrando CTrando changed the title Adding diagnostic message when using TypeVar improperly [WIP]: Adding diagnostic message when using TypeVar improperly Jun 28, 2019
@CTrando CTrando changed the title [WIP]: Adding diagnostic message when using TypeVar improperly Adding diagnostic message when using TypeVar improperly Jul 16, 2019
return !string.IsNullOrEmpty(typeString) ? argSet.Eval.GetTypeFromString(typeString) : a.GetPythonType();
}).ToArray() ?? Array.Empty<IPythonType>();

if (constraints.Any(c => c.IsUnknown())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some constraints can be valid but still unknown, probably not worth reporting.

@CTrando CTrando merged commit 1bcba75 into microsoft:master Jul 18, 2019
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
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.

4 participants