Skip to content

Commit 1759af3

Browse files
committed
unbound ParamSpecs should be reported as invalid-type-arguments errors
1 parent bbcbaac commit 1759af3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/ty_python_semantic/resources/mdtest/generics/legacy/paramspec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ reveal_type(OnlyParamSpec[...]().attr) # revealed: (...) -> None
251251
def func(c: Callable[P2, None]):
252252
reveal_type(OnlyParamSpec[P2]().attr) # revealed: (**P2@func) -> None
253253

254-
# error: [invalid-type-form] "ParamSpec `P2` is unbound"
254+
# error: [invalid-type-arguments] "ParamSpec `P2` is unbound"
255255
reveal_type(OnlyParamSpec[P2]().attr) # revealed: (...) -> None
256256

257257
# error: [invalid-type-arguments] "No type argument provided for required type variable `P1` of class `OnlyParamSpec`"
@@ -295,7 +295,7 @@ reveal_type(TypeVarAndParamSpec[int, [int, str]]().attr) # revealed: (int, str,
295295
reveal_type(TypeVarAndParamSpec[int, [str]]().attr) # revealed: (str, /) -> int
296296
reveal_type(TypeVarAndParamSpec[int, ...]().attr) # revealed: (...) -> int
297297

298-
# error: [invalid-type-form] "ParamSpec `P2` is unbound"
298+
# error: [invalid-type-arguments] "ParamSpec `P2` is unbound"
299299
reveal_type(TypeVarAndParamSpec[int, P2]().attr) # revealed: (...) -> int
300300
# error: [invalid-type-arguments] "Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...`"
301301
reveal_type(TypeVarAndParamSpec[int, int]().attr) # revealed: (...) -> int

crates/ty_python_semantic/src/types/infer/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3531,7 +3531,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
35313531
if known_instance.class(self.db()) == KnownClass::ParamSpec =>
35323532
{
35333533
if let Some(diagnostic_builder) =
3534-
self.context.report_lint(&INVALID_TYPE_FORM, expr)
3534+
self.context.report_lint(&INVALID_TYPE_ARGUMENTS, expr)
35353535
{
35363536
diagnostic_builder.into_diagnostic(format_args!(
35373537
"ParamSpec `{}` is unbound",

0 commit comments

Comments
 (0)