Commit Graph

5930 Commits

Author SHA1 Message Date
ringabout
1204f4a38e more test cases 2023-03-31 16:38:19 +08:00
ringabout
c1c53bebf1 fixes private fields 2023-03-25 15:47:38 +08:00
ringabout
bde9abb2f7 fixes tests 2023-03-25 09:45:01 +08:00
ringabout
3c36fc17dc Merge remote-tracking branch 'upstream/devel' into pr_object 2023-03-24 23:29:14 +08:00
ringabout
6f8b9b7cc4 better error messages 2023-03-24 23:24:37 +08:00
ringabout
55636a2913 fixes #14255; Crash in compiler when using system.any by accident. (#21562)
fixes #14255; Crash in compiler when using system.any by accident.
2023-03-23 16:10:14 +01:00
ringabout
24857a0162 fixes a test 2023-03-23 23:06:31 +08:00
ringabout
91dee1bcff typo 2023-03-23 21:49:46 +08:00
ringabout
251fec94ce add some tests 2023-03-23 21:47:17 +08:00
ringabout
0175be50a9 fixes existing tests 2023-03-23 21:08:35 +08:00
ringabout
c814c4d993 fixes #3770; templates with untyped parameters resolve private fields wrongly in generics (#21554)
* fixes #3770; templates with untyped parameters resolve private fields wrongly

* add a test case for #3770

* rename to `nfSkipFieldChecking`
2023-03-21 15:22:07 +01:00
Eric N. Vander Weele
da7833c68b fixes #21538; expand len template parameter once in newSeqWith (#21543)
`len` could contain side effects and may result in different values when
substituted twice in the template expansion. Instead, capture the result
of substituting `len` once.

closes: #21538
2023-03-20 18:51:31 +01:00
Mark Leyva
285ea3c48e Fix: #21541. Add support for xnVerbatimText (#21542)
to text and text= procs. Remove unnecessary LF for xnVerbatimText
in $ proc.
2023-03-20 18:50:58 +01:00
Jake Leahy
741fed716e Use analyseIfAddressTaken logic for checking if address is taken in converter (#21533)
* Add a test case

There are way more test cases (See all branches of analyseIfAddressTaken but this covers at least a second branch

* Port analyseIfAddressTaken from semexprs to sigmatch

This was done since we cannot import sem or semexprs (circular import) but we need the rest of the logic. In needs to be done here since the converter isn't semmed afterwards and so we can't just leave the process til later use the version from semexprs

* Less hacky solution which has the checking be done in analyseIfAddressTakenInCall

This was done instead of the recommendation on removing it since sfAddrTaken is used in places other than the backend

* Remove weird whitespace

* Still check nkHiddenAddr if we are checking a converter
2023-03-20 18:48:13 +01:00
Jason Beetham
a9d0124b5d Made generic type classes work with types using static parameters (#21528) 2023-03-17 10:17:08 +01:00
ringabout
fd4e3ae3e4 add a prepass for codeReordering (#21513)
* add a prepass for codeReordering

* simplify

* fixes
2023-03-17 08:02:48 +01:00
ringabout
b5ee81fd23 fix #18977; disallow change branch of an object variant in ORC (#21526)
* fix #18977 disallow change branch of an object variant in ORC

* check errors for goto exception

* fixes conditions

* fixes tests

* add a test case for #18977
2023-03-16 16:06:26 +01:00
ringabout
6552a27ec1 fixes #19857; Exception raised in closure may be "skipped" in ORC (#21530)
fixes #19857; Exception raised in closure may be "skipped"
2023-03-16 21:07:54 +08:00
ringabout
b2c1dcbbc9 fixes explicit globals in macros (#21502) 2023-03-12 20:03:46 +01:00
ringabout
ffadc75afe fixes #21496; Ambiguous calls compiles when module name are equal (#21500)
* fixes #21496; Ambiguous calls compiles when module name are equal

* add a test case
2023-03-12 20:03:14 +01:00
ringabout
f2dad94902 fixes #21306; fixes #20485; don't transform yields in the var section when introducing new local vars [backport: 1.6] (#21489)
* fixes #21306;  don't transform yields in the var section when introducing new local vars

* adds `inVarSection` so the var section in the var section is freshed

* use `isIntroducingNewLocalVars` to avoid yield transformations in var sections

* fixes comments
2023-03-10 14:19:31 +01:00
ringabout
0319824322 fixes #21023; Segfault when mixing seqs, orc, variants and futures (#21497)
* fixes #21023; Segfault when mixing seqs, orc, variants and futures

* fixes none of the branches were explicitly selected

* add one more test

* one more test
2023-03-10 09:28:51 +01:00
ringabout
72e262666b fixes quoted variables with typedesc types (#21493) 2023-03-09 08:09:08 +01:00
ringabout
2f89f1eb78 closes #8295; add a test case (#21486) 2023-03-07 20:17:05 +08:00
ringabout
6ef9430153 closes #6231; add a test case (#21485) 2023-03-07 17:34:02 +08:00
ringabout
64a0355f3f fixes #21377; fixes @[] and {} type inference as returns in generics (#21475)
* fixes `@[]` type inference in generics

* add issue links

* fixes macros and iterators

* refactor

* add one more test
2023-03-06 15:30:22 +01:00
ringabout
2d9af2bd55 closes #20704; add a test case (#21480) 2023-03-06 17:34:41 +08:00
ringabout
4d76725299 closes #16654; add a test case (#21478) 2023-03-06 14:12:47 +08:00
Arnaud Moura
b2c5f8a05f fixes #21461 (#21463)
* fixes #21461; Move nim-gdb.py and add nim-lldb.py

* fixes bad path for nim-gdb.py
2023-03-03 23:37:12 +01:00
Jake Leahy
d4d28f2ffe Allow futureLogging in release builds (#21448)
* Add test case

* Fixes 21447: Keeps stackTrace around when using futureLogging

* Remove extra whitespace
2023-03-02 14:27:10 -05:00
ringabout
38d299dfc0 fixes #20139; hash types based on its path relative to its package path (#21274) [backport:1.6]
* fixes #20139; hash types based on its path relative its project

* add a test case

* fixes procs

* better implementation and test case

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2023-03-02 09:16:28 +01:00
Andreas Rumpf
50baf21eac fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep th… (#21459)
fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep the abstraction of mutable strings which have immutable string literals
2023-03-02 08:36:02 +01:00
ringabout
a137e50150 fixes #19291; implements wasMoved hook (#21303)
* fixes #19291; implements `wasMoved` hook

* basics

* checkpoint

* finish `wasMoved`

* add a test for #19291

* add documentation and changelog

* work `attachedWasMoved` with generics

* fixes optimizer

* register `=wasMoved`

* handle wasMoved magcis

* check another round

* some patches

* try `op == nil`

* nicer

* generate `wasMoved` before `destroy`

* try again

* fixes tests

* default wasMoved

* Update tests/destructor/tv2_cast.nim

* Update tests/destructor/tv2_cast.nim

* Update tests/arc/topt_refcursors.nim
2023-03-02 05:29:40 +01:00
ringabout
9948fed919 fixes #21326; fixes #7375; fixes #11986; fixes #9607; rework quote do; getAst uses type info to annotate the type of quoted variables; no more type erasures for quoted variables (#21433)
* fixes #21326; getAst uses type info to annotateType quoted variables

* simplify logics; sem types first

* fixes important packages

* add testcases

* tiny
2023-03-02 05:25:55 +01:00
Anna
070938720a tests/errmsgs/tcall_with_default_arg.nim: sync (#21237) 2023-03-01 21:29:23 +01:00
Anna
cf083af262 tests: explicitly enable stack traces where needed (#21236)
* tests/assert/tassert_c.nim: explicitly enable stack traces

* tests/errmsgs: explicitly enable stack traces
2023-03-01 18:01:58 +01:00
Anna
89d8c0b246 tests/stylecheck: make sure necessary hints are enabled (#21240) 2023-03-01 18:00:58 +01:00
ringabout
1b1412f3d1 fixes #10938; fixes #13312; fixes #13918; fixes #20985; always initializes global variables with null values in VM (#21351)
* fixes #10938; always initialize global variable in VM

* fixes importc vars

* there is a pre-existing issue regarding closure types in the VM

* add tests
2023-03-01 17:18:09 +01:00
Constantine Molchanov
4ae598762e fixes #21439; Add tyOpenArray to genTypeInfo. (#21440)
* fixes #21439; Add tyOpenArray to genTypeInfo.

* Add test.
2023-02-27 00:56:43 +01:00
ringabout
d4782c9e42 closes #17864; add a test case (#21434) 2023-02-25 00:53:04 +08:00
ringabout
bbb6d2c69d fixes #20695; fixes object with distinct defaults and tables (#21428) 2023-02-24 09:02:44 +01:00
Andreas Rumpf
8a19ac2070 fixes #21393 and misc style changes (#21419)
* fixes #21393 and misc style changes

* progress

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2023-02-24 09:02:15 +01: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
Jake Leahy
0a45543cc1 Specify that address is taken when converter takes a var parameter (#21391)
* Add test case

* closes #21247 Add the sfAddrTaken flag to var parameters in converters

This allows the JS backend to properly pass the parameter as a fat pointer
2023-02-21 12:27:12 +01:00
Jake Leahy
6d423f1856 Make Time work with std/strformat (#21409)
* Add test case

* Remove formatValue template for `Time`

It didn't handle empty specifier correctly which caused it to be blank with strformat
2023-02-21 12:04:27 +01:00
Jake Leahy
e54d3cc418 Support tuples in nim-gdb (#21410)
* Support for printing tuple types

* Add test of printing a tuple

* Add support for printing tuples in GDB

* Forgot to [skip ci]
2023-02-21 12:02:42 +01:00
Jake Leahy
c66dc913ce Support new runtime with nim-gdb (#21400)
* Add support for orc strings

* Cleaned up testing script

Enums now printing properly

Merged both old and new strings into the one printer

Moving onto sets which seem kinda difficult

* Sets working

Instead of trying to imitate how Nim represents enums, I just call the dollar proc for each enum value

While this runs into problems if the user doesn't call the dollar proc anywhere, I believe its a decent tradeoff

I've cleaned up the error message for when it cannot find dollar proc (Might add in proper message on how to fix)

* Support sequences

V2 runtime seems to have sequences that don't have a len (Guessing its some kind of short seq optimisation?) but I've rolled
the implementation into normal sequences since the implementation is practically the same

* Clean up test program so it isn't using diff

Also don't redirect the first nim compile to /dev/null so that we can check for any compilation errors

I found the diff to be annoying to read (Seeing as the test script already performs diffing)

* Tables are now supported

* Add colours to test output

It was getting difficult to tell apart test output from GDB output so I added colour to better tell them apart

* Both old and new runtime are working

Set exit code in python test script so that this could possibly be added to the CI. Only issue is that it can be flaky (GDB crashes randomly for some reason)

* Remove old code that was commented out

If I need it later I'll just use git

* Remove branch that never runs

* Remove the old test output [skip ci]
2023-02-20 21:19:46 +01:00
ringabout
e896977bd1 closes #1072; add a test case (#21396) 2023-02-19 14:49:19 +08:00
ringabout
fc7385bfda fixes #21360; discarding empty seqs/arrays now raises errors (#21374)
* discarding empty seqs now raises errors

* the same goes for sets
2023-02-16 10:23:35 +08:00
c-blake
c91ef1a09f Fix closeHandle bug, add setFileSize, make resize work on Windows (#21375)
* Add general purpose `setFileSize` (unexported for now).  Use to simplify
`memfiles.open` as well as make robust (via hard allocation, not merely
`ftruncate` address space allocation) on systems with `posix_fallocate`.

As part of this, fix a bad `closeHandle` return check bug on Windows and
add `MemFile.resize` for Windows now that setFileSize makes that easier.

* Adapt existing test to exercise newly portable `MemFile.resize`.

* Since Apple has never provided `posix_fallocate`, provide a fallback.
This is presently written in terms of `ftruncate`, but it can be
improved to use `F_PREALLOCATE` instead, as mentioned in a comment.
2023-02-15 17:41:28 +01:00