nac3artiq: throw error message when constructor use rpc decorator #306

Merged
sb10q merged 10 commits from issue-221 into master 2022-07-11 15:55:55 +08:00
Contributor

Tested with the following script

from artiq.experiment import *
from artiq.coredevice.core import Core
from artiq.coredevice.ttl import TTLOut

@nac3
class BlinkForever(EnvExperiment):
    core: KernelInvariant[Core]
    led: KernelInvariant[TTLOut]

    @rpc
    def __init__(self, managers_or_parent):
        super().__init__(managers_or_parent)

    def build(self):
        self.setattr_device("core")
        self.setattr_device("led")

    @kernel
    def run(self):
        self.core.reset()
        while True:
            self.led.pulse(100.*ms)
            self.core.delay(100.*ms)

output:

nac3artiq.CompileError: compilation failed
(----------
The constructor of class BlinkForever should not be decorated with rpc decorator (at blink_forever2.py: line 10 column 5)

Tested with the following script ``` from artiq.experiment import * from artiq.coredevice.core import Core from artiq.coredevice.ttl import TTLOut @nac3 class BlinkForever(EnvExperiment): core: KernelInvariant[Core] led: KernelInvariant[TTLOut] @rpc def __init__(self, managers_or_parent): super().__init__(managers_or_parent) def build(self): self.setattr_device("core") self.setattr_device("led") @kernel def run(self): self.core.reset() while True: self.led.pulse(100.*ms) self.core.delay(100.*ms) ``` output: nac3artiq.CompileError: compilation failed (---------- The constructor of class BlinkForever should not be decorated with rpc decorator (at blink_forever2.py: line 10 column 5)
z78078 added 8 commits 2022-07-08 17:27:58 +08:00
z78078 added 1 commit 2022-07-08 17:45:26 +08:00
z78078 changed title from issue-221 to nac3artiq: throw error message when constructor use rpc decorator 2022-07-11 09:42:52 +08:00
z78078 added 1 commit 2022-07-11 13:40:14 +08:00
sb10q merged commit 8f95b79257 into master 2022-07-11 15:55:55 +08:00
sb10q deleted branch issue-221 2022-07-11 15:55:55 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#306
No description provided.