Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
class Format:
STRING = "string"

def evaluate(format: Literal[Format.STRING]) -> str: ...
def evaluate(a: Literal[Format.STRING], b: Literal[-1]) -> str: ...
9 changes: 0 additions & 9 deletions crates/ty_project/tests/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,8 @@ const KNOWN_FAILURES: &[(&str, bool, bool)] = &[

// These are all "expression should belong to this TypeInference region and TypeInferenceBuilder should have inferred a type for it"
("crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/curses/__init__.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/pathlib/types.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/pstats.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi", true, true),
("crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi", true, true),
];

/// Attempting to check one of these files causes a stack overflow
Expand Down
4 changes: 3 additions & 1 deletion crates/ty_python_semantic/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9481,7 +9481,9 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
if matches!(u.op, ast::UnaryOp::USub | ast::UnaryOp::UAdd)
&& u.operand.is_number_literal_expr() =>
{
self.infer_unary_expression(u)
let ty = self.infer_unary_expression(u);
self.store_expression_type(parameters, ty);
ty
}
_ => {
self.infer_expression(parameters);
Expand Down
Loading