Commit Graph

621 Commits

Author SHA1 Message Date
Andreas Rumpf
9c6dde1b70 Merge pull request #8990 from LemonBoy/fix-8259
Always check the deduced type validity for result
2018-09-17 22:45:12 +02:00
Andreas Rumpf
3467c455c0 fixes #1616; fixes 'nim doc' regressions 2018-09-17 19:54:56 +02:00
LemonBoy
3588240226 Always check the deduced type validity for result
Fixes #8259
2018-09-17 15:33:44 +02:00
Andreas Rumpf
84d122b5c8 extended system.type/typeof to support an upcoming 'collect' macro that works much better than sugar.lc 2018-09-11 19:02:05 +02:00
LemonBoy
e69d8ec416 Fix type comparison in semConv (#8907)
Fixes #8905
2018-09-07 21:06:30 +02:00
Andreas Rumpf
1948eadc24 change runnableExamples implementation; fixes #8641; fixes #7135; runnableExamples works for templates and generics 2018-09-02 22:56:26 +02:00
Andreas Rumpf
df4d5b77a1 introduce precise string '[]', '[]=' accessors; fixes #8049 (#8817) 2018-08-30 23:01:15 +02:00
Andreas Rumpf
361a2d830a enforce the condition of a 'when' condition to be of type bool; refs #8603 2018-08-23 17:54:04 +02:00
Araq
30597e643f fixes merge conflict 2018-08-23 11:30:55 +02:00
LemonBoy
a87341775a Don't consider tyAnd/tyNot/tyOr/tyAnything as generic (#8700)
* 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.
2018-08-22 09:40:31 +02:00
Andreas Rumpf
ddaf2e3805 some progress on destructors for builtin seqs 2018-08-20 17:59:47 +02:00
Araq
96c6c82d55 fixes #8425 2018-08-04 20:10:03 +02:00
skilchen
143834ba4e keep the imports in runnableExamples visible in generated html doc (#8354) 2018-07-19 01:05:07 +02:00
Timothee Cour
d07489abf4 fix #7405 and #8195 (#8198)
* fix #7405 and #8195

* control pushInfoContext in semExprNoType,genStmts via a new hintExtendedContext; make NotesVerbosity computation more DRY

* addressed comments
2018-07-16 13:34:44 +02:00
Andreas Rumpf
04b3f8f24a enable destructors without the --newruntime switch 2018-07-04 20:36:15 +02:00
LemonBoy
dbbe311e18 Minor changes to discardable handling (#8155) 2018-07-01 15:27:14 +02:00
Vindaar
898a4bc4fa fix #8129 by calling semExpr in semIs if node is strLit (#8130)
* 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`.
2018-06-29 16:34:47 +02:00
Andreas Rumpf
2a3a128e36 Merge branch 'devel' into typedesc-reforms 2018-06-26 18:33:51 +02:00
LemonBoy
bfa3d62cc1 More concept fixes
Fixes #7705, #7703, #7702
2018-06-24 15:13:34 +02:00
Zahary Karadjov
e129466910 requested pull-request changes 2018-06-16 16:46:32 +03:00
Zahary Karadjov
59d19946c0 fix some breakage after rebasing 2018-06-16 16:46:32 +03:00
Zahary Karadjov
5bcf8bcb59 fixes #7222; fixes #5595; fixes #3747
* 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
2018-06-16 16:46:32 +03:00
Zahary Karadjov
a49b06a52a Implement the is operator for the new static and typedesc type classes
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
2018-06-16 16:46:32 +03:00
Zahary Karadjov
fb27357b62 A minimal patch enabling the new typedesc and static types syntax 2018-06-16 16:46:32 +03:00
Andreas Rumpf
5348fef003 implements a --nep1:on switch to make the compiler enforce the naming conventions outlined in NEP-1 2018-06-13 01:44:19 +02:00
Yuriy Glukhov
8f06763491 Fixes #6803 2018-06-11 22:38:40 +03:00
Araq
1074cc1fb9 fixes yet another merge conflict 2018-06-11 17:17:34 +02:00
Araq
68ba13c759 fixes merge conflict 2018-06-11 17:05:23 +02:00
Andreas Rumpf
76676cb79f Merge pull request #8009 from yglukhov/remove-oldIterTransf
Removed oldIterTranf feature
2018-06-11 16:45:35 +02:00
Yuriy Glukhov
5c449c8cd1 Removed oldIterTranf feature 2018-06-10 23:42:53 +03:00
Vindaar
4ab6dd51b0 fix #7997
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.
2018-06-10 18:01:06 +02:00
Araq
8e9551b1c7 fixex merge conflicts 2018-06-08 19:50:36 +02:00
Andreas Rumpf
826c1e2d78 incremental compilation: implemented basic replay logic 2018-06-02 09:41:27 +02:00
Andreas Rumpf
40ec7be45c refactoring: remove idents.legacy global variable and pass the IdentCache around explicitly 2018-05-27 22:09:15 +02:00
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +02:00
Andreas Rumpf
f86ca02960 make semantic checking free of globals 2018-05-18 15:59:44 +02:00
Andreas Rumpf
a4e2b0c153 platform.nim doesn't use globals anymore; prepare msgs.nim for not using globals 2018-05-18 15:18:00 +02:00
Andreas Rumpf
bf6c2c5ccf preparations of making compiler/msgs.nim free of global variables 2018-05-17 15:21:22 +02:00
Araq
2a7fc84c86 remove ast.emptyNode global; cleanup configuration.nim 2018-05-16 03:06:07 +02:00
Yuriy Glukhov
cfe40a3e6e Merge branch 'devel' into yield-in-try 2018-05-15 19:54:52 +03:00
Araq
5526252fa0 fixes testament compilation 2018-05-14 17:45:44 +02:00
Andreas Rumpf
328e7a1005 options.nim: no global variables anymore 2018-05-13 17:52:21 +02:00
Andreas Rumpf
e4c088721a make nimsuggest compile again 2018-05-13 09:53:00 +02:00
Andreas Rumpf
050789a8f4 sem pass compiles again 2018-05-12 21:30:42 +02:00
Andreas Rumpf
dd35111ff2 semstmts compiles again 2018-05-12 19:45:19 +02:00
Andreas Rumpf
ce859d8c16 more modules compile again 2018-05-12 16:35:59 +02:00
Yuriy Glukhov
ce63490928 Yield in try 2018-05-09 22:25:28 +03:00
Zahary Karadjov
cf13c5fba4 implement the export/except statement 2018-05-07 09:37:49 +02:00
Zahary Karadjov
2b8bf8fc4a A motivating example for the new bindSym behavior.
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)
2018-05-07 09:37:49 +02:00
Zahary Karadjov
bdcb729597 Better support for treating templates and macros as symbols.
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.
2018-05-07 09:37:49 +02:00