diff --git a/artiq/language/core.py b/artiq/language/core.py index bcf4a7f8b..00cbae3a3 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -12,7 +12,7 @@ from artiq.language import import_cache __all__ = [ - "Kernel", "KernelInvariant", "virtual", + "Kernel", "KernelInvariant", "virtual", "ConstGeneric", "round64", "floor64", "ceil64", "extern", "kernel", "portable", "nac3", "rpc", "print_rpc", @@ -35,6 +35,12 @@ class KernelInvariant(Generic[T]): class virtual(Generic[T]): pass +class _ConstGenericMarker: + pass + +def ConstGeneric(name, constraint): + return TypeVar(name, _ConstGenericMarker, constraint) + def round64(x): return round(x)