Commit Graph

385 Commits

Author SHA1 Message Date
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
66e0f0e19c concept type params inference working in basic examples 2017-03-24 16:58:15 +02:00
Araq
b1c494a150 Merge branch 'devel' of github.com:nim-lang/Nim into devel 2017-03-14 15:56:08 +01:00
Araq
142b604c13 fixes #5529; don't merge type visibility flags 2017-03-14 15:55:23 +01:00
Andreas Rumpf
4912300ca7 Merge branch 'devel' into faster-nimsuggest 2017-03-14 10:18:20 +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
Araq
556b564c7d nimsuggest: make tests green again 2017-03-10 00:18:24 +01:00
Arne Döring
92c2a51bf7 removed compiler internal list implementation (#5371) 2017-02-22 17:33:12 +01:00
Araq
97e26967f1 fixes #5383 2017-02-16 00:43:14 +01:00
Dominik Picheta
d5bb5e832b Merge branch 'devel' into feature/3691 2017-02-07 18:34:05 +01:00
Andreas Rumpf
abaf5d0bdb fixes #5285 2017-02-04 21:00:07 +01:00
Dominik Picheta
814f527175 Fixes based on @Araq's feedback. 2017-02-01 21:51:17 +01:00
Dominik Picheta
3cbfd56e1d Fixes #3691. 2017-02-01 21:11:40 +01:00
Dominik Picheta
e8c46d29cd WIP implementation of except ExcType as ident syntax. Refs #3691. 2017-02-01 00:32:56 +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
Araq
e6c5622aa7 removed tyArrayConstr completely from the compiler; introduced tyAlias instead in preparation for further bugfixes 2016-11-14 23:18:30 +01:00
Araq
b234b082b6 bootstrapping works again 2016-11-12 12:39:21 +01:00
Araq
773d17cd14 big refactoring: step 1 2016-10-31 15:34:44 +01:00
Jacek Sieka
f5c3eb6a25 clean up tyMutable remnants 2016-10-24 23:30:10 +08:00
Jacek Sieka
b3de34548d clean up tyConst remnants 2016-10-24 23:19:46 +08:00
Jacek Sieka
f488ed973d clean up tyBigNum remnants 2016-10-24 23:11:38 +08:00
Jacek Sieka
6f7b891bdc remove remnants of tyIter 2016-10-24 21:10:48 +08:00
Andreas Rumpf
9b810b17a2 fixes #4803 2016-09-24 21:00:31 +02:00
Andreas Rumpf
dfa0699e73 C++ backend: use .noInit pragma for non-public default constructors; refs #4687 2016-09-04 22:36:29 +02:00
Araq
884d5518dd Merged 2016-08-27 20:52:26 +02:00
Andreas Rumpf
969981c1da fixes #3606 2016-08-26 13:32:52 +02:00
Jacek Sieka
618e264b58 remove TLoc.heapRoot 2016-08-17 18:58:35 +08:00
Araq
a13cb26c40 next steps in getting symbol files to work again 2016-08-16 20:04:27 +02:00
Jacek Sieka
3cd4cf4320 remove unused stuff 2016-08-09 22:54:27 +08:00
Andreas Rumpf
39ebe2175b compiler almost free of deprecated expr/stmt names 2016-07-30 16:34:42 +02:00
Jacek Sieka
7d62f031f6 remove sfFakeConst 2016-07-30 16:19:53 +08:00
Andreas Rumpf
60b187513e stdlib and compiler don't use .immediate anymore 2016-07-29 23:51:01 +02:00
Andreas Rumpf
f5fa5dae85 generic multi-methods should work now 2016-07-28 20:23:24 +02:00
Andreas Rumpf
9eb909baf9 fixes #4485; package handling works better; docgen works with --project on Nimble package level 2016-07-19 14:13:23 +02:00
Andreas Rumpf
b7c1be03c8 added system.newSeqOfCap for improved efficiency 2016-07-15 17:04:14 +02:00
Andreas Rumpf
d7e172a6bc make tests green again 2016-07-10 01:17:08 +02:00
Andreas Rumpf
b47d9b7b91 fixes #4371 2016-07-08 10:34:12 +02:00
Jeff Ciesielski
94d1aa5109 Add the ability to pass a value with the -d flag
This allows the end user to use the {.magic: "IntDefine"/"StrDefine"}
pragmas to pass values into code at compile time.  This has a nice side
effect of also allowing/requiring a default value to be assigned in the
code (see osalloc.nim/StandaloneHeapSize for an example)
2016-07-04 18:11:25 -04:00
Andreas Rumpf
5f4e98bbc7 fixes #4395, getType still not entirely correct 2016-06-23 12:41:45 +02:00
Andreas Rumpf
e8d507c859 system. for cstrings uses value comparisons, not reference comparisons 2016-06-02 16:38:20 +02:00
Andreas Rumpf
4180f59b27 fixes #1713 2016-05-30 16:24:52 +02:00
Andreas Rumpf
0b84ee167b fixes #2159
Hints and warnings are only emitted for the main package that is compiled
2016-05-28 17:12:51 +02:00
Federico Ceratto
d9cb85c2d8 Spellcheck 2016-02-29 11:25:51 +00:00
Andreas Rumpf
c9966a3e17 use 'using' instead of 'sig' keyword; cleans up new features a bit 2016-02-29 12:19:54 +01:00