provide better error messages for large set (#20207)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
parent
d143924ab2
commit
404e91ce48
2 changed files with 8 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ const
|
||||||
errWrongNumberOfVariables = "wrong number of variables"
|
errWrongNumberOfVariables = "wrong number of variables"
|
||||||
errInvalidOrderInEnumX = "invalid order in enum '$1'"
|
errInvalidOrderInEnumX = "invalid order in enum '$1'"
|
||||||
errOrdinalTypeExpected = "ordinal type expected"
|
errOrdinalTypeExpected = "ordinal type expected"
|
||||||
errSetTooBig = "set is too large"
|
errSetTooBig = "set is too large; use `std/sets` for ordinal types with more than 2^16 elements"
|
||||||
errBaseTypeMustBeOrdinal = "base type of a set must be an ordinal"
|
errBaseTypeMustBeOrdinal = "base type of a set must be an ordinal"
|
||||||
errInheritanceOnlyWithNonFinalObjects = "inheritance only works with non-final objects"
|
errInheritanceOnlyWithNonFinalObjects = "inheritance only works with non-final objects"
|
||||||
errXExpectsOneTypeParam = "'$1' expects one type parameter"
|
errXExpectsOneTypeParam = "'$1' expects one type parameter"
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,13 @@ The reason is that sets are implemented as high performance bit vectors.
|
||||||
Attempting to declare a set with a larger type will result in an error:
|
Attempting to declare a set with a larger type will result in an error:
|
||||||
|
|
||||||
```nim
|
```nim
|
||||||
var s: set[int64] # Error: set is too large
|
|
||||||
|
var s: set[int64] # Error: set is too large; use `std/sets` for ordinal types
|
||||||
|
# with more than 2^16 elements
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Note:** Nim also offers `hash sets <sets.html>`_ (which you need to import
|
**Note:** Nim also offers `hash sets <sets.html>`_ (which you need to import
|
||||||
with `import sets`), which have no such restrictions.
|
with `import sets`), which have no such restrictions.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue