mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 12:14:43 +00:00
Fix builtin types methods
This commit is contained in:
parent
8cdc735486
commit
d5e9649172
5 changed files with 107 additions and 101 deletions
|
@ -20,13 +20,13 @@ class Str(str):
|
|||
def to_int(self):
|
||||
return Int(self) if self.isdigit() else None
|
||||
def __add__(self, other):
|
||||
return then__(super().__add__(other), Str)
|
||||
return then__(str.__add__(self, other), Str)
|
||||
def __radd__(self, other):
|
||||
return then__(super().__radd__(other), Str)
|
||||
return then__(str.__add__(other, self), Str)
|
||||
def __mul__(self, other):
|
||||
return then__(super().__mul__(other), Str)
|
||||
return then__(str.__mul__(self, other), Str)
|
||||
def __mod__(self, other):
|
||||
return then__(super().__mod__(other), Str)
|
||||
return then__(str.__mod__(other, self), Str)
|
||||
|
||||
class StrMut(): # Inherits Str
|
||||
value: Str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue