mys-lang / mys

The Mys programming language - an attempt to create a statically typed Python-like language that produces fast binaries. See https://mys-lang.org for more information.
Other
132 stars 5 forks source link

Access imported class' member with unknown type. #32

Closed eerimoq closed 3 years ago

eerimoq commented 3 years ago

What did you do?

main.mys:

from . import Foo

def main():
    print(Foo().a.b)

lib.mys:

class Foo:
    a: Bar

    def __init__(self):
        self.a = Bar("hi")

class Bar:
    b: string

What did you expect to see?

Successful build. The idea is that all public members shall be possible to access (obviously). They must also be a public type.

What did you see instead?

  File "./src/main.mys", line 4
        print(Foo().a.b)
              ^
CompileError: 'foo.lib.Bar' has no member 'b'

Mys version

0356d926987b32f15a6ba58f628ba30244a8b973