JSAbrahams / mamba

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

Consider a field to be assigned to if we do so in every possible branch #449

Closed JSAbrahams closed 1 year ago

JSAbrahams commented 1 year ago

Description of Bug

How to Reproduce

class MyClass
    def my_field: Int

    def __init__(self):
        if False then 
            self.my_field = 10
        else
            self.my_field = 10

Expected behavior

Should check.

Additional context

This can be quickly fixed by again re-introducing unions for Environments. However, this should be done strictly for assign checks, not all variables.

Should also take case that we check that this is for all branches.