| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #21353
```nim
result = newNodeIT(nkTupleConstr, info, t)
result.add(newNodeIT(nkNilLit, info, t))
result.add(newNodeIT(nkNilLit, info, t))
```
The old implementation uses `t` which is the type of the closure
function as its type. It is not correct and generates ((nil, nil), (nil,
nil)) for `default(closures)`. This PR creates `(tyPointer, tyPointer)`
for fake closure types just like what cctypes do.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fixes #16700, fixes #20916, refs #24010
Fixes the instantiation issues for proc param default values encountered
in #24010 by:
1. semchecking generic default param values with `inGenericContext` for
#22029 and followups to apply (the bigger change in semtypes),
2. rejecting explicit generic instantiations with unresolved generic
types inside `inGenericContext` (sigmatch change),
3. instantiating the default param values using `prepareNode` rather
than an insufficient manual method (the bigger change in seminst).
This had an important side effect of references to other parameters not
working since they would be resolved as a symbol belonging to the
uninstantiated original generic proc rather than the later instantiated
proc. There is a more radical way to fix this which is generating ident
nodes with `tyFromExpr` in specifically this context, but instead we
just count them as belonging to the same proc in
`hoistParamsUsedInDefault`.
Other minor bugfixes:
* To make the error message in t20883 make sense, we now give a "cannot
instantiate" error when trying to instantiate a proc generic param with
`tyFromExpr`.
* Object constructors as default param values generated default values
of private fields going through `evalConstExpr` more than once, but the
VM doesn't mark the object fields as `nfSkipFieldChecking` which gives a
"cannot access field" error. So the VM now marks object fields it
generates as `nfSkipFieldChecking`. Not sure if this affects VM
performance, don't see why it would.
* The nkRecWhen changes in #24042 didn't cover the case where all
conditions are constantly false correctly, this is fixed with a minor
change. This isn't needed for this PR now but I encountered it after
forgetting to `dec c.inGenericContext`.
|
|
|
|
|
|
| |
fixes #24057
Instead of crashing the compiler, the VM now gives a stacktrace if a nil
closure is attempted to be called.
|
|
|
|
|
|
| |
[backport] (#23941)
fixes #23936
follow up https://github.com/nim-lang/Nim/pull/20527
|
|
|
| |
fixes #13391
|
|
|
|
|
| |
(#23363)
…ort]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This code will crash `check`/`nimsuggest` since the `ra` register is
uninitialised
```nim
import macros
static:
discard parseExpr("'")
```
Now it assigns an empty node so that it has something
Testament changes were so I could properly write a test. It would pass
even with a segfault since it could find the error
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Done:
- [x] Implement conversions to openArray/varargs.
- [x] Implement index/range checking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Theoretical Benefits / Plans:
- Typed assembler-like language.
- Allows for a CPS transformation.
- Can replace the existing C backend by a new C backend.
- Can replace the VM.
- Can do more effective "not nil" checking and static array bounds
checking.
- Can be used instead of the DFA.
- Easily translatable to LLVM.
- Reasonably easy to produce native code from.
- Tiny memory consumption. No pointers, no cry.
**In very early stages of development.**
Todo:
- [x] Map Nim types to IR types.
- [ ] Map Nim AST to IR instructions:
- [x] Map bitsets to bitops.
- [ ] Implement string cases.
- [ ] Implement range and index checks.
- [x] Implement `default(T)` builtin.
- [x] Implement multi string concat.
- [ ] Write some analysis passes.
- [ ] Write a backend.
- [x] Integrate into the compilation pipeline.
|
|
|
|
|
|
|
|
|
|
| |
Attempts to move the generic instantiation to the module that uses it.
This should decrease re-compilation times as the source module where the
generic lives doesnt need to be recompiled
---------
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
| |
* minor style changes in the compiler
* use raiseAssert
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#22527)
* fix getNullValue for cstring in VM
fixes #22524
* very ugly fixes, but fix #15730
* nil cstring len works, more test lines
* fix high
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* wip; use strictdefs for compiler
* checkpoint
* complete the chores
* more fixes
* first phase cleanup
* Update compiler/bitsets.nim
* cleanup
|
|
|
|
|
|
|
|
|
|
|
| |
* fix VM uint conversion bug, stricter int gen on JS
fixes #19929
* fix float -> uint64 conversion too
* no need to mask to source type
* simpler diff with explanation, add test for described issue
|
|
|
| |
allow addressing elements of openArray[char]
|
|
|
| |
adds rkInt to the opcCastPtrToInt op
|
| |
|
|
|
|
|
|
|
| |
* fixes #21708; skip colon for tuples in VM
* skip nimnodes
* fixes types
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(#21667)
* refactoring in preparation for better, simpler name mangling that works with IC flawlessly
* use new disamb field
* see if this makes tests green
* make tests green again
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* suppresses non-exported fields of types and adds command-line option to re-enable this if desired
* corrected the doctest that produced a CI error
* an embarrassingly bad error in reasoning
* modified a nimdoc test to reflect updated behavior
* needed another change to bring utils.html doctest in sync with update
* add info
* fix nimdoc
* lint
* render postfix
* fixes a problem
* fixes nimdoc
* fix nimdoc
---------
Co-authored-by: johnperry-math <john.perry@usm.edu>
Co-authored-by: johnperry-math <devotus@yahoo.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implemented level based macro expand functionality
- it can handle single macro call or expand whole function/proc/etc and it
- In addition, I have altered the parser to provide the endInfo for the node.
The usefulness of the `endInfo` is not limited to the `expandMacro`
functionality but also it is useful for `ideOutline` functionality and I have
altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of
the time is lost during the AST transformation thus in `nimsuggest.nim` I am
using freshly parsed tree to get the location information.
* Make sure we stop expanding correctly
* Test CI
* Fix tv3_outline.nim
|
|
|
|
|
|
|
| |
* fixes #14409; fixes#10674 VM callbacks switch to table-index seqs
* fixes package name
* reduce runtime cost
|
|
|
| |
remove deadcode in VM
|
| |
|
|
|
|
|
| |
* remove legacy code
* fixes
|
|
|
|
|
| |
* Implement setLineInfo
* Add tests
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #20746; remove string copies for ORC booted compiler
* add a test case
* use `cursor` thanks to @beef331
* for old compilers
* change file extension
* change test cases
|
|
|
|
|
| |
(#20698)
fix #20148 implicit compile time conversion int to ranged float causes compiler fatal error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added 'openarray[char]' overloads to 'std/parseutils'
* Removed redundant `start` and `last` params from slice using procs
* Fixed type for parseIdent overload
* fixed one by off with 'substr'
* removed missed start parameters for procedures
* Added 'openarray[char]' overloads to 'std/parseutils'
* Removed redundant `start` and `last` params from slice using procs
* Fixed type for parseIdent overload
* fixed one by off with 'substr'
* removed missed start parameters for procedures
* Fixed VM op to work with new 'opcSlice'
* Corrected captureBetween's logic to work with openarray
* js sys's parsefloat logic now uses openarray
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
time. (#20586)
* Implemented opcSlice to make 'toOpenArray' work on the VM
* Added nkOpenArray for VM to reduce bodgeness
* Fixed range issues and erraneous comments
* Range check correctly for openArrays in opcLdArr
* Inverted logic for ldArr checking
* vm now supports slicing strings
* Added string tests
* Removed usage of 'nkOpenArray' and redundant operations
* Refactored vmSlice implementation, removing redundant and incorrect code
* Made tuples go throw opcWrObj for field assignment
* All strkinds should be considered for openarrays
|
|
|
|
|
|
|
| |
* refactoring
* refactoring: removed unused macroUsagesSection
* enum instead of bool for better readability
|
|
|
|
|
|
|
|
|
|
|
| |
* pragma for sfCallsite instead of name check at every template definition
Not documented because it seems to be for internal use?
Should also make it possible to make comparisons and setops imports, but this doesn't have to be done.
I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe.
* make sfCallsite recursive, add tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* move formatfloat out of system
* fixes doc
* Update changelog.md
* careless
* fixes
* deprecate system/formatfloat
* better handling
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* remove shallowCopy for ARC/ORC
* use move
* fix
* more fixes
* typo
* Update lib/system.nim
* follow
* add nodestroy
* move
* copy string
* add a changelog entry
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Change `styleCheck` to ignore foreign packages
* Symbols from foreign packages are now ignored.
* Fixed `styleCheck` violations in `compiler` package.
* Added symbol ownership to custom annotation pragmas.
* Minor refactors to cleanup style check callsites.
* Minor internal documentation of reasons why a symbol isn't checked.
Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.
Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.
Fixes #10201
See also nim-lang/RFCs#456
* Fix a misunderstanding about excluding field style checks
I had refactored the callsites of `styleCheckUse` to apply the DRY
principle, but I misunderstood the field access handling in a template
as a general case. This corrects it.
* Fix some `styleCheck` violations in `compiler/evalffi`
The violations were exposed in CI when the compiler was built with
libffi.
* Removed some uneeded transitionary code
* Add changelog entry
Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#19902) [backport]
* revert #12217 since the root problem seems to have been fixed; fix #15974;fix #12551; fix #19464
* fix #16020; fix #16780
* fix tests and #16613
* fix #14553
* fix #19909; skip skipRegisterAddr
* fix #18641
|
|
|
| |
correct comment opcDeref => opcLdDeref
|
|
|
| |
remove unused procs
|