pull/16/head
pca006132 2021-06-09 09:48:07 +08:00
parent 1e80d8d285
commit b79c1725b3
1 changed files with 18 additions and 0 deletions

View File

@ -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]`.