Python: add support for type(self)()

This commit is contained in:
Rasmus Wriedt Larsen
2022-10-24 14:40:23 +02:00
parent d43a48c265
commit a4e6433942
3 changed files with 10 additions and 5 deletions

View File

@@ -8,19 +8,19 @@ class X(object):
def meth(self):
print("X.meth")
return type(self)(42.1) # $ MISSING: tt=X.__init__ tt=Y.__init__
return type(self)(42.1) # $ tt=X.__init__ tt=Y.__init__
@classmethod
def cm(cls):
print("X.cm")
cls(42.2) # $ MISSING: tt=X.__init__ tt=Y.__init__
cls(42.2) # $ tt=X.__init__ tt=Y.__init__
x = X(42.0) # $ tt=X.__init__
x_421 = x.meth() # $ pt,tt=X.meth
X.cm() # $ pt,tt=X.cm
x.foo() # $ pt,tt=X.foo
print()
x_421.foo() # $ pt=X.foo MISSING: tt=X.foo
x_421.foo() # $ pt=X.foo tt=X.foo
print()