Commit Graph

7598 Commits

Author SHA1 Message Date
ringabout
a8c9e9c4e9 deduplicate 2023-03-29 21:12:01 +08:00
ringabout
d997bd4cb5 message 2023-03-26 23:45:37 +08:00
ringabout
e51f27c806 add one more message 2023-03-26 23:44:04 +08:00
ringabout
c1c53bebf1 fixes private fields 2023-03-25 15:47:38 +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
a56697b513 add a filter for unnamed fields 2023-03-24 14:59:44 +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
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
Andreas Rumpf
f7e3af0c2d mitigates #21272; but it's not the final fix because the first round … (#21462)
mitigates #21272; but it's not the final fix because the first round of overload resolution should already match
2023-03-20 22:53:13 +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
Amjad Ben Hedhili
26b7a74a45 Optimize cgen.addIndent (#21508)
* Optimize `cgen.addIndent`

* Avoid temporaries
2023-03-13 17:32:20 +01: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
Andreas Rumpf
46d2161c23 minor refactoring (#21499) 2023-03-10 14:20:30 +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
ghost
8e9fc5e639 a better message if graphviz's dot/nodejs is not found in PATH (#21488)
* finish issue #21474: a better message if dot is not found locally when using gendepend

* fix a typo in compiler

* trim empty path reported in `findNodeJs`

* compiler/main.nim: switch raise to simply quit
2023-03-08 22:34:59 +01: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
Joey
05e8a60bb4 Add line directives for C code variables (#21466)
* Add line directives for C code variables

* Refactor genCLineDir to only use toFullPath if necessary
2023-03-05 20:14:59 +01:00
SirOlaf
7bde421e4d Fix #21272: Rewrite parts of pickBestCandidate (#21465)
* Make pickBestCandidate store syms

* Remove useless cursor

* Try making pickBestCandidate more readable

* Fix advance order

* Revert back to seq with lots of comments

---------

Co-authored-by: SirOlaf <>
2023-03-05 11:56:51 +01:00
ringabout
d950e5f3a8 remove nosinks hacks from compiler (#21469) 2023-03-04 20:07:33 +08:00
quantimnot
6994e1b1d7 --embedsrc for JavaScript (#21467)
Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2023-03-04 07:57:30 +01: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
ringabout
d51a392149 replaces implicit passes array registed at runtime with explicit function calls; simplify compilation pipeline (#21444)
* abolish using passes in the compiler; simplify compilation pipeline

* duplicate code

* Really cool to have the same signature...

* haul

* unify other backends

* refactor process

* introduce PipelinePhase

* refactor compiler

* fixes passes

* fixes nimsuggest

* add a sentinel

* enable docs checkj

* activate doc testing

* clean up

* complete cleanups
2023-03-03 07:36:38 +01: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
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
heterodoxic
c4dd0c4301 suggestion for a simple fix for #21279 (#21378) 2023-03-01 17:17:05 +01:00
Ikko Eltociear Ashimine
89a60939f8 Fix typo in sourcemap.nim (#21438)
seperated -> separated
2023-02-27 00:57:02 +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
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
Francis Thérien
7dc80a7fef Mitigate issues related to compiler options when cross-compiling (#21330)
* Document C compiler options config when cross-compiling

* Allow empty string to override default
2023-02-22 21:10:02 +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
ringabout
a3603c8a6e saves one unnecessary compare which is also a small regression (#21413)
saves one unnecessary compare which is also a sall regression

follow up d30c6419a0
2023-02-21 23:42:28 +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
ringabout
bdc850916f improve invalid module names errors (#21412)
I have seen these questions: "Why I got an invalid module name errors?". To eliminate this kind of questions, We might improve th error messages. Though, the question might evolve into "What is a valid Nim identifier", which should be more searchable on the Internet.
2023-02-21 11:46:50 +01:00
Matt Haggard
6b93db7070 Fix long link commands on macOS (v2) (#21382)
Handle long link commands on macOS with a script, since ar does not support response files
2023-02-17 11:25:15 +01:00
Century Systems
3b9e9fd7b2 Add support for NuttX RTOS. (#21372)
* Add support for NuttX RTOS.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: pure: asyncdispatch: assign to result.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

* lib: std: typedthreads: add support for parameters to adjust Thread Stack Size.

Like FreeRTOS/Zephyr, add support for following configurations.

  -d:nimThreadStackSize=xxxxx
  -d:nimThreadStackGuard=yyyy

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>

---------

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
2023-02-16 13:47:52 +01:00
ringabout
93e4f278a1 add deprecated warnings for {.deadcodeelim: on.} (#21277) 2023-02-16 13:34:32 +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