summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-04-18 07:27:03 +0200
committerGitHub <noreply@github.com>2021-04-18 07:27:03 +0200
commit7b6ab5109fe76afefbf5744b5f9f534e86d94629 (patch)
treebc7560e7f05928eecc7e18dfe72208ad412e7272
parentc8b8cb8458cf0aa5a33e9a94209ee1cb6df7646c (diff)
downloadNim-7b6ab5109fe76afefbf5744b5f9f534e86d94629.tar.gz
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>
-rw-r--r--lib/system.nim2
-rw-r--r--tests/ic/tstdlib_import_changed.nim15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index b7a4b45cf..532883853 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -980,7 +980,7 @@ proc `@`* [IDX, T](a: sink array[IDX, T]): seq[T] {.magic: "ArrToSeq", noSideEff
   ##   echo @a # => @[1, 3, 5]
   ##   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`.
   runnableExamples:
     assert (int, float).default == (0, 0.0)
diff --git a/tests/ic/tstdlib_import_changed.nim b/tests/ic/tstdlib_import_changed.nim
new file mode 100644
index 000000000..da69a53b5
--- /dev/null
+++ b/tests/ic/tstdlib_import_changed.nim
@@ -0,0 +1,15 @@
+discard """
+  output: '''yes'''
+"""
+
+echo "yes"
+
+#!EDIT!#
+
+discard """
+  output: '''yes2'''
+"""
+
+import std / [monotimes]
+#discard getMonoTime()
+echo "yes2"