Commit Graph

151 Commits

Author SHA1 Message Date
Andreas Rumpf
2ab6b2c657 --newruntime: work in progress 2019-03-14 07:59:44 +01:00
Andreas Rumpf
4be36d77f6 introduce tfHasOwned for fast must-move checkings; removed tfAcyclic as the GC has ignored this hint for quite some time now 2019-03-05 19:58:54 +01:00
Andreas Rumpf
728ff1004a gc:destructors: progress 2019-02-28 22:39:24 +01:00
Andreas Rumpf
ea409fb15a first steps in implementing 'owned' pointers; undocumented, do not use 2019-02-23 08:44:08 +01:00
LemonBoy
0ebef1764d Propagate tfGcSafe flag to generic instantiations (#10620)
Fixes a nasty endless loop in the generic instantiation phase.
2019-02-13 23:30:14 +01:00
Andreas Rumpf
dee8e6e98a gc: destructors is beginning to work (#10483)
* kochdocs.nim: code cleanup
* docgen: nicer indentation
* parser.nim: code cleanup
* fixes #10458
* make tests green again
* make =destroy mixins
* gc:destructors: produced C code is almost working
* --gc:destructors simple program compiles (but leaks memory)
* gc:destructors make examples compile in C++ mode
* destructors: string implementation bugfixes
* strs.nim: minor code cleanup
* destructors: builtin seqs are beginning to work
* remove debugging helpers
2019-01-29 15:12:16 +01:00
Ray Imber
94f6a6b294 Fix for issue #10342. better message for generic subclass instantiation (#10354)
* Fix for issue #10342. better message for generic subclass instantiation errors.
2019-01-22 17:05:26 -08:00
Andreas Rumpf
e4ae7a8929 Merge pull request #8748 from LemonBoy/when-in-objects
Pervasive replacement of nkRecWhen in generic types
2018-12-12 18:19:52 +01:00
Araq
abbafe606e IC: further progress 2018-12-01 00:36:14 +01:00
Araq
e71410d74e language cleanup: the .unchecked pragma is dead 2018-11-06 13:55:03 +01:00
LemonBoy
5afcd09cb3 Pervasive replacement of nkRecWhen in generic types
Long story short, even if the type contains no reference at all to its
generic parameters we still have to walk its AST and evaluate any
nkRecWhen nodes that semRecordNodeAux skipped due to the type being a
generic one.

We also must be careful to modify the type `n` node in place since it
may be referenced by the caller as seen in the tillegaltyperecursion
test.

Moreover we also can't have the nkSym drift away from their original
values in order not to break the JS nkObjConstr codegen.
2018-10-19 22:17:38 +02:00
cooldome
eaca5be9d6 Change the order of compilation passes, transformation is made lazy at code gen (#8489)
* Ast no transformation
* Add getImplNoTransform to the macros module
* progress on delaying transf
* Fix methods tranformation
* Fix lazy lambdalifting
* fix create thread wrapper
* transform for lambda lifting
* improve getImplTransformed
* Fix destructor tests
* try to fix nimprof for linux
2018-10-18 20:21:25 +02:00
Miran
675c629fee replace deprecated safeAdd with add (#9416) 2018-10-18 12:29:32 +02:00
Araq
7ac1e6e528 fixes #5479 2018-10-02 23:31:39 +02:00
Araq
5ee904643a fixes #8883 2018-09-14 15:47:37 +02:00
Andreas Rumpf
dae5450947 WIP: disallow 'nil' for strings and seqs 2018-08-13 11:41:33 +02:00
Andreas Rumpf
04b3f8f24a enable destructors without the --newruntime switch 2018-07-04 20:36:15 +02:00
Zahary Karadjov
e129466910 requested pull-request changes 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
Andreas Rumpf
669a564492 remove more global variables in the Nim compiler 2018-05-27 11:10:56 +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
02b78d3f94 make tests green again 2018-05-14 21:38:18 +02:00
Andreas Rumpf
7eb39d9d26 guards.nim does compile 2018-05-11 13:07:16 +02:00
Andreas Rumpf
ee366f1746 .experimental can now be used to enable specific features 2018-04-24 09:34:29 +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
e4081a7201 preparations for language extensions: 'sink' and 'lent' types 2018-01-07 23:09:26 +01:00
Araq
8a601669ef fixes #6489 2017-11-23 02:32:51 +01:00
Araq
a6226d9452 fixes #6682 2017-11-22 23:39:50 +01:00
Andreas Rumpf
70ea45cdba deprecated unary '<' 2017-10-29 08:37:13 +01:00
Araq
3aa7c2232e destructors: supportsCopyMem finally works for recursive types 2017-10-26 00:55:23 +02:00
Andreas Rumpf
35c8b5e3bc destructors: irresponsibly simple tcustomseq test works 2017-10-17 22:04:40 +02:00
Araq
45d74f4081 destructors: preparations for upcoming changes 2017-10-17 12:46:49 +02:00
Andreas Rumpf
8780d25e03 minor refactorings for better destructors 2017-10-14 20:37:49 +02:00
Andreas Rumpf
1a61c4d46d first implementation of the 'func' keyword 2017-09-23 23:22:53 +02:00
Zahary Karadjov
ba61e7e3ac fix #2730; fix #4880 2017-06-20 11:29:42 +02:00
Zahary Karadjov
f0999de9dc Fix #5962
During the instantiation of a generic type A, some other generic
type B may be instantiated multiple times with different parameters.
We can think about each instantiation as a function call that should
temporary bind the parameter names to concrete types. The problem
with the existing implementation in semtypinst was that it was
performing this binding within a shared global table. In this sense,
it was executing the code as a programming language featuring only
global variables. In such a language, re-entrant functions cannot be
defined properly and hence this was leading to problems with similar
types. The solution is simple - just like we need to introduce stack
frames to handle re-entrant functions, we introduce a stack of type
bindings that are pushed and popped during the generic instantiations.
2017-06-20 11:29:42 +02:00
Araq
4033929127 fixes tproctypecache_falsepositive.nim test case 2017-06-08 18:35:37 +02:00
Zahary Karadjov
d578815963 fix #5683 2017-04-14 23:54:09 +03:00
Zahary Karadjov
03172bef6f fix #5643; fix #5644 2017-04-08 23:42:42 +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
ee4b98ec17 wip fix #5640 2017-04-07 15:05:14 +03:00
andri lim
fce4b7cd62 attempt to fix #5621 #5615 generic ref object typeRel (#5633) 2017-03-31 21:58:09 +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
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
76c663f692 support for inferring static[T] concept params 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
Andreas Rumpf
93068f1ba6 avoid some compiler crashes in debug mode 2017-01-23 11:22:19 +01:00
Andreas Rumpf
e169eaac5b make tsigbreak.nim compile 2016-12-12 14:08:01 +01:00
Araq
ebaf57ea3b further progress 2016-11-28 14:16:28 +01:00