void () { runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTestByText(""" from typing_extensions import Final class A: def __init__(self): self.a: Final[int] = 1 <warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> += 1 def method(self): <warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = 2 <warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = +2 <warning descr="'a' is 'Final' and could not be reassigned">A().a</warning> = 3 <warning descr="'a' is 'Final' and could not be reassigned">A().a</warning> = +3 class B: b: Final[int] def __init__(self): self.b = 1 <warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> += 1 def method(self): <warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> = 2 <warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> += 2 <warning descr="'b' is 'Final' and could not be reassigned">B().b</warning> = 3 <warning descr="'b' is 'Final' and could not be reassigned">B().b</warning> += 3 class C(B): def __init__(self): super().__init__() <warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 4 <warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> += 4 def my_method(self): <warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 5 <warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> += 5 <warning descr="'B.b' is 'Final' and could not be reassigned">C().b</warning> = 6 <warning descr="'B.b' is 'Final' and could not be reassigned">C().b</warning> += 6""") ); }