JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
88 stars 4 forks source link

Generate stage does not differentiate between multiple parents #315

Closed JSAbrahams closed 2 years ago

JSAbrahams commented 2 years ago

Description of Bug

Generate stage does not differentiate between multiple parents

How to Reproduce

Mamba source

class MyType(a: String)
class MyType2(b: String)

class MyClass1: MyType("asdf"), MyType("qwert")
    def other: Int

Is converted to:

class MyType:
    def __init__(self, a: str):
        self.a = a

class MyType2:
    def __init__(self, b: str):
        self.b = b

class MyClass1(MyType, MyType2):
    other: int = None

    def __init__(self):
        super(MyType, self).__init__("asdf")
        super(MyType, self).__init__("qwerty")

Expected behavior

It should recognize the "qwerty" is intended for the MyType2 parent.

        super(MyType, self).__init__("asdf")
        super(MyType2, self).__init__("qwerty")