red_knot_python_semantic: remove the "old" secondary message type
This finally completes the deletion of all old diagnostic types. We do this by migrating the second (and last) use of secondary diagnostic messages: to highlight the return type of a function definition when its return value is inconsistent with the type. Like the last diagnostic, we do actually change the message here a bit. We don't need a sub-diagnostic here, and we can instead just add a secondary annotation to highlight the return type.
This commit is contained in:
committed by
Andrew Gallant
parent
7e2eb591bc
commit
7d958a9ee5
@@ -310,7 +310,7 @@ def f(cond: bool) -> str:
|
||||
return "hello" if cond else NotImplemented
|
||||
|
||||
def f(cond: bool) -> int:
|
||||
# error: [invalid-return-type] "Object of type `Literal["hello"]` is not assignable to return type `int`"
|
||||
# error: [invalid-return-type] "Return type does not match returned value: Expected `int`, found `Literal["hello"]`"
|
||||
return "hello" if cond else NotImplemented
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user