Timothee Cour
e78ef57c93
typetraits: add toSigned, toUnsigned ( #18445 )
...
* typetraits: add toSigned, toUnsigned
* improve and add tests
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2022-04-07 17:38:01 -04:00
flywind
7f6e800caf
move assertions out of system ( #19599 )
2022-03-23 20:34:53 +01:00
Timothee Cour
8ce782d463
Add optional recursive arg to distinctBase (v2) ( #18659 )
...
* Add optional recursive arg to distinctBase
* Add docs and examples
Co-authored-by: ALANVF <alan.invents@gmail.com>
2021-08-09 08:51:39 +02:00
Timothee Cour
128d21be1c
add typetraits.pointerBase to return T in ref T|ptr T ( #18293 )
...
* add typetraits.deref to return T in ref T|ptr T
* deref => refBase
* refBase=>pointerBase
* [skip ci] address comment
2021-06-20 09:49:18 +02:00
Andreas Rumpf
a9b62de895
CIs: attempt to use csources_v1 ( #16282 )
...
* CIs: attempt to use csources_v1
* also updated the BSDs
* also updated azure pipelines
* std modules should not itself use the 'std/' import dir...
* compiler has to be careful with std/ for v1 booting
2021-04-21 07:41:33 +02:00
flywind
81e54c1d30
Add hasClosure to std/typetraits ( #17501 )
...
* fix nim js cmp fails at CT
* Add `hasClosure` to `std/effecttraits`
* type
* Update changelog.md
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* Update lib/std/effecttraits.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-03-29 14:22:29 +02:00
Timothee Cour
eb07a5a75b
add typetraits.OrdinalEnum, enumutils.symbolName ( #17281 )
2021-03-10 08:08:24 -08:00
Timothee Cour
c274e67198
add enumutils.items for sparse enums, typetraits.SomeSparseEnum ( #17080 )
...
* add enumutils.items for enum with holes
* changelog
* ref in lib.rst
* use `type SomeSparseEnum* = (not Ordinal) and enum` instead of concept
* address comment: rename back to enum with holes
2021-02-23 20:25:35 +01:00
flywind
d447c0fe3f
use typeof instead type ( #16962 )
2021-02-08 09:46:07 +01:00
Timothee Cour
1a74576854
distinctBase now is identity instead of error for non distinct types ( #16891 )
2021-02-01 13:10:52 +01:00
konsumlamm
c05d1aab13
Add more runnableExamples ( #16864 )
...
Add more links
2021-01-31 18:53:22 +00:00
Timothee Cour
8f1f0bd1da
typetraits: make genericHead docs reflect reality; use runnableExamples ( #16776 ) [backport:1.4]
2021-01-22 15:06:45 +01:00
Ivan Bobev
d03f24147a
Add a macro returning enum items count ( #15824 )
...
Add a macro `enumLen` which is used to determine the number of items in
an enumeration type to the `typetraits.nim` module. Also, add unit tests
for it in the `ttypetraits.nim` module.
Related to nimlang/Nim#15824
2020-11-09 10:02:01 +01:00
Andreas Rumpf
ccccd30cf6
fixes #15221 ( #15230 )
2020-08-27 11:25:20 +02:00
alaviss
56b3d422b0
typetraits: features and fixes ( #14791 )
...
* typetraits: add support for nnkTypeOfExpr
* typetraits: don't wrap typedesc symbols in StaticParam
* typetraits: add nested generics support to genericParams
* typetraits: make genericParams understand array[I, T] whackiness
Also moved tests to ttypetraits
* typetraits: clarify comment on genericParams
2020-06-30 15:25:53 +02:00
Timothee Cour
1b41c3122b
fix #13432 typetraits.$: $(int,) is now (int,); $tuple[] is now tuple[] ( #14799 )
...
* typetraits.$: $(int,) is now (int,); $tuple[] is now tuple[]
* changelog
2020-06-29 09:34:05 +02:00
Timothee Cour
3e5743d6f7
add typetraits.elementType ( #14780 )
...
* add typetraits.elementType
* add a test for 0-sized seq
2020-06-24 22:31:07 +02:00
Andreas Rumpf
da29222f86
init checks and 'out' parameters ( #14521 )
...
* I don't care about observable stores
* enforce explicit initializations
* cleaner code for the stdlib
* stdlib: use explicit initializations
* make tests green
* algorithm.nim: set result explicitly
* remove out parameters and bring the PR into a mergable state
* updated the changelog
2020-06-23 10:53:57 +02:00
Timothee Cour
b8ec07f19e
properly fixes #13758 so that import std/macros stays legal ( #14291 )
...
* properly fix https://github.com/nim-lang/Nim/issues/12389
* use --lib:lib in koch.nim.cfg instead
* third time is the charm
2020-05-12 08:27:47 +02:00
hlaaftana
3e060cfb0a
=> supports pragmas & names (+ changed behavior) ( #14200 )
...
* => supports pragmas & names (+ changed behavior)
(x, y: int) is now parsed as (x: int, y: int) instead of
(x: auto, y: int) inside => and ->.
* fix pragma check
* fixes, use since & LHS of -> supports pragmas
2020-05-03 10:22:49 +02:00
hlaaftana
fbc97e712a
move since from inclrtl to std/private/since ( #14188 )
...
* move since from inclrtl to std/private/since
* move since import in system below for HCR
2020-05-02 23:51:59 +02:00
Miran
9c33bcac5c
change 'iff' to 'if' to stop "corrections" once and for all ( #14182 )
2020-05-01 15:54:03 +02:00
hlaaftana
31ba27590c
small docs fix in typetraits ( #14108 )
2020-04-25 20:35:20 +02:00
hlaaftana
b2141fc2a1
changed type() to typeof() in docs and error messages ( #14084 )
2020-04-24 09:22:12 +02:00
Timothee Cour
10eabec6d4
fix #12864 static params were mutating arg types during sigmatch; fix #12713 ; refs #13529 ( #13976 )
...
* fix #12864 static params were mutating arg types during sigmatch
* fix test
* fix StaticParam
* also fixes #12713 ; added test case
2020-04-14 15:00:02 +02:00
Euan
1b31e08917
import macros rather than import std/macros. (#13762 )
2020-03-26 09:11:32 +01:00
Timothee Cour
98753da331
distinctBase overload for values ( #13746 )
2020-03-25 21:47:03 +01:00
Miran
14b2354b7d
rename lenTuple and lenVarargs ( #13639 )
...
* rename 'lenTuple' to 'tupleLen'
Rationale:
`lenTuple` is a tuple consisting of lengths (e.g. `(1, 5, 0)`),
`tupleLen` is a length of a tuple (e.g. `tupleLen((1, 5, 0) == 3`)
* rename 'lenVarargs' to 'varargsLen'
The same rationale as a previous commit. Consistency.
2020-03-12 20:07:02 +01:00
Araq
9e2bce2a8c
hotfix: make --useVersion:1.0 work
2020-03-10 16:01:13 +01:00
Timothee Cour
451b724c40
make genericParams support static[T] generic params ( #13433 )
...
* make genericParams support static[T] generic params
* WrapStatic => StaticParam
2020-03-02 18:05:14 +01:00
Timothee Cour
273a93581f
fix incorrect lenTuple implementation ( #13423 )
2020-02-19 11:07:17 +01:00
Clyybber
fb94836bc7
Tiny since cleanup ( #13286 )
2020-01-28 20:02:07 +01:00
Timothee Cour
4cd86c0842
typetraits: fixes #6454 ; genericParams; added lenTuple; added tuple type get ( #13064 )
2020-01-10 08:51:37 +01:00
cooldome
871d5e79b1
distinctBase type trait for distinct types ( #13031 )
2020-01-08 00:36:57 +01:00
Araq
5abe880469
last stdlib cleanups
2019-09-21 06:43:37 +02:00
narimiran
f1a945b05f
bring back typetraits.$ for backward compatibility
...
Some packages are still using ``from typetraits import `$` ``
which is now available from system (no need to import it).
2019-03-14 17:09:33 +01:00
Miran
84d3f3d448
move system.dollars in a separate file ( #10829 )
2019-03-13 15:59:09 +01:00
Miran
ca7980f301
improved documentation for several modules ( #10752 )
...
More detailed documentation for:
* md5
* hashes
Mostly cosmetic improvements for:
* threadpool
* typetraits
* channels
* threads
2019-03-01 12:57:55 +01:00
Timothee Cour
6ce3949c8a
add isNamedTuple; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) which leaked implementation detail ( #10070 )
...
* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2)
fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim
* Note: isNamedTuple is useful in other places, eg #10010 (comment)
* move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim
* remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
2019-01-08 18:37:25 -08:00
Timothee Cour
a6633b9658
fix typetraits.$ regression https://github.com/c-blake/cligen/issues/84 ( #10131 )
...
* fix typetraits.`$` regression https://github.com/c-blake/cligen/issues/84
* add test
2018-12-30 09:40:21 +01:00
Timothee Cour
0831292863
revives: Move typetraits.$ to system. Fixes #5827 ( #10071 )
...
* Move typetraits.`$` to system. Fixes #5827 .
* revive PR; adjust code to make sure everything works and add tests
* fix tests/concepts/tstackconcept.nim
* address comments
2018-12-30 01:09:47 +01:00
Araq
7df722844b
typetraits: Dots for sentence endings.
2018-09-15 20:32:11 +02:00
Araq
0841eaa273
typetraits.arity: improve the documentation; fixes #8965
2018-09-15 13:46:00 +02:00
Timothee Cour
426e5c2d1f
simplify typetraits.nim test ( #8193 )
2018-07-03 12:19:46 +02:00
Lynn C. Rees
0ab373115c
Trim remaining expr/stmt from stdlib ( #6742 )
2017-11-15 17:34:48 +01:00
Andreas Rumpf
9565da11e5
added typetraits.; merged PR #5839 manually
2017-10-30 09:24:17 +01:00
Andreas Rumpf
e7f37d7223
added typetraits.supportsCopyMem
2017-10-17 21:59:17 +02:00
Zahary Karadjov
9574d318ae
use lower-case proc names
2017-03-24 17:03:55 +02:00
Zahary Karadjov
52b241fd57
new type traits: GenericHead and StripGenericParams
2017-03-24 16:59:47 +02:00
Araq
d05df2173b
Nimrod renamed to Nim
2014-08-28 09:50:51 +02:00