Commit Graph

338 Commits

Author SHA1 Message Date
Andreas Rumpf
3308d26581 breaking change: arrays of char do not convert to cstring; ptr to array of char does 2017-10-10 00:17:20 +02:00
Andreas Rumpf
e879da5791 some work to make 'opt' a first class type 2017-09-24 11:21:52 +02:00
Andreas Rumpf
1a61c4d46d first implementation of the 'func' keyword 2017-09-23 23:22:53 +02:00
Zahary Karadjov
4483cefa0c fix #5918 2017-08-19 08:57:43 +02:00
Zahary Karadjov
90e82f8ecf Fix #5084 2017-06-20 11:29:42 +02:00
Zahary Karadjov
a6006e56a7 Fix #4737 2017-06-20 11:29:42 +02:00
Zahary Karadjov
16eb4b1fee Fix #5127 2017-06-20 11:29:42 +02:00
Zahary Karadjov
367d232351 fix #1017; fix #3309 2017-06-20 11:29:42 +02:00
Zahary Karadjov
ba61e7e3ac fix #2730; fix #4880 2017-06-20 11:29:42 +02:00
Zahary Karadjov
9c6fe59b55 fix #5017; fix #5893 2017-06-20 11:29:42 +02:00
Zahary Karadjov
f713e730c8 fix #5864 2017-06-20 11:29:42 +02:00
Zahary Karadjov
dea6d8dd94 add a useful helper for debugging typeRel problems 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
Zahary Karadjov
30ccadfe4c fix #5890 2017-06-20 11:29:42 +02:00
Andreas Rumpf
7a95c961a7 cleanup of in/out covariance handling 2017-05-17 20:54:53 +02:00
Zahary Karadjov
0aede22e87 enforce the covariance rules for user-defined generic types 2017-05-13 14:38:07 +03:00
Zahary Karadjov
f4e73344d4 covariance for arrays and sequences 2017-05-12 18:42:46 +03:00
Zahary Karadjov
a802d72452 doh, forgot to add all files in the previous commit 2017-05-12 12:46:09 +03:00
Zahary Karadjov
c981284ddc a simple way to simulate covariance in generic types 2017-04-28 17:40:57 +03:00
Zahary Karadjov
3e52bb6535 fix a regrsesion in signature matching of derived ptr types 2017-04-18 23:55:59 +03:00
Zahary Karadjov
13701c0957 Restore the compilation of linalg by tweaking the complex disambiguation rules
This commit is a potentially breaking change, but the problem was that
linalg was relying on a previous bug in the compiler, which was fixed
in the concepts branch.

With the old disambiguation rules, generic procs like:

proc \`==\`[T](lhs, rhs: T)

and

proc \`==\`(lhs, rhs: Matrix32|Matrix64)

.. were considered equal, even though it's obvious that the second one
should be preferred. We never noticed this, because there was a bug in
sigmatch incorrectly counting one of the params of the second proc as
a non-generic match, thus giving it an edge.

This commit gives some preference to tyOr and tyAnd during the complex
disambiguation, which may affect overload resolution in other cases.

I see this only as a temporary solution. With my upcoming work on
concept refinement, I plan to provide an experimental implementation
of alaternative C++-like rules for determining which proc is more specific.
We can then discuss our strategy for dealing with such a breaking change.
2017-04-16 16:11:45 +03:00
Zahary Karadjov
2da4a4fbe3 fix regression in tmatrixconcept 2017-04-16 14:39:00 +03:00
Zahary Karadjov
dfbafff2e7 fix a compilation error in linalg 2017-04-16 02:44:58 +03:00
Zahary Karadjov
bf4ce87e5b fix #5689 2017-04-15 02:53:28 +03:00
Zahary Karadjov
d578815963 fix #5683 2017-04-14 23:54:09 +03:00
Zahary Karadjov
a3f19c87fb lift parameter-less do block to lambdas 2017-04-10 23:58:05 +03:00
Zahary Karadjov
987b522071 fix the do notation when used with procs 2017-04-09 22:59:24 +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
andri lim
2f9a698e87 attempt to fix #5632 typedesc typeRel regression (#5634) 2017-03-31 21:58:26 +02:00
Zahary Karadjov
a74ad869e9 requested code review changes 2017-03-29 16:15:30 +03:00
Zahary Karadjov
c605d57574 restore compilation and make all concepts tests green 2017-03-24 17:03:55 +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
644d645ea7 implement the special treatment of explicit type params in concepts 2017-03-24 16:58:15 +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
76c663f692 support for inferring static[T] concept params 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
815724db71 support the full range of type modifiers when declaring concept vars and testing proc signatures 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
andri lim
568c954062 fixes #5241, fixes #5411 inherit from specialized generic typeRel problem (#5573) 2017-03-23 23:39:29 +01:00
zah
a20a8e6adb fixes #4756 (#5557) 2017-03-17 17:11:37 +01:00
zah
650b20dc5e fix varargs forwarding for templates; fixes #5455 (#5505)
* fix varargs forwarding for templates; fixes #5455
* document the macros' varargs change in the news for 0.16.2
2017-03-13 22:02:11 +01:00
zah
1be0022e7c Fixes #5167 and related problems (#5475)
This commit returns to a bit less strict checking of the number
of macro arguments, because some old immediate macros rely on a
behavior where even the arity of the macro is not being checked.

It may be better if such macros are just declared to use varargs[expr],
but this remains for another day.
2017-03-12 09:33:49 +01:00
Andreas Rumpf
46efaf294b big compiler refactoring; avoid globals for multi method dispatcher generation 2017-02-22 16:27:52 +01:00