exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
14.3k stars 501 forks source link

"unexpected dedent" at declaration of async method #278

Open davidmcnabnz opened 1 year ago

davidmcnabnz commented 1 year ago

Hi all, at my first try of codon, compilation failed with 'unexpected dedent' error. Here's a simplified paraphrase of the code:

class Foo(Bar):
    if SERVICE_MODE == SERVICE_MODE_WHATEVER:
        needCorpDb = False
    def __init__(self):
        controls = Controls(CONTROLS_SET)
        super().__init__(controls)
        ... other stuff ...

    async def initialise(self):  # <<<< THIS IS WHAT CODON CALLS 'unexpected dedent'
        await super().initialise()
        ... other stuff ...

The same code runs perfectly ok with CPython.

Am I missing something?

Cheers David

arshajii commented 1 year ago

Hi @davidmcnabnz -- Codon doesn't yet support async, but we intend to add it in a future release (see https://github.com/exaloop/codon/issues/71).

davidmcnabnz commented 1 year ago

Thanks @arshajii . Understood. In this case, I think it's fair to say there's a UI bug in Codon, where it fails to mention its current lack of support for async. It might make sense to update Codon to output a more explicit and understandable error message.