Skip to content

Argument list[str] is not assignable to parameter iterable with type Iterable[LiteralString] in function map.__new__ #3030

@MarcoGorelli

Description

@MarcoGorelli

Describe the Bug

def main(a: str) -> None:
    _ = map(str.strip, a.splitlines())
    return None
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ mypy t.py
Success: no issues found in 1 source file
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ pyright t.py
0 errors, 0 warnings, 0 informations
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ ty check t.py
All checks passed!
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ pyrefly check t.py
ERROR Argument `list[str]` is not assignable to parameter `iterable` with type `Iterable[LiteralString]` in function `map.__new__` [bad-argument-type]
 --> t.py:2:24
  |
2 |     _ = map(str.strip, a.splitlines())
  |                        ^^^^^^^^^^^^^^
  |
 INFO 1 error

Spotted in Polars

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSImMYABALaoToAUqiNcALgE4CUNAWgB8NAHK50MRAB10NeTQD6NALz1UxZl26FtEYgBoaqXcSgRO5yXGa9eshTW4xOAV25zxkkAZBlnYFCkhJy4dFAUAMQ0AAqkAUEcGDgENADGEpAA5u6onBAShLLRAMowMDQAFpycxHCIAPQN-tRBhLjcWQ0w6A2YuGlwDRno2bn5Eg00YB3GAG6MUKjYsOmZEDnceQVyuMQT6HBF6GSclRICczDccDuqNNIgAMyEAIwATI%2ByANrX3B1wAC6slc6AgdGIHU4MEwAkwEGcaXyV3uAHINugOjBUbJMZwBM4AI6uBEwgQAaxgpAEqDSaXgcDRAHdUB4cegQABfXy05EwABi0BgFDQWDwRDIXKAA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions