* Don't consider tyAnd/tyNot/tyOr/tyAnything as generic
`containsGenericType` was too shallow and didn't check all the branches.
The resulting half-processed nodes are often simplified by the constant
folding pass but when that's not possible we get a nasty error during
codegen.
Fixes#8693
* Move the blame onto the semFold pass
Slightly better evaluation of `is` forms.
* fix#7405 and #8195
* control pushInfoContext in semExprNoType,genStmts via a new hintExtendedContext; make NotesVerbosity computation more DRY
* addressed comments
* call `semExpr` in `semIs` if node is `strLit`, fixes#8129
In case the second son of the node in `semIs` is of kind `strLit`, we
now call `semExpr` to set the `typ` field of that node.
Also removes the `t2 != tyTypeDesc` check in `isOpImpl`, since the
kind of `n[2]` is already assertet with the `internalAssert`.
* reintroduce check for `t2.kind != tyTypeDesc` to fix test case
The `internalAssert` in the `isOpImpl` doesn't check
`n.sons[2].typ.kind` as I previously read, but rather
`n.sons[2].kind`. Therefore the check for `tyTypeDesc` here is
useful. Otherwise the last test case in `isopr.nim` fails.
Also removes the flag `efDetermineType` from the call to `semExpr`.
* late instantiation for the generic procs' default param values
* automatic mixin behaviour in concepts
Other fixes:
* don't render the automatically inserted default params in calls
* better rendering of tyFromExpr
This also makes the first baby steps towards a sound treatment of
higher-order kinds (type type int).
Adds test cases showcasing the new features.
* Also fixes breakage after the rebase
Fixes issue #7997, which was caused by an export of a `release` proc
in `locks`. Thus the `release` in `defined(release)` of the `ifDebug`
template, was of kind `nkSym` instead of `nkIdent`.
We fix this by getting the `PIdent` of the argument to `defined` using
`considerQuotedIdent`.
This has the nice property of also checking for a valid identifier for
us. E.g. `defined(123)` would fail with
```
Error: in expression 'defined(123)': identifier expected, but found
'123'
```
The `localError` is removed, due to a clear distinction between
`declared` and `defined` now.
The example is a proof-of-concept logging library, allowing you to define
lexically-scoped environments where certain logging attributes are applied
automatically to all logging statements.
fixes tmacro1 (use of `bindSym` inside static blocks)
This allows you to pass a template or a macro to another macro
which can then inspect the implementation of the former template/macro
using `getImpl`.
Since templates can be freely redefined, this allows you to treat
their symbols as compile-time variables that have lexical scope.
A motivating PoC example for a logging library taking advantage of
this will be provided in the next commit.
Implementation details:
* The name of a template or a macro will be consider a symbol if
the template/macro requires parameters
* For parameterless templates/macros, you can use `bindSym`, which
was extended to also work outside of compile-time procs.