You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bb_mypy.py:4: error: Name "foo" is not defined [name-defined]
def fn(x: Literal["foo", "bar", "foo|bar"]) -> None:
^
bb_mypy.py:5: note: Revealed type is "Any"
Found 1 error in 1 file (checked 1 source file)
Your Environment
Python version used: 3.8.18
Mypy version used: 1.6.1
Mypy command-line flags: None were used.
Mypy configuration options from mypy.ini (and other config files):
pretty = true
check_untyped_defs = true
ignore_missing_imports = false
disallow_untyped_defs = true
follow_imports = normal
namespace_packages = true
explicit_package_bases = true
show_error_codes = true
plugins = numpy.typing.mypy_plugin
no_implicit_reexport = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
The text was updated successfully, but these errors were encountered:
I'd argue #16367 is a duplicate of this one (as I was the one to discover it) and the other was created while I slowly typed this issue up 😅 But nevermind!
I'd argue #16367 is a duplicate of this one (as I was the one to discover it) and the other was created while I slowly typed this issue up 😅 But nevermind!
It's a dog-eat-dog world out here on the mypy issue tracker, I'm afraid ;)
Sorry :) I was about to let you know before creating this issue, but you posted this comment saying that you would "open an issue if this question does not receive a possible workaround/solution within a few days".
Bug Report
Using
mypy 1.6.1
, I'm unable to use a pipe symbol in a string used intyping.Literal
:To Reproduce
Expected Behavior
No issue with
"foo|bar"
.Actual Behavior
This gives the following output:
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: