Commit Graph

95 Commits

Author SHA1 Message Date
metagn
81756d1810 second test case haul for templates and generics (#22728)
closes #8390, closes #11726, closes #8446, closes #21221, closes #7461,
closes #7995
2023-09-19 15:26:26 +08:00
metagn
ba158d73dc type annotations for variable tuple unpacking, better error messages (#22611)
* type annotations for variable tuple unpacking, better error messages

closes #17989, closes https://github.com/nim-lang/RFCs/issues/339

* update grammar

* fix test
2023-09-01 06:26:53 +02:00
metagn
b97d603cd0 some test cleanups & category reorganization (#22010)
* clean up some test categories

* mention exact slice issue

* magics into system

* move trangechecks into overflow

* move tmemory to system

* try fix CI

* try fix CI

* final CI fix
2023-06-06 06:54:07 +02:00
metagn
2ab948ce53 post expr blocks colon fix + correct grammar (#21983)
* post expr blocks colon fix + correct grammar

fixes #21982

* fix dochelpers

* this is remarkably common

* use head for unchained

* fix atlas

* final grammar fix
2023-06-06 06:53:21 +02:00
metagn
814d3e6818 fix #19430 (#21603) 2023-04-06 13:36:21 +02:00
metagn
2315b01ae6 tuple unpacking for vars as just sugar, allowing nesting (#21563)
* tuple unpacking for vars as just sugar, allowing nesting

* set temp symbol AST

* hopeful fix some issues, add test for #19364

* always use temp for consts

* document, fix small issue

* fix manual indentation

* actually fix manual

* use helper proc

* don't resem temp tuple assignment
2023-03-28 17:52:23 +02:00
ringabout
38f876dd48 fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now parses the whole module at one time (#21379)
* fixes #19795; remove parse pipeline

* isScript

* fixes nimscriptapi

* don't touch reorder

* check script

* fixes tests

* it seems implicit imports of system cause troubles

* access the first child of `nkStmtList`

* ignore comments

* minor messages

* perhaps increases hloLoopDetector

* the module is a stmtList, which changes the errors

* fixes nimdoc

* fixes tlinter

* fixes nim  secret tests

* fixes arc_misc

* fixes nim secret tests again

* safe; fixes one more test

* GlobalError is the root cause too

* fixes parsing errors

* put emit types to the cfsForwardTypes section

* fixes #11852; `{.push checks:off}` now works in procs

* disable navigator

* fixes nimdoc

* add tests for JS

* fixes nimsuggest
2023-02-22 20:34:20 +01:00
ringabout
406d302131 allow omitting stmts using finally as post expr blocks; make it consistent with else, except etc. (#21361)
allow omitting stmts using `finally` as post expr blocks
2023-02-14 07:29:30 +01:00
ringabout
d0721eadf8 fixes #21144; try expression will not match the less indentation except (#21152)
fixes #21144; try expression will not match the less indent except
2022-12-21 21:46:14 +01:00
Vindaar
0a1d4ba842 fix issue #20922 by handling missing expr in exprList for tkOf (#20930)
* fix issue #20922 by handling missing expr in `exprList` for `tkOf`

* fix line numbers in test case

* rewrite exprList requiring expr, add optionalExprList for except

As suggested by @metagn.

* update test case to reflect new code

* update grammar.txt

* update line numbers in test case taking into account nimout

Given the number of errors that are produced it seems easier to do it
this way instead of using `tt.Error`.
2022-12-08 10:59:13 +01:00
metagn
4ca2dcb404 Named arguments in commands + many grammar fixes (#20994)
* Breaking parser changes, implement https://github.com/nim-lang/RFCs/issues/442

Types are separated from expressions and better reflected in the grammar.

* add test

* more accurate grammar

* fix keyword typedescs

* accept expressions in proc argument lists

* CI "fixes"

* fixes

* allow full ref expressions again, adapt old tests

* cleanup, fix some tests

* improve grammar, try and revert semtypes change

* restrict sigil binding to identOrLiteral

* fix, should have caught this immediately

* add changelog entry, fix double not nil bug

* correct grammar

* change section

* fix

* real fix hopefully

* fix test

* support LL(1) for tuples

* make grammar.txt too
2022-12-06 13:11:56 +01:00
metagn
15d00ca0e1 allow proc expressions in place of statements (#20935)
properly fixes #18714
2022-11-29 06:37:00 +01:00
ringabout
7739e23420 defaults to ORC (#19972)
* defaults to Orc

* bootstrap using refc

* use gc

* init orc defines

* unregister orc

* fix gc

* fix commands

* add prepareMutation for orc

* enable deepcopy for orc

* prepareMutation

* more fixes

* some cases

* bug #20081

* partial fixes

* partial fixes

* fixes command line

* more fixes

* build Nim with refc

* use gc

* more fixes

* rstore

* orc doesn't support threadpool

* more shallowCopy

* more fixes

* fixes unsafeNew

* workarounds

* small

* more fixes

* fixes some megatest

* tcodegenbugs1 refc

* fxies megatest

* build nimble with refc

* workaround tensordsl tests

* replace shallowCopy with move

* fixes action

* workaround

* add todo

* fixes important packages

* unpublic unregisterArcOrc

* fixes cpp

* enable windows

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-09-23 13:05:05 +02:00
metagn
801eb3cb56 use arrow precedence in spec (#20166)
* test using arrow precedence in spec

refs #8759

* add test for #8759
2022-09-06 21:24:32 +02:00
metagn
d1d141b135 new .redefine pragma for templates, warn on redefinition without it (#20211)
* test CI for template redefinitions

* adapt asyncmacro

* fix quote

* fix again

* try something else

* revert

* fix ioselectors_select, disable packages CI

* adapt more tests & simplify

* more

* more

* more

* rename to redefine, warn on implicit redefinition

* basic documentation [skip ci]

* Update compiler/lineinfos.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-08-23 21:41:30 +02:00
flywind
42ac50e988 fixes #19662; Indent level errored for first line (#19718) 2022-04-25 12:00:23 +02:00
hlaaftana
61d682e733 Allow full commands and blocks in type sections (#19181)
* allow full commands and blocks in type sections
* update grammar
* fix changelog [skip ci]
* more tests
* even more tests
2022-01-02 07:29:55 +01:00
hlaaftana
1ef945668d treat do with pragmas but no parens as proc (#19191)
fixes #19188
2021-12-05 06:44:22 +01:00
hlaaftana
2859069dbe fix #12274 (#19180) 2021-11-24 07:08:07 +01:00
Andreas Rumpf
c56ba3f06a fixes #18847 [backport] (#18870) 2021-09-20 09:09:53 +02:00
Clyybber
72d6a9c885 Fix #16426 (#18377) 2021-06-28 17:41:37 +02:00
Clyybber
76f93877cd Small parser loop fix (#17904)
* Fix loop on error with nim check in semiStmtList
* Add test
2021-04-30 17:17:29 +02:00
Timothee Cour
08262206d3 refs #15667 improve invalid indentation errors, report when & where = could be missing (#16397)
* refs #15667 improve invalid indentation errors

* also show line info where = is missing

* add test

* add more tests
2021-04-10 08:55:39 +02:00
Arne Döring
159c06e045 unify tuple expressions (#13793)
* unify tuple expressions

* fix test

* fix test

* apply feedback

* Handle empty tuples

* Fix rendering named unary tuple

* Protect static NimNode against stripping

* Slightly less hacky

* Revert "Slightly less hacky"

This reverts commit 170c5aec0addc029f637afbc948700ca006b7942.

* Slightly less hacky

* Cleanup

* Fix test

* Fix another test

* Add condsym

* Rebase fallout

* changelog: Move from compiler changes to language changes

* Add stricter tests

* Add empty tuple example to doc/astspec

* Fix test

Co-authored-by: Clyybber <darkmine956@gmail.com>
2021-03-30 02:06:51 +02:00
hlaaftana
def1f99289 add finally as post expr block [backport:1.4] (#16896) 2021-02-01 20:14:20 +01:00
flywind
6d442a40a6 use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
Clyybber
60ad95f799 Add testcase for invalid if statement (#15313) 2020-09-12 14:28:19 +02:00
Clyybber
1881fc5812 Fix #15305 (#15311)
* Fix #15305

* Fix test
2020-09-12 12:39:46 +01:00
Clyybber
f3552b86c1 Better semiStmtList parsing (#15123)
* Better semiStmtList parsing
* Add examples from forums and wiki
* Move parseIfExpr near parseIfOrWhen
* Update grammar
2020-09-09 07:36:31 +02:00
hlaaftana
de27910ab7 make from an operator (#14241) 2020-05-08 07:54:46 +02:00
Arne Döring
5b27b263fd Remove immediate pragma (#11308)
* remove immediate from tests
* remove immediate from the compiler
2019-05-29 22:21:51 +02:00
cooldome
7d8af25d58 revert parser stmtListExpr (#11007)
* Revert "Support for stmtListExpr in parser after major keywords. Scaled down version. (#10852)"

This reverts commit 862897dc0f.

* redo fix for #4035

* render stmtlistExpr using semicolon

* Revert "render stmtlistExpr using semicolon"

This reverts commit cafb78b8d5.

* revert test
2019-04-17 11:55:41 +02:00
Andreas Rumpf
8e1c6e2e2d fixes #10896 (#10903) 2019-03-25 19:26:38 +01:00
cooldome
28a926cb67 fixes #10861 (#10877) 2019-03-21 06:48:54 +01:00
cooldome
862897dc0f Support for stmtListExpr in parser after major keywords. Scaled down version. (#10852)
* Support for stmtListExpr in parser after major keywords
* fixes #4035
2019-03-18 11:09:49 +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
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Andreas Rumpf
05683e3aab fixes #9633 2018-11-08 09:15:15 +01:00
Andreas Rumpf
8a357c270b parser change: 'not' is always a unary operator; fixes #9574 2018-11-07 21:17:52 +01:00
Araq
1fa22d4cfe removed the undocumented #? strongSpaces parsing mode 2018-11-06 13:55:03 +01:00
zah
96de224a63 Fix #8126 (#8712)
This is a temporary fix that will be reworked in a follow up commit
that aims to eliminate the tfExplicit flag from the compiler. The
complete and proper fix was considered too risky for inclusion just
before our 0.19 release.
2018-08-21 22:14:12 +02: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
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
Araq
02b78d3f94 make tests green again 2018-05-14 21:38:18 +02:00
Andreas Rumpf
cd0985df06 update the changelog 2018-05-06 08:17:32 +02:00
Andreas Rumpf
805402b294 fixes #7582 2018-05-05 14:17:31 +02:00
Arne Döring
6baca58693 Get symbol kind (#7491) 2018-04-11 16:48:01 +02:00
Oscar Nihlgård
d6793ded27 Fix parser bug with type classes (#7480) 2018-04-06 22:44:54 +02:00
Araq
212fdc5946 added the 'x.p[:T]' notation for explicit generic instantiations in combination with the ddot calling syntax 2018-04-06 22:05:57 +02:00