Skip to content
Open
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
1 change: 1 addition & 0 deletions pyrefly/lib/lsp/wasm/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ fn class_hover_display(
_ => None,
}?;
constructor.transform_toplevel_callable(|c| expand_callable_kwargs_for_hover(solver, c));
constructor = solver.for_display(constructor);
Some(constructor.as_lsp_string_with_fallback_name(name_for_display, LspDisplayMode::Hover))
}

Expand Down
22 changes: 22 additions & 0 deletions pyrefly/lib/test/lsp/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,28 @@ Box[str]("hello")
);
}

// Regression test for https://github.com/facebook/pyrefly/issues/3240
#[test]
fn hover_on_generic_metaclass_constructor_does_not_show_inference_var() {
let code = r#"
class DeclarativeAttributeIntercept(type):
pass

class DCTransformDeclarative(DeclarativeAttributeIntercept):
# ^
pass
"#;
let report = get_batched_lsp_operations_report(&[("main", code)], get_test_report);
assert!(
!report.contains("-> @"),
"Hover must not expose an internal inference variable, got: {report}"
);
assert!(
report.contains(") -> Self@DeclarativeAttributeIntercept: ..."),
"Hover should resolve the constructor's return type, got: {report}"
);
}

#[test]
fn hover_on_class_type_parameter_shows_variance_covariant() {
let code = r#"
Expand Down
Loading