Skip to content

Commit f56cea6

Browse files
committed
Adjust docs & changelog for PR #271
#271
1 parent 89b360c commit f56cea6

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ To be released.
1010

1111
- The `uri` type has completly gone; use `url` instead.
1212
[[#126], [#281] by Jonghun Park]
13-
- Added constraints for numeric unboxed types. [[#206], [#271]]
13+
- Added [`@numeric-constraints`](docs/annotation.md#numeric-constraints)
14+
annotation to constraint the range of unboxed types' values.
15+
[[#206], [#271] by Seunghun Lee]
1416

1517
### Docs target
1618

docs/annotation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ class FileNotReadable(FileError):
132132

133133
### `@numeric-constraints` {#numeric-constraints}
134134

135-
`@numeric-constraints` annotation constrain the range of the input value.
135+
`@numeric-constraints` annotation constrains the range of unboxed types' values.
136136
Currently, available annotation arguments are below:
137137

138-
`min`: Minimum input value; inclusive
138+
`min`
139+
: Minimum input value; inclusive.
139140

140-
`max`: Maximum input value; inclusive
141+
`max`
142+
: Maximum input value; inclusive.
141143

142144
For example, the following first Nirum code is compiled to the second Python
143145
code:
@@ -148,13 +150,11 @@ unboxed month (int32);
148150
~~~~~~~~
149151

150152
~~~~~~~~ python
151-
class Month(object):
152-
...
153-
def __init__(self, value: '__builtin__.int') -> None:
154-
...
155-
if not (value <= (12)):
153+
class Month:
154+
def __init__(self, value: int) -> None:
155+
if not value <= 12:
156156
raise ValueError("value is greater than 12")
157-
if not (value >= (1)):
157+
if not value >= 1:
158158
raise ValueError("value is less than 1")
159159
...
160160
~~~~~~~~

0 commit comments

Comments
 (0)