Skip to content

False positive not-an-iterable for typing.NewType #2296

Open
@alien3211

Description

@alien3211

Steps to reproduce

  1. Put this code in test.py:
from typing import List, NewType

a = NewType("a", List[int])

def fun() -> a:
    """Some function."""
    data = [1, 2, 3]

    return a(data)

def fun1():
    """some function."""
    for x in fun():
        pass
  1. Run pylint test.py

Current behavior

test.py:14:13: E1133: Non-iterable value fun() is used in an iterating context (not-an-iterable)

Expected behavior

pylint --version output

pylint 2.0.0
astroid 2.0.0.dev4
Python 3.6.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions