Minor cleanup and consistent formatting of the Markdown-based tests. - Removed lots of unnecessary `a`, `b`, `c`, … variables. - Moved test assertions (`# revealed:` comments) closer to the tested object. - Always separate `# revealed` and `# error` comments from the code by two spaces, according to the discussion [here](https://github.com/astral-sh/ruff/pull/13746/files#r1799385758). This trades readability for consistency in some cases. - Fixed some headings
456 B
456 B
Function shadowing
Parameter
Parameter x of type str is shadowed and reassigned with a new int value inside the function. No diagnostics should be generated.
def f(x: str):
x: int = int(x)
Implicit error
def f(): pass
f = 1 # error: "Implicit shadowing of function `f`; annotate to make it explicit if this is intentional"
Explicit shadowing
def f(): pass
f: int = 1