Commit graph

542 commits

Author SHA1 Message Date
Zahary Karadjov
31651ecd61 allow referencing other parameters in default parameter values
fix #7756
fix #1201
fix #7000
fix #3002
fix #1046
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
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
cooldome
101f23f3a6 manual merge 2 2018-06-12 23:23:21 +01:00
cooldome
37aa488f99 merge devel 2018-06-12 21:19:30 +01:00
Andreas Rumpf
aaceec0744
Merge pull request #7981 from cooldome/Fix_-7980
Fixes 7980
2018-06-12 11:50:40 +02:00
cooldome
77f33db3ed style fixes, typos 2018-06-12 09:27:37 +01:00
cooldome
44d82d9492 style improvements 2018-06-12 09:17:24 +01:00
cooldome
746da12d74 add comment 2018-06-12 00:22:11 +01:00
cooldome
1b7cf3df51 New approach 2018-06-12 00:20:08 +01:00
cooldome
4619ee7058 remove underscores 2018-06-11 23:20:31 +01:00
cooldome
a65e9c0e25 fix comments 2018-06-10 23:27:45 +01:00
cooldome
73b7ec9009 merge devel 2018-06-10 22:58:39 +01:00
Araq
8e9551b1c7 fixex merge conflicts 2018-06-08 19:50:36 +02:00
andri lim
80107b360c add more test to 4799 2018-06-05 09:18:20 +07:00
Andreas Rumpf
a5701d6b71 ensure compiler API doesn't import the RST engine 2018-05-29 08:22:09 +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
feef109e60 make tests green again 2018-05-18 20:53:41 +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
Araq
2a7fc84c86 remove ast.emptyNode global; cleanup configuration.nim 2018-05-16 03:06:07 +02:00
Araq
02b78d3f94 make tests green again 2018-05-14 21:38:18 +02: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
84bc04ba32 sigmatch compiles again 2018-05-11 18:04:11 +02:00
Zahary Karadjov
7297613900 Bugfix: The compiler were not inserting proper downcasts for generic types
This resulted in a codegen error in C++ mode, because the generic
types were not defined in modules where calls requiring downcasts
were used (generating a downcast forces the inclusion of the full
definition of the involved types).
2018-05-07 09:37:49 +02:00
Zahary Karadjov
e678a4285d Bugfix: Allow matching on nkExprEqExpr against varargs[untyped]
This enables macros accepting arbitrary keyword arguments:

log("foo", prop1 = "bar", prop2 = "baz")

As an added bonus, simple templates with varargs arguments can now
forward their params to procs accepting keyword arguments.
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
cooldome
3e5c94664d merge devel 2018-04-29 23:28:18 +01:00
Andreas Rumpf
9d77f61038 sigmatch: speed it up 2018-04-28 18:48:18 +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
andri lim
e4aa140d22 fixes #7600, generic object with generic ref object parent typerel bug (#7678)
* fixes #7600

* fix wrong logic
2018-04-27 08:53:20 +02:00
cooldome
a95316f78b Implement float range types 2018-04-26 23:47:51 +01: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
Araq
3979e83a59 fixes #7331 2018-03-18 17:56:28 +01:00
Andreas Rumpf
55a5dcf8a4 improves the stability of 'nim check' 2018-03-13 08:15:24 +01:00
Andreas Rumpf
3dab0877da fixes #7247 2018-02-23 11:42:19 +01:00
cooldome
51d81c4e23 Fixes #6853 (#7188)
* Fixes #6853
* Add a test for a const empty array
2018-02-10 16:44:41 +01:00
Andreas Rumpf
326b7dc556 improve the error messages regarding type mismatches in overloading resolution 2018-02-04 07:04:50 +01:00
Andreas Rumpf
992fd38487 make tests green again 2018-02-03 07:57:47 +01:00
Andreas Rumpf
1b22a3b346 disabled non-documented overloading rule for templates and macros 2018-02-02 11:00:42 +01:00
Andreas Rumpf
bd1dfa4b38 better type inference for numerical types; prerequisitive for version 1 2018-02-02 09:29:05 +01:00
Andreas Rumpf
2015895357 sink type begins to compile 2018-01-08 01:47:54 +01:00
Andreas Rumpf
a9ac241691 fixes #6073 2017-11-18 22:13:46 +01:00
cooldome
8443e3f6be Fix compiler crash (#6773) (#6774) 2017-11-18 09:21:37 +01:00
Andreas Rumpf
9e4e1949e8 concepts: fixes the stack overflow that happens for #6691 2017-11-05 21:31:02 +01:00
Andreas Rumpf
286f895280 make range type checking more restrictive, see tn8vsint16 test case; minor breaking change 2017-11-01 15:33:28 +01:00
Andreas Rumpf
29c075299d made nimresolve part of the compiler 2017-10-29 15:40:50 +01:00