Skip to content

New semantic analyzer: invalid type variable produces additional error #6957

Closed

Description

@ilevkivskyi

This test case fails:

[case testMoreInvalidTypevarArguments]
from typing import TypeVar

defer: Yes

S = TypeVar('S', covariant=True, contravariant=True)  # E: TypeVar cannot be both covariant and contravariant

class Yes: ...
[builtins fixtures/bool.pyi]

because there is an additional (and somewhat confusing) error:

Cannot redefine 'S' as a type variable

See also #6300 and #6563 (ideally, the latter should also fix this issue).

Activity

  1. ilevkivskyi commented on Jun 27, 2019

    @ilevkivskyi
    MemberAuthor

    This is quite annoying when testing (namely when running tests with an extra iteration), so raising priority to normal.

  2. self-assigned this
    on Jun 28, 2019
  3. added a commit that references this issue on Jun 28, 2019
    cded69d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions