IC exposes typedesc implementation shenanigans (#17759)
* IC exposes typedesc implementation shenanigans; so I change system.default's definition to what it should have been to begin with * Update lib/system.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
c8b8cb8458
commit
7b6ab5109f
2 changed files with 16 additions and 1 deletions
|
|
@ -980,7 +980,7 @@ proc `@`* [IDX, T](a: sink array[IDX, T]): seq[T] {.magic: "ArrToSeq", noSideEff
|
||||||
## echo @a # => @[1, 3, 5]
|
## echo @a # => @[1, 3, 5]
|
||||||
## echo @b # => @['f', 'o', 'o']
|
## echo @b # => @['f', 'o', 'o']
|
||||||
|
|
||||||
proc default*(T: typedesc): T {.magic: "Default", noSideEffect.} =
|
proc default*[T](_: typedesc[T]): T {.magic: "Default", noSideEffect.} =
|
||||||
## returns the default value of the type `T`.
|
## returns the default value of the type `T`.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
assert (int, float).default == (0, 0.0)
|
assert (int, float).default == (0, 0.0)
|
||||||
|
|
|
||||||
15
tests/ic/tstdlib_import_changed.nim
Normal file
15
tests/ic/tstdlib_import_changed.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
discard """
|
||||||
|
output: '''yes'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
echo "yes"
|
||||||
|
|
||||||
|
#!EDIT!#
|
||||||
|
|
||||||
|
discard """
|
||||||
|
output: '''yes2'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
import std / [monotimes]
|
||||||
|
#discard getMonoTime()
|
||||||
|
echo "yes2"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue