From b79c1725b3fef8e15a702a76eff85a04d961e342 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Wed, 9 Jun 2021 09:48:07 +0800 Subject: [PATCH] Added #9 --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 943cdd2..e676b6e 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,24 @@ def fail_write() -> None: self.a = a self.b = b ``` +* Instance variables not used would be warned by the compiler, except for those + preceded by the pseudocomment `# nac3:no_warn_unused`. (#9) The comment can + either be placed on top of the variable or next to the variable. Example: + ```python + class Foo: + # nac3:no_warn_unused + a: int + b: int # nac3:no_warn_unused + def __init__(self): + pass + ``` +* Use-before-define: + * Host-only constructor: Error if a certain field `f` is + used in other kernel methods but missing from the object constructed in the + host. + * `@portable`/`@kernel` constructor: Error if a certain + field `f` is used in other kernel methods but not defined in the + constructor, or used in the constructor before definition. * Three types of instance variables: (Issue #5) * Host only variables: Do not add type annotation for it in the class. * Kernel only variables: Denoted with type `Kernel[T]`.