Closed max-muoto closed 3 weeks ago
Pyright is working as intended here, so I don't consider this a bug.
We have on occasion changed inference rules, but this is done only after much deliberation and evidence that it's merited. Each such change carries with it the potential for introducing new false positives in typed code bases, so the bar is very high.
I'm going to close this issue for now, but it's something that we could consider changing in the future if there's sufficient demand / justification.
Pyright is working as intended here, so I don't consider this a bug.
We have on occasion changed inference rules, but this is done only after much deliberation and evidence that it's merited. Each such change carries with it the potential for introducing new false positives in typed code bases, so the bar is very high.
I'm going to close this issue for now, but it's something that we could consider changing in the future if there's sufficient demand / justification.
Sounds good! Definitely an outlier in terms of needs here, so makes sense.
I would generally expect a tuple of tuples to retain any literal types within the nested tuples. Take this example, which fails:
I can understand for why a mutable collection, the tuples literal values would be discarded, but in this case I'd imagine they should be preserved? I rely fairly heavily on LiteralStrings for constructing raw SQL (some drivers such as Pyscopg disallow raw strings to be passed along when executing SQL), so this was an edge case I ran into.
Pyright Playground: https://pyright-play.net/?pythonVersion=3.14&strict=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoAySMApiAIYA2AyjCKmgFDMAmJwUwYYAFDOQCNKJAFyFiZKrXroANJyQlKLMUVIUadBgEooAWgB8UAHJgUoqADprzRlxCxBw%2BcEXLMKKDx4AiCCS0AYx95HyQWH215X1IAZxgQqB84hO1tEUYoLM5uPicSFzcWbVsYAFcEKABeL19-IMSwiKivZJJ4xpTIkpASADcSKgB9eAQSPgrtIA
Version: 1.1.377