File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ echo f
122
122
- Added ` net.getPeerCertificates ` and ` asyncnet.getPeerCertificates ` for
123
123
retrieving the verified certificate chain of the peer we are connected to
124
124
through an SSL-wrapped ` Socket ` /` AsyncSocket ` .
125
-
125
+ - Added ` distinctBase ` overload for values: ` assert 12.MyInt.distinctBase == 12 `
126
126
127
127
## Library changes
128
128
Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ proc distinctBase*(T: typedesc): typedesc {.magic: "TypeTrait".}
71
71
# # Returns base type for distinct types, works only for distinct types.
72
72
# # compile time error otherwise
73
73
74
+ since (1 , 1 ):
75
+ template distinctBase* [T](a: T): untyped =
76
+ ## overload for values
77
+ runnableExamples:
78
+ type MyInt = distinct int
79
+ doAssert 12.MyInt.distinctBase == 12
80
+ distinctBase(type (a))(a)
74
81
75
82
proc tupleLen*(T: typedesc [tuple]): int {.magic: "TypeTrait", since: (1, 1).}
76
83
## Return number of elements of `T`
You can’t perform that action at this time.
0 commit comments