Akuli / jou

Yet another programming language
MIT License
12 stars 4 forks source link

Methods are inaccessible if a class isn't imported #268

Closed Akuli closed 1 year ago

Akuli commented 1 year ago

a.jou:

from "stdlib/io.jou" import printf

class Foo:
    def print(self: Foo) -> void:
        printf("Hello\n")

b.jou:

from "./a.jou" import Foo

def make_foo() -> Foo:
    return Foo{}

c.jou:

from "./b.jou" import make_foo

def main() -> int:
    make_foo().print()
    return 0

When running jou c.jou I would expect to see hello world, but instead I get: compiler error in file "c.jou", line 4: class Foo does not have a method named 'print'

To work around this I need to add from "./a.jou" import Foo to c.jou