Commit Graph

609 Commits

Author SHA1 Message Date
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
Andreas Rumpf
b7116a28ee compiler refactoring, pass config around explicitly 2018-05-05 18:47:29 +02:00
Andreas Rumpf
6408646b02 minor speedup: concept tests still green 2018-04-28 18:37:45 +02:00
Andreas Rumpf
4adc31ee3d stuff that is green 2018-04-28 18:23:54 +02:00
Andreas Rumpf
f697596faf semcheck: code cleanups 2018-04-28 07:49:36 +02:00
Andreas Rumpf
ee366f1746 .experimental can now be used to enable specific features 2018-04-24 09:34:29 +02:00
Andreas Rumpf
07f4e8a4ed new 'var T' error messages with hyperlinks; closes #7373 2018-04-22 00:12:43 +02:00
Andreas Rumpf
b43025b754 fixes #5113 2018-04-21 23:58:24 +02:00
Andreas Rumpf
47335aab41 introduce nkTupleConstr AST node for unary tuple construction; breaking change 2018-04-13 17:45:58 +02:00
zah
121b9e26fb Static[T] fixes (#7333)
* fix the usage of unresolved static[T] parameters in proc signatures
* fix tsametype and tmacrogenerics
* Allow creating composite type classes with concepts and using them in type signatures
* Allow integers to be used in ident concatenations
* Support using imported C++ generic types in proc signatures
* fixes #7230
* closes #7379
* re-enable some metatype tests
2018-03-24 15:28:09 +01:00
Andreas Rumpf
3be4f9111c enforce 'var T' produces a view into the first parameter; refs #7373 2018-03-24 09:41:04 +01:00
Andreas Rumpf
6f747674be more checking for 'var T' as return type; refs #7373 2018-03-24 08:37:09 +01:00
Araq
b0994c7f92 better error messages 2018-03-18 12:04:22 +01:00