summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortreeform <starplant@gmail.com>2020-12-27 01:45:30 -0800
committerGitHub <noreply@github.com>2020-12-27 10:45:30 +0100
commit626c2bc6589101bd1b0231a2608e32b51f73abba (patch)
tree1efb0c2f77bc882dd3472a0d54ddf17c57118781
parentb57df6d0b335595d3197eb6907fb8d1a8237fc7e (diff)
downloadNim-626c2bc6589101bd1b0231a2608e32b51f73abba.tar.gz
Add docs for nnkHiddenStdConv (#16408)
Add it to devel branch this time. I hope this works.
-rw-r--r--doc/astspec.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/astspec.txt b/doc/astspec.txt
index c41aee96f..019b735f5 100644
--- a/doc/astspec.txt
+++ b/doc/astspec.txt
@@ -1392,6 +1392,17 @@ Macro declaration
 Macros behave like templates, but ``nnkTemplateDef`` is replaced with
 ``nnkMacroDef``.
 
+Hidden Standard Conversion
+--------------------------
+
+.. code-block:: nim
+  var f: float = 1
+
+The type of "f" is ``float`` but the type of "1" is actually ``int``. Inserting 
+``int`` into a ``float`` is a type error. Nim inserts the ``nnkHiddenStdConv``  
+node around the ``nnkIntLit`` node so that the new node has the correct type of 
+``float``. This works for any auto converted nodes and makes the conversion 
+explicit.
 
 Special node kinds
 ==================