summary refs log tree commit diff stats
path: root/tests/casestmt
Commit message (Collapse)AuthorAgeFilesLines
* evaluate all hidden conversions in case branches (#24187)metagn2024-09-271-0/+5
| | | | | | | | | | | | | | | fixes #11422, refs #8336/#8333, refs #20130 The compiler generates conversion nodes *after* evaluating the branches of case statements as constants, the reasoning is that case branches accept constants of different types, like arrays or sets. But this means that conversion nodes that need to be evaluated like converter calls don't get evaluated as a constant for codegen. #8336 fixed this by re-evaluating the node if an `nkHiddenCallConv` was created, and in #20130 this logic also had to be added for `nkHiddenStdConv` for cstrings. This logic was only for single case elements, it has now been added to range elements as well to fix #11422. Additionally, all conversion nodes are now evaluated for simplicity, but maybe this won't pass CI.
* fix typed case range not counting for exhaustiveness (#24136)metagn2024-09-181-0/+7
| | | | | | | | | | | | fixes #22661 Range expressions in `of` branches in `case` statements start off as calls to `..` then become `nkRange` when getting typed. For this reason the compiler leaves `nkRange` alone when type checking the case statements again, but it still does the exhaustiveness checking for the entire case statement, and leaving the range alone means it doesn't count the values of the range for exhaustiveness. So the counting is now also done on `nkRange` nodes in the same way as when typechecking it the first time.
* fixes #24031; js codegen bug for case statement with just else branch (#24047)ringabout2024-09-021-0/+7
| | | fixes #24031
* Mark `macros.error` as `.noreturn.` (#23081)Jake Leahy2023-12-171-0/+14
| | | | | | | | | | | | | | | Closes #14329 Marks `macros.error` as `.noreturn` so that it can be used in expressions. This also fixes the issue that occurred in #19659 where a stmt that could be an expression (Due to having `discardable` procs at the end of other branches) would believe a `noreturn` proc is returning the same type e.g. ```nim proc bar(): int {.discardable.} = discard if true: bar() else: quit(0) # Says that quit is of type `int` and needs to be used/discarded except it actually has no return type ```
* fix #18964 Small string case with else statement first in AST evaluat… ↵Bung2022-11-221-0/+12
| | | | | (#20862) fix #18964 Small string case with else statement first in AST evaluates wrongly
* support cstring in `case` (#20130)metagn2022-09-011-0/+52
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* [Testament] Extend and document message testing aids (#19996)quantimnot2022-09-011-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [Testament] Extend and document message testing aids * Enable inline msgs when not reject action. Eliminates the pain of changing the line and column numbers in `nimout` or `output` while making changes to the test. * Enable using inline msgs and nimout together. Allows ease of inline msgs for the test as well as testing msgs from other modules. * Add path separator and test filename variable interpolation in msgs. Eases handling path separators in the msgs. * Add some documentation. * Fixed lots of broken tests * Fixed more broken tests * Support multiple inline messages per a line * Fix a broken test * Revert variable substitution in `output` * Remove uneeded params * Update doc/testament.md Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update testament/specs.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Update testament/specs.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Fix indentation Co-authored-by: quantimnot <quantimnot@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #20031; uint64 is an ordinal type since 1.0 (#20094)ringabout2022-07-271-0/+11
| | | | | * fixes #20031; uint64 is an ordinal type since 1.0 * Update compiler/semstmts.nim
* nnkArglist => nnkArgList + special case stylecheck:error (#17529)Timothee Cour2021-03-271-2/+2
| | | | | * nnkArglist => nnkArgList * special case stylecheck:error
* nimout now consistently uses nimoutCheck (#16189)Timothee Cour2020-12-011-8/+8
|
* testament: error instead of silently overwrite a spec (#16166)Timothee Cour2020-11-291-10/+16
|
* Revert "fixes #15280 [backport:1.2] (#15281)" (#15700)Clyybber2020-10-241-1/+1
| | | This reverts commit 3f00a738dbc8319b4dd2b86bf5529c096f2dd243.
* fixes #15280 [backport:1.2] (#15281)Andreas Rumpf2020-09-091-1/+1
| | | | | | | * fixes #15280 [backport:1.2] * make tests green again * adapt tests
* An optimizer for ARC (#14962)Andreas Rumpf2020-07-151-49/+0
| | | | | | | | | | | | | | | | | | | | * WIP: an optimizer for ARC * do not optimize away destructors in 'finally' if unstructured control flow is involved * optimized the optimizer * minor code cleanup * first steps to .cursor inference * cursor inference: big steps to a working solution * baby steps * better .cursor inference * new feature: expandArc for easy inspection of the AST after ARC transformations * added topt_cursor test * adapt tests * cleanups, make tests green * optimize common traversal patterns * moved test case * fixes .cursor inference so that npeg compiles once again * cursor inference: more bugfixes Co-authored-by: Clyybber <darkmine956@gmail.com>
* scoped memory management (#14790)Andreas Rumpf2020-07-041-3/+5
| | | | | | | * fixes the regressions * closes #13936 * scope based memory management implemented * enabled tcontrolflow.nim test case * final cleanups
* [cleanups] doassert => doAssert; mark deadcode (#14711)Timothee Cour2020-06-171-6/+6
|
* EndsInNoReturn in expressions extension, fixes #13490 (#13520)cooldome2020-02-281-0/+37
| | | | * fix #13490
* case coverage error message for `char` (#12948)Jasper Jenkins2019-12-221-3/+9
|
* Fix #12785 (#12943)RSDuck2019-12-211-0/+47
| | | | | | * Fix #12785 and add test * better variable name
* Better case coverage error message for alias and range enum (#12913)Jasper Jenkins2019-12-181-0/+23
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* closes #11551 (#11693)Arne Döring2019-07-091-0/+13
|
* introduce internal Int128 type, use it to fix case stmt checks (#11652)Arne Döring2019-07-051-0/+11
| | | | | | * initial version of int128 * use int128 in case stmt * fixes #11552
* Print missing case labels (#10600)Arne Döring2019-02-132-1/+116
|
* require errormsg to be specified before file.Arne Döring2018-12-115-11/+13
|
* updated tests to be executedArne Döring2018-11-231-1/+3
|
* fixes #9276 (#9317)Arne Döring2018-10-241-0/+9
|
* Merge tests into a larger file (part 1 of ∞) (#9318)Miran2018-10-128-228/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge actiontable tests * merge arithm tests * merge array tests * merge assign tests * merge bind tests * merge casestmt tests * merge closure tests * merge cnt seq tests * merge collections tests * merge concept issues tests * merge concept tests * fix failing tests * smaller outputs Use `doAssert` where possible. * fix wrong output * split `tcomputedgoto` * revert merging concepts * fix failing test
* fixes more nil handling regressionsAraq2018-08-131-9/+9
|
* Resolve converter call to constants in case arms (#8336)LemonBoy2018-07-161-0/+10
| | | Fixes #8333
* Reject enums with holes when computedGoto is used (#8132)LemonBoy2018-06-271-0/+15
| | | Fixes #7699
* Fixes #7407 (#7427)cooldome2018-04-061-5/+14
|
* Improve semchecking for duplicate cases in case statements (#7176)Oscar Nihlgård2018-02-241-0/+50
| | | | | | | | * Improve semchecking for duplicate cases in case statements * Revert to previous solution * Improve test
* make more tests greenAraq2018-02-101-1/+1
|
* Implement language feature #6885 (#6954)cooldome2017-12-241-0/+59
|
* the parser finally parses 'echo {1,2}' as it shouldAndreas Rumpf2017-09-301-1/+1
|
* use 'using' instead of 'sig' keyword; cleans up new features a bitAndreas Rumpf2016-02-291-1/+1
|
* tests: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-044-8/+8
| | | | via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
* made test greenAraq2015-03-251-2/+3
|
* Allow empty sets in case/of branches.Hans Raaf2015-02-241-0/+24
| | | | | | | Added support for conditional compilation using 'when' with empty sets and arrays in 'case of' branches. Please enter the commit message for your changes. Lines starting
* make tests greenAraq2014-08-311-1/+1
|
* fixes #1103; fixes #1297Araq2014-07-081-0/+19
|
* Changed tests and tools to use 'discard' statements instead of 'nil' for ↵Clay Sweetser2014-02-151-2/+2
| | | | empty blocks.
* new tester; all tests categorizedAraq2014-01-137-0/+189