Commit Graph

526 Commits

Author SHA1 Message Date
Andreas Rumpf
63530be0b8 introduce --newruntime switch for the upcoming destructors and move semantics 2017-10-13 06:38:59 +02:00
Andreas Rumpf
a2e4ab2e4e simple programs now work with the new destroyer pass 2017-10-12 17:42:15 +02:00
Andreas Rumpf
d8746398c4 allow macros to produce nnkGotoState and nkState 2017-10-09 21:12:40 +02:00
Andreas Rumpf
61720e0df9 breaking change: getAst strips away pointless nnkStmtList nodes; node rendering of nnkStmtList without wrong indentation 2017-09-26 10:24:14 +02:00
Andreas Rumpf
e879da5791 some work to make 'opt' a first class type 2017-09-24 11:21:52 +02:00
Andreas Rumpf
be2e7290fb write tracking for funcs implemented 2017-09-23 23:29:23 +02:00
Andreas Rumpf
1a61c4d46d first implementation of the 'func' keyword 2017-09-23 23:22:53 +02:00
Andreas Rumpf
fd4ef6ae8f .pure enums are much more convenient to use now 2017-09-17 17:36:37 +02:00
Andreas Rumpf
a08fb61da9 make tests green again 2017-08-31 13:59:25 +02:00
Andreas Rumpf
8d714d2b02 low/high/of are now overloadable operations 2017-08-30 23:14:33 +02:00
Parashurama
03b11b66cf fixes mitems iterator on vm. (issue with tuple value)
this discard any implicit conversion on iterator return value.
the previous behaviour was to return a reference to a converted copy and
thus not modifying the original value.
2017-08-19 08:58:57 +02:00
Zahary Karadjov
c3e5c6c326 treat var modifiers inside the concept body correctly: #1033 2017-08-19 08:57:43 +02:00
Andreas Rumpf
4e3bdcc84b fixes #6127 2017-07-22 17:07:59 +02:00
Andreas Rumpf
ee43fc82d5 bugfix: keep the information of a raw float literal in the AST 2017-07-06 13:52:21 +02:00
Andreas Rumpf
82175b43bb do not crash for #5895 2017-07-06 13:52:21 +02:00
Zahary Karadjov
07d50cedf0 Fix #5983 2017-06-20 11:29:42 +02:00
Zahary Karadjov
21ce7b2af4 Fix #5888 2017-06-20 11:29:42 +02:00
Zahary Karadjov
cd02561368 introduce a pre-processing pass for the concept bodies
fixes #4982
fixes #3805

close #3414
2017-06-20 11:29:42 +02:00
Parashurama
bbf9ef606d restrict casting for closure. (#5948); fixes #5742
* restrict casting for closure.

This commit forbid casting a closure to anything other than another
closure. use rawEnv/rawProc to access underlaying pointers.

* better error message for closure cast
* fixes #5742
2017-06-07 08:52:50 +02:00
Andreas Rumpf
c59bc0cc18 first steps to allow easy functors via macros 2017-06-04 11:17:41 +02:00
Andreas Rumpf
61a0eba14f Merge branch 'zahary' into araq2 2017-05-17 15:27:04 +02:00
Andreas Rumpf
503f780676 Merge branch 'zahary' into araq2 2017-05-16 17:32:18 +02:00
Zahary Karadjov
672c24e4b8 fix affecting templates with explicit generic params 2017-05-13 20:48:44 +03:00
cooldome
c6a8bd264e Fix for #5695 make subscript operator overloadable for tuples (#5749) 2017-04-24 20:17:06 +02:00
Zahary Karadjov
54a1d9c16a wip 2017-04-11 00:48:52 +03:00
Zahary Karadjov
8cb11aac4f adapt quote to the new parsing rules 2017-04-10 12:23:04 +03:00
Zahary Karadjov
987b522071 fix the do notation when used with procs 2017-04-09 22:59:24 +03:00
Zahary Karadjov
e9a3ffbc3d Restore the Nim's 0.14 proper handling of generic aliases
A more efficient implementation is possible by restoring the old
lifting ot tyGenericInvocation to tyGenericInst in liftTypeParam,
but this fix will suffice for now.

fixes #5087
fixes #5602
fixes #5641
fixes #5570
2017-04-08 17:28:19 +03:00
Zahary Karadjov
fb3ff64450 fix #5642 2017-04-07 19:28:52 +03:00
Zahary Karadjov
34c34cb49b move the object construction logic to a separate file 2017-04-06 00:46:18 +03:00
Zahary Karadjov
f162214d5d object construction: test cases and manual additions 2017-04-06 00:46:18 +03:00
Zahary Karadjov
564c0acae2 cleaned up the code and implemented proper error messages 2017-04-06 00:46:18 +03:00
Zahary Karadjov
6edb07091d fix #4556
This implements a number of new safety checks and error messages
when object constructors are used:

In case objects:

* the compiler will prevent you from initializing fields in
conflicting branches

* When a field from a particular branch is initialized, the
compiler will demand that the discriminator field is also
supplied with a maching compile-time value

In all objects:

* When the "requiresInit" pragma is applied to a type, all fields
of the type must be initialized when object construction is used.

The code will be simplified in a follow up commit.
2017-04-06 00:45:12 +03:00
Andreas Rumpf
529609f7ed Merge remote-tracking branch 'origin/concepts-rebased' into araq 2017-03-31 16:40:21 +02:00
Andreas Rumpf
d02486aa48 compiler: better error messages (#5613) 2017-03-26 20:24:06 +02:00
Zahary Karadjov
cbf66e99a8 Working test cases for the sophisticated matrix library example from the manual
Fixed the dot operator when used within return types (see tgenericdotrettype)
Fixed the matching of generic concepts aliases used with the implicit generics style
2017-03-24 16:59:47 +02:00
Zahary Karadjov
fe48dd1cbe further improvements to the error messages produced by concepts 2017-03-24 16:59:47 +02:00
Zahary Karadjov
74a80988d9 proper error reporting for concepts and the introduction of the {.explain.} pragma 2017-03-24 16:59:47 +02:00
Zahary Karadjov
0f2c4be129 infer static parameters even when more complicated arithmetic is involved 2017-03-24 16:58:15 +02:00
Zahary Karadjov
0b0a3e5f20 support derived values in non-generic user type classes 2017-03-24 16:58:15 +02:00
Zahary Karadjov
a90c4c4d7e kill the reportConceptFailures options as it will be replaced by the .explain. pragma 2017-03-24 16:58:15 +02:00
Zahary Karadjov
8cd5f1f8f5 introduce tyInferred for the unbound concept type params
* Why is tyInferred needed?

The bindings in TCandidate are capable of inferring types within a single
call expression. In concepts, we need to infer types in the same way, but
across the whole body of the concept.

Previously, once a concept type param was inferred, it was destructively
mutated using t.assignType, but this proved to be problematic in the presence
of overloads, because the bindings established while a non-matching overload
is tested must be reverted/forgotten. tyInferred offers a non-destructive way to
keep track of the inference progress.

While introducing new types usually requires a lot of code paths in the compiler
to updated, currently tyInferred is only a short-lived type within the concept body
pass and it's unlikely to introduce breakage elsewhere in the compiler.
2017-03-24 16:58:15 +02:00
Zahary Karadjov
0a9a878bd3 support for matching generic types' procs in generic concepts 2017-03-24 16:58:15 +02:00
Zahary Karadjov
33f4e69759 support for accessing types and consts defined in concepts with the dot operator 2017-03-24 16:58:15 +02:00
Zahary Karadjov
eab1d0cc02 support for accessing the inferred concept type params with the dot operator 2017-03-24 16:58:15 +02:00
Zahary Karadjov
66e0f0e19c concept type params inference working in basic examples 2017-03-24 16:58:15 +02:00
zah
be174fc3c7 Fix generic forward declarations; fixes #4104; fixes #4908 (#5566) 2017-03-23 12:40:57 +01:00
Araq
e01d2244e4 make semObjConstr robust for nimsuggest 2017-03-21 13:02:38 +01:00
Andreas Rumpf
2d0ee2c8ab mark symbols in getAst context as used 2017-03-20 11:44:58 +01:00
Andreas Rumpf
a6b0af539b revert getAst handling to not use overloading resolution 2017-03-20 10:56:15 +01:00