Commit Graph

2937 Commits

Author SHA1 Message Date
LemonBoy
52fc16d5d2 Return an error symbol as macro output if needed (#8116)
Return an error symbol if the macro output has no type and a typedesc
is expected.

Fixes #7454
2018-06-27 21:43:07 +02:00
LemonBoy
7f148838a4 Reject ptr/ref void types (#8127)
Do this during the semantic pass to avoid tripping the following passes.

Fixes #6454
2018-06-27 21:41:40 +02:00
LemonBoy
722abbe9c9 Reject enums with holes when computedGoto is used (#8132)
Fixes #7699
2018-06-27 21:36:52 +02:00
LemonBoy
bb23d903b6 Don't consider concept types as non-complex during codegen (#8119)
Fixes #7125
2018-06-27 17:21:53 +02:00
Hiroki Noda
a85493610c Lexer: do not accept some invalid integer literals (#8089)
* Lexer: do not accept some invalid integer literals

* Use Natural instead of uint, and result variable
2018-06-27 17:07:26 +02:00
Andreas Rumpf
d8f7174dda Merge pull request #7736 from cooldome/range_float_type
Language feature: range float types
2018-06-27 00:08:21 +02:00
Andreas Rumpf
7cec5d1cfb Merge pull request #7681 from nim-lang/typedesc-reforms
Typedesc reforms
2018-06-26 23:53:30 +02:00
Andreas Rumpf
ccb1514837 Merge pull request #8108 from LemonBoy/fix-5958
Make `static` blocks introduce their own scope
2018-06-26 23:16:40 +02:00
Oscar Nihlgård
236bc06b5f Improve vm support for ref types 2018-06-26 21:25:27 +02:00
Andreas Rumpf
2a3a128e36 Merge branch 'devel' into typedesc-reforms 2018-06-26 18:33:51 +02:00
LemonBoy
f559e62e45 Adjust some tests to make them pass
The non-scoped behaviour of static blocks was exploited by those tests,
replace all the variables declared whithin one with compileTime marked
ones.
2018-06-25 15:56:13 +02:00
LemonBoy
9543689306 Make static blocks introduce their own scope
Treat the static block as a normal block, don't leak any identifier in
the outer scope.

Fixes #5958
2018-06-24 18:27:40 +02:00
LemonBoy
bfa3d62cc1 More concept fixes
Fixes #7705, #7703, #7702
2018-06-24 15:13:34 +02:00
Andreas Rumpf
105a472dc5 Merge pull request #8084 from LemonBoy/fix-7905
Discriminate gensym'd type names in sigHash
2018-06-24 09:54:00 +02:00
LemonBoy
e39baf46fc Don't blow up with recursive objects 2018-06-22 19:47:44 +02:00
LemonBoy
af66258dca Discriminate gensym'd type names in sigHash
The root cause of #7905 lies in the codegen phase. The two template
instantiations generate two different MyType types with different
members but same t.sym.name leading the caching mechanism to confuse
the two.

Fixes #7905
2018-06-22 13:09:33 +02:00
Andreas Rumpf
6015749720 Merge pull request #8062 from LemonBoy/fix-7825
Fix constant folding for shl/not
2018-06-21 00:35:17 +02:00
LemonBoy
fb62dd1fae Fix constant folding for shl/not
Since the source and destination types are the same the result should be
trimmed to fit.
2018-06-19 22:32:15 +02:00
gemath
db68bbe4f7 Pegs AST read access (#8050)
* Make PEG AST nodes readable from outside the module.

* Added a test module for the pegs stdlib module.

* Edited changelog.

* Renamed ``sons`` iterator to ``items``, added ``pairs``, inlined both.

* Updated entry and moved it to the right category.
2018-06-19 18:13:33 +01:00
Andreas Rumpf
3ca11def6d Merge pull request #7771 from nim-lang/nim-in-action-fixes
Higher Nim in Action coverage plus regression fix.
2018-06-19 17:52:05 +02:00
Dominik Picheta
03b073d541 Workaround VM bug in strutils 2018-06-17 23:26:18 +01:00
Andreas Rumpf
dbcdc4331a testament: minor code formating change 2018-06-17 14:16:01 +02:00
Dominik Picheta
9e86237855 Adds smaller code samples from Chapters 1-3 to the tester. 2018-06-17 00:12:51 +01:00
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
e719f211c6 fix #6928; fix #7208 2018-06-16 16:46:32 +03:00
Zahary Karadjov
16b594b532 Support default type parameters
progress on #7516
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
a49b06a52a Implement the is operator for the new static and typedesc type classes
This also makes the first baby steps towards a sound treatment of
higher-order kinds (type type int).

Adds test cases showcasing the new features.

* Also fixes breakage after the rebase
2018-06-16 16:46:32 +03:00
Zahary Karadjov
ab9969ed3b Bugfix: the size of an array may be a static tuple element 2018-06-16 16:46:32 +03:00
Zahary Karadjov
509d6e9232 Bugfix: aliases to generic types were not considered implicit generic parameters 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
Zahary Karadjov
8633b1b309 Starting test recording the current state of the parser
In the next commit, I'll introduce changes to the parser bringing
consistent handling of all type modifiers (ref, ptr, var, static
and type). The goal of this commit is to record precisely what is
going to be changed (i.e. by allowing you to look at the diff).

To preserve the diff, please don't squash upon merging.
2018-06-16 16:46:32 +03:00
Andreas Rumpf
ee16e62061 Merge pull request #8039 from yglukhov/proc-pragmas
Fixed stacktrace/linetrace proc pragmas when appended by macro pragma
2018-06-16 01:59:06 +02:00
Yuriy Glukhov
78cbf6734a Added more tests to toverflw 2018-06-15 19:46:17 +03:00
Dmitry Atamanov
bf5d619a52 Add MemMapFileStream. Fixes in memFiles. (#7944)
* Add MemMapFileStream

* Added tests

* Fixed bug in memfiles (zero index for string)

* Added flush to changelog

* Attempt to fix Win's nuances

* Fix attempt to fix

* Continue...

* And again...

* Reworked tests (all for win on Win)

* Fixes in flush (Win)

* Replace fn vars to consts

* Added the attempts parameter to the flush

* Replace while to for

* Move to memfiles

* Use Natural instead of uint

* Better error messages for append mode. Handle specific cases.
2018-06-14 17:34:26 +01:00
Vindaar
e80be6173d Add parse bin int, fixes #8018 (#8020)
* clarify `parseHexInt`, `parseOctInt` docstring and exception msgs

* add `parseBinInt` based on `parseutil.parseBin` implementation

Adds a `parseBinInt`, which parses a binary integer string and returns
it as an integer. This is based on the implementation of
`parseutil.parseBin`, removing the unnecessary parts.

* add tests for all `parse(Hex|Oct|Bin)Int` procs

* replace `parse*Int` proc impls by call to parseutil procs

Replaces the `parse(Hex|Oct|Bin)Int` procedure implementation by calls
to the `parseutil` procs, which receive a mutable argument.

Has the main advantage that the empty string as well as a "prefix
only" string, e.g. "0x" counts as an invalid integer.

Also moves the `parseOctInt` proc further up in the file so that all
`parse` procs are below one another.

* replace `var L` by `let L` in `parse` procs

There's no reason for the usage of `var` here.

* add `maxLen` optional arg for `parseutil.parse(Oct|Bin)`

Plus small change to test cases.

* update changelog about `parse*Int` procs

* fix `rejectParse` template in `tstrutils`

* make sure only `s.len` chars are parsed, if `maxLen+start` > s.len

Fixes a previous bug in `parseHex` (and now affected `parseOct` and
`parseBin`), which allowed to set `start + maxLen` to be larger than
the strings length. This resulted in an out of bounds access.

* move `parse*Int` proc change to breaking changes, add double `
2018-06-13 13:32:12 -04:00
Arne Döring
51fdb071cb fix #5930 2018-06-13 12:18:21 +02:00
cooldome
37aa488f99 merge devel 2018-06-12 21:19:30 +01:00
Andreas Rumpf
b379547fc0 Merge pull request #8019 from yglukhov/proc-stacktrace
Allow stacktrace and linetrace pragmas on procs
2018-06-12 17:12:13 +02:00
Andreas Rumpf
aaceec0744 Merge pull request #7981 from cooldome/Fix_-7980
Fixes 7980
2018-06-12 11:50:40 +02:00
Yuriy Glukhov
7e7b85afc7 Allow stacktrace and linetrace pragmas on procs 2018-06-12 12:31:14 +03:00
Andreas Rumpf
1c58f31a71 Merge pull request #8014 from yglukhov/fix-6803
Fixes #6803
2018-06-11 23:39:27 +02:00
LemonBoy
ac0f986008 Correct field lookup in concept types
Fixes #6770
2018-06-12 00:36:43 +03:00
Yuriy Glukhov
8f06763491 Fixes #6803 2018-06-11 22:38:40 +03:00
Araq
1074cc1fb9 fixes yet another merge conflict 2018-06-11 17:17:34 +02:00
Araq
68ba13c759 fixes merge conflict 2018-06-11 17:05:23 +02:00
Andreas Rumpf
76676cb79f Merge pull request #8009 from yglukhov/remove-oldIterTransf
Removed oldIterTranf feature
2018-06-11 16:45:35 +02:00
Andreas Rumpf
df1784dabf Merge pull request #8005 from Vindaar/fixes-7997
fix #7997
2018-06-11 01:33:14 +02:00
Andreas Rumpf
61d9292095 fixes merge conflict 2018-06-11 01:25:48 +02:00
Andreas Rumpf
61e1897922 make tests green again 2018-06-11 01:23:14 +02:00