mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 22:54:28 -05:00
Fix incorrect placement of leading function comment with type params (#12447)
This commit is contained in:
@@ -230,6 +230,28 @@ class QuerySet(AltersData):
|
||||
|
||||
as_manager.queryset_only = True
|
||||
as_manager = classmethod(as_manager)
|
||||
|
||||
|
||||
# Decorators
|
||||
@decorator
|
||||
# comment
|
||||
class Foo1: ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
class Foo2(Foo1): ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
class Foo3[T]: ...
|
||||
|
||||
@decorator # comment
|
||||
class Foo4: ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
@decorato2
|
||||
class Foo5: ...
|
||||
```
|
||||
|
||||
## Output
|
||||
@@ -489,7 +511,30 @@ class QuerySet(AltersData):
|
||||
|
||||
as_manager.queryset_only = True
|
||||
as_manager = classmethod(as_manager)
|
||||
|
||||
|
||||
# Decorators
|
||||
@decorator
|
||||
# comment
|
||||
class Foo1: ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
class Foo2(Foo1): ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
class Foo3[T]: ...
|
||||
|
||||
|
||||
@decorator # comment
|
||||
class Foo4: ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
@decorato2
|
||||
class Foo5: ...
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -442,6 +442,28 @@ def function_with_variadic_generics(*args: *tuple[int],): ...
|
||||
|
||||
# Generic arguments (PEP 695)
|
||||
def func[T](lotsoflongargs: T, lotsoflongargs2: T, lotsoflongargs3: T, lotsoflongargs4: T, lotsoflongargs5: T) -> T: ...
|
||||
|
||||
|
||||
# Decorators
|
||||
@decorator
|
||||
# comment
|
||||
def foo[S](x: S) -> S: ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
def foo(x: S) -> S: ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
def foo() -> S: ...
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
@decorator2
|
||||
def foo(x: S) -> S: ...
|
||||
|
||||
@decorator # comment
|
||||
def foo(x: S) -> S: ...
|
||||
```
|
||||
|
||||
## Output
|
||||
@@ -1041,6 +1063,32 @@ def func[T](
|
||||
lotsoflongargs4: T,
|
||||
lotsoflongargs5: T,
|
||||
) -> T: ...
|
||||
|
||||
|
||||
# Decorators
|
||||
@decorator
|
||||
# comment
|
||||
def foo[S](x: S) -> S: ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
def foo(x: S) -> S: ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
def foo() -> S: ...
|
||||
|
||||
|
||||
@decorator
|
||||
# comment
|
||||
@decorator2
|
||||
def foo(x: S) -> S: ...
|
||||
|
||||
|
||||
@decorator # comment
|
||||
def foo(x: S) -> S: ...
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user