Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
554e393
Add failing test cases
JukkaL Dec 18, 2022
96b2767
Fix accessing attribute that overrides a property
JukkaL Dec 18, 2022
f8f65cd
WIP partially enable test case
JukkaL Dec 18, 2022
c9f9ae8
Refactor mypyc.irbuild.prepare a little
JukkaL Dec 18, 2022
147ccde
More refactoring
JukkaL Dec 18, 2022
e507645
Prefer attributes over methods, if both are defined
JukkaL Dec 18, 2022
0243a1e
Generate method decl for implicit property getters
JukkaL Dec 18, 2022
15b7b30
Fix serialization of the "implicit" attribute
JukkaL Dec 18, 2022
8e638b0
Support simple use cases where an attribute overrides a property
JukkaL Dec 18, 2022
44075a9
Fix case where both attribute and property are inherited
JukkaL Dec 18, 2022
c756c36
Support settable properties
JukkaL Dec 30, 2022
de7e436
Black + isort
JukkaL Dec 30, 2022
d92905d
Merge test cases
JukkaL Dec 30, 2022
1fd4bc5
Merge more test cases
JukkaL Dec 30, 2022
d80842a
Fix edge case
JukkaL Dec 30, 2022
0274969
Test case fixes
JukkaL Dec 30, 2022
810c4e1
Add native int test cases
JukkaL Dec 30, 2022
b0ee424
Fix test case
JukkaL Jan 2, 2023
479ffcd
Minor refactoring
JukkaL Jan 2, 2023
039fe10
Fix self check
JukkaL Jan 2, 2023
1996b8a
Improve comments and minor cleanup
JukkaL Jan 2, 2023
f5d4560
Minor refactoring
JukkaL Jan 2, 2023
8fc012e
Make test cases compatible with CPython
JukkaL Jan 10, 2023
d948ce8
Merge branch 'master' into mypyc-property-inheritance
JukkaL Jan 10, 2023
158ee54
Merge remote-tracking branch 'origin/master' into mypyc-property-inhe…
JukkaL Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge more test cases
  • Loading branch information
JukkaL committed Dec 30, 2022
commit 1fd4bc534a99c6c4d18dd94924aeea6aa4ea46ee
30 changes: 11 additions & 19 deletions mypyc/test-data/run-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -2036,32 +2036,28 @@ def test_read_only_property_in_class_implemented_as_attribute() -> None:
assert c.x == 7
assert c.y == 8

[case testAttributeOverridesProperty3]
from typing import Any
from mypy_extensions import trait

@trait
class T1:
class T3:
@property
def x(self) -> int: ...
@property
def y(self) -> int: ...

class B:
class B3:
x: int
y: int = 4

class C(B, T1):
class C3(B3, T3):
pass

def test_read_only_property_implemented_as_attribute() -> None:
c = C()
def test_read_only_property_implemented_as_attribute_indirectly() -> None:
c = C3()
c.x = 5
assert c.x == 5
assert c.y == 4
c.y = 6
assert c.y == 6
t: T1 = C()
t: T3 = C3()
assert t.y == 4
t = c
assert t.x == 5
Expand All @@ -2074,12 +2070,8 @@ def test_read_only_property_implemented_as_attribute() -> None:
assert c.x == 7
assert c.y == 8

[case testAttributeOverridesProperty4]
from typing import Any
from mypy_extensions import trait

@trait
class T1:
class T4:
@property
def x(self) -> int: ...
@x.setter
Expand All @@ -2090,18 +2082,18 @@ class T1:
@y.setter
def y(self, v2: int) -> None: ...

class C(T1):
class C4(T4):
x: int
y: int = 4

def test_read_only_property_implemented_as_attribute() -> None:
c = C()
def test_read_write_property_implemented_as_attribute() -> None:
c = C4()
c.x = 5
assert c.x == 5
assert c.y == 4
c.y = 6
assert c.y == 6
t: T1 = C()
t: T4 = C4()
assert t.y == 4
t.x = 5
assert t.x == 5
Expand Down