Commit Graph

1597 Commits

Author SHA1 Message Date
Andreas Rumpf
575450dfec fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6]

(cherry picked from commit fce89cb60a)
2021-11-11 16:15:51 +01:00
Dominik Picheta
2aa97a228a Removes deprecated {.injectStmt.}. Fixes #18666 (#18984) 2021-10-13 11:09:45 +02:00
flywind
6c2f041368 fix code-block which causes missing docs 2021-09-11 09:25:48 +08:00
Sven Keller
3c2edd142b fix for js strict mode (#18799)
* Assignments, which would accidentally create global
variables, instead throw an error in strict mode

* Assignment to a getter-only property

Co-authored-by: Sven Keller <s.keller@cortona.de>
2021-09-04 12:53:02 +02:00
Andreas Rumpf
f46569bafd fixes #18494 (#18783) 2021-09-02 17:16:03 +02:00
Andreas Rumpf
e0ef859130 strict effects (#18777)
* fixes #17369
* megatest is green for --cpu:arm64
* docgen output includes more tags/raises
* implemented 'effectsOf' 
* algorithm.nim: uses new effectsOf annotation
* closes #18376
* closes #17475
* closes #13905
* allow effectsOf: [a, b]
* added a test case
* parameters that are not ours cannot be declared as .effectsOf
* documentation
* manual: added the 'sort' example
* bootstrap with the new better options
2021-09-02 12:10:14 +02:00
Timothee Cour
394f4ac7bb improvements to addInt and $ for integer types (#18592)
* improvements to $(SomeInteger) and addInt
* remove mIntToStr, mInt64ToStr
* improvements
* fix tests/pragmas/tinjectstmt.nim; the diff is harmless, cgen code is identical with -d:danger or debug mode
* rm tests/system/tstrmantle.nim
* revert compiler/jsgen.nim for -d:nimVersion140
2021-08-19 11:33:52 +02:00
flywind
901c5ded52 fix #18702(fix parseutils.parseFloat) (#18703) [backport:1.0]
* fix #18702
* Apply suggestions from code review
2021-08-16 15:14:35 +02:00
Timothee Cour
b24812df5f properly fix #10053 ; FieldDefect msg now shows discriminant value + lineinfo, in all backends (c,vm,js) (#11955)
* fix #10053 FieldError for vm

* fixup

* FieldError now also shows runtime value of discriminant

* fix field error reporting in vm

* also report culprit line info in err msg

* fix errors for newruntime 2

* fix for js

* fixup

* PRTEMP4

* works

* works

* works perfect

* refactor

* std/private/repr_impl

* suppport --gc:arc

* cleanup

* refactor

* simplify

* simplify

* simplify

* fixup

* move out compiler.vmgen.genCustom

* fixup

* fixup

* add tests

* revert compiler/debugutils.nim

* simplify reprDiscriminant

* fixup

* lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim

* try to fix D20210812T165220

* honor --declaredlocs

* control toFileLineCol via --declaredlocs
2021-08-13 09:35:48 +02:00
RSDuck
d0dd923acf Switch maintanance (#18668)
* Fix and improve Nintendo Switch support

* Document the necessity for nimAllocPagesViaMalloc

* update changelog

* Use --gc:orc in examples
2021-08-11 08:54:49 +02:00
Timothee Cour
8ce782d463 Add optional recursive arg to distinctBase (v2) (#18659)
* Add optional recursive arg to distinctBase
* Add docs and examples

Co-authored-by: ALANVF <alan.invents@gmail.com>
2021-08-09 08:51:39 +02:00
Timothee Cour
988c02b7cb renamed: lib/std/private/vmutils.nim -> lib/std/private/bitops_utils.nim to avoid confusion with unrelated std/vmutils (#18660) 2021-08-08 19:24:45 -07:00
flywind
a7e622267e use lent (#18638) 2021-08-08 20:44:14 +02:00
flywind
916d0c21af fix #18620 (#18624)
* fix #18620

* add testcase
2021-08-01 11:19:43 +02:00
Miran
e616675c41 various small documentation improvements (#18602) 2021-07-28 14:31:13 +02:00
Andreas Rumpf
6dc34757b6 fixes #18579 (#18600) 2021-07-27 14:32:56 +02:00
Timothee Cour
cc0f02d57d rename nimFpRoundtrips => nimPreviewFloatRoundtrip (#18566) 2021-07-23 14:57:47 -07:00
Andreas Rumpf
01fc9e58ca fixes #18550 (#18553)
* fixes #18550

* update the manual to reflect reality
2021-07-21 16:55:50 +02:00
Timothee Cour
cf0cf32d27 make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)
* compiler/vmhooks: add getVar to allow vmops with var params
* addFloat vmops with var param
* cgen now renders float32 literals in c backend using roundtrip float to string
2021-07-20 22:13:52 +02:00
Araq
e38388eb4e use .} instead of } for code highlighters 2021-07-20 08:36:02 +02:00
Andreas Rumpf
25efb53862 make dragonbox opt-in via -d:nimFpRoundtrips (#18504)
* make dragonbox opt-in via -d:nimFpRoundtrips

* make tests green again

* make tests green again
2021-07-16 18:29:49 +02:00
Andreas Rumpf
af3d2d8ad9 added nimAllocPagesViaMalloc switch (#18490)
* added  switch

* alloc.nim needs page aligned memory blocks
2021-07-15 17:58:47 +02:00
Miran
0d74f60742 Revert "Make 'echo' raise IOErrors when appropriate (#16367)" (#18460)
This reverts commit 23d23ecb08.
2021-07-08 16:09:56 +02:00
Andreas Rumpf
3eb3e6b9a3 ORC: use =destroy instead of =dispose (#18440)
* ORC refactoring in preparation for further changes (=dispose must die)
* ORC: embrace =destroy, avoid =dispose
* ORC: no need for =dispose
* closes #18421
2021-07-07 09:39:01 +02:00
Andreas Rumpf
1bed777314 fixes #18411 (#18432) [backport:1.4] 2021-07-05 18:04:07 +02:00
Timothee Cour
779b4e307b don't use {.rtl.} for generics, otherwise -d:useNimRtl gives ambiguous identifier nimrtl error (#18406) 2021-07-01 11:14:01 +02:00
Andreas Rumpf
19263f2775 fixes #18400 (#18402) 2021-06-30 12:36:24 +02:00
Clyybber
808db3b284 Fix unused warning for $ on empty object (#18381) 2021-06-28 22:01:06 +02:00
Clyybber
6e74fecb42 Simplify addInt, remove digits10 (#18356)
* Simplify addInt, remove digits10

Co-authored-by: Charles Blake <charlechaud@gmail.com>

* Fix bootstrapping

* Add noInit to tmp array

* noInit -> noinit

Co-authored-by: Charles Blake <charlechaud@gmail.com>
2021-06-28 15:00:14 +02:00
Timothee Cour
b8f761b7e2 even lighter version of #17938: fix most issues with UnusedImport, XDeclaredButNotUsed, etc; fix #17511, #17510, #14246 (without realModule) (#18362)
* {.used: symbol}

* add tests

* fix tests with --import

* --import works without giving spurious unused warnings

* new warning warnDuplicateModuleImport for `import foo; import foo`

* fix test, add resolveModuleAlias, use proper line info for module aliases

* fix spurious warnings

* fix deprecation msg for deprecated modules even with `import foo as bar`

* disable a test for i386 pending sorting XDeclaredButNotUsed errors

* UnusedImport now works with re-exported symbols

* fix typo [skip ci]

* ic support

* add genPNode to allow writing PNode-based compiler code similarly to `genAst`

* fix DuplicateModuleImport warning

* adjust test

* fixup

* fixup

* fixup

* fix after rebase

* fix for IC

* keep the proc inline, move the const out

* [skip ci] fix changelog

* experiment: remove calls to resolveModuleAlias

* followup

* fixup

* fix tests/modules/tselfimport.nim

* workaround tests/deprecated/tmodule1.nim

* fix properly

* simplify
2021-06-26 15:21:46 +02:00
Timothee Cour
5badeea170 followup #18318: simplify dollarImpl and add a test (#18330) 2021-06-22 21:42:39 -07:00
flywind
9a81e91fa5 merge similar procs regarding digits (#18318) 2021-06-22 17:02:32 +02:00
xioren
9d3a813fb9 convert code-blocks to runnableExamples in io (#18315)
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-06-21 18:56:16 -07:00
Timothee Cour
6030e139b5 move {.injectStmt.} to experimental; add a test (#18300)
* move {.injectStmt.} to experimental; add a test

* undocument and deprecat `.injectStmt` but keep its implementation until we have a replacement
2021-06-20 09:51:07 +02:00
Andreas Rumpf
fd8b79707c Revert "system/excpt: check if the exception is not nil before pop (#18247)" (#18265)
This reverts commit 0adb47aa15.
2021-06-17 08:20:10 +02:00
alaviss
0adb47aa15 system/excpt: check if the exception is not nil before pop (#18247)
In CPS we would consume an exception in the except branch by stashing it
into a local then remove the exception from Nim environment so as not to
leak it to other code that would be running before the continuation
continues

However since popCurrentException() assumes that the exception always
exist, removing the exception from an except branch will cause a
SIGSEGV to happen. This commit fixes that.
2021-06-14 18:26:12 +02:00
Timothee Cour
c871e22da2 fix #7717 roundtrip float to string; fix parseFloat for js (#18248)
* refs #7717 roundtrip float to string
* make parseFloat more correct
* improve float tests
* improve float tests
* cleanup
2021-06-13 07:32:47 +02:00
Miran
57609902c4 use more meaningful name than "workaround14447" (#18237) 2021-06-11 10:07:23 +02:00
slangmgh
e7aa41ff3f fix 18186 with adding importc _umul128 (#18200) 2021-06-07 11:42:32 +02:00
Andreas Rumpf
daaa40973c added float32 schubfach algorithm; wip (#18155)
* added float32 schubfach algorithm; wip

* fixes #18418
2021-06-03 12:09:40 +02:00
Timothee Cour
0de3d4292f fix #16993, #18054, #17835 runnableExamples now works with templates and nested templates (#18082) 2021-06-02 09:02:14 -07:00
Andreas Rumpf
63db2b19bf use dragonbox algorithm; alternative to #18008 (#18139)
* use dragonbox algorithm; alternative to #18008
* removed unsafe code
2021-06-01 22:29:53 +02:00
flywind
c2e3dc0ed1 close #18129 Add setCurrentException for JS backend (#18145)
* [std/re] make interface consistent

* tiny

* revert

* close #18129  add setCurrentException

* changelog entry
2021-06-01 18:16:25 +02:00
Ștefan Talpalaru
a1c82c39af asyncdispatch+stackTraceOverride: fix premature collection (#18039) [backport:1.2]
Copying StackTraceEntry instances when nimStackTraceOverride is defined
breaks the link between a cstring field that's supposed to point at
another string field in the same object.

Sometimes, the original object is garbage collected, that memory region
reused for storing other strings, so when the StackTraceEntry copy tries
to use its cstring pointer to construct a traceback message, it accesses
unrelated strings.

This only happens for async tracebacks and this patch prevents that by
making sure we only use the string fields when nimStackTraceOverride is
defined.

Async tracebacks also beautified slightly by getting rid of an extra line
that was supposed to be commented out, along with the corresponding debugging output.

There's also a micro-optimisation to avoid concatenating two strings just
to get their combined length.
2021-05-19 19:19:11 +02:00
Andreas Rumpf
53935b8b27 ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] (#18040)
* ARC: fixes memory leaks with newSeq used in a loop [backport:1.4]
* Update tests/arc/tnewseq_legacy.nim
2021-05-18 21:45:37 +02:00
Andreas Rumpf
4857c462d5 Revert "fix #14873 properly by skipping abi field in importc type (#17944)" (#17992)
This reverts commit 98c29c01eb.
2021-05-15 06:50:39 +02:00
Andreas Rumpf
3bc625aff1 ORC: progress (#18000)
* ORC: progress

* ORC: bugfix; don't follow acyclic data even if only at runtime the subtype is marked as acyclic

* progress

* minor style changes
2021-05-12 22:00:37 +02:00
Timothee Cour
38b41f893a fix #17941: UnusedImport works for var/let/const/type invoked inside a generic (#17942)
* fix #17941: UnusedImport works for var/let/const/type invoked inside a generic

* fixup
2021-05-08 09:56:46 +02:00
Timothee Cour
98c29c01eb fix #14873 properly by skipping abi field in importc type (#17944)
* fix #14873 properly by skipping `abi` field in importc type

* add test

* fix test for windows
2021-05-07 19:36:41 +02:00
Timothee Cour
0b4b9b3ad0 remove unsused OsPlatform.nimVM (#17953) 2021-05-07 06:55:46 +02:00