summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
Commit message (Collapse)AuthorAgeFilesLines
* minor improvements to follow up recent PRs (#20342)metagn2022-09-141-1/+1
| | | | | | put mOpenArrayToSeq in compile-time evaluation whitelist (it was mNone before which was whitelisted), homogenize "ordinal type expected" errors, put overloadable enums in non-experimental manual
* overloadable enums no longer experimental (#20298)metagn2022-09-051-4/+1
| | | depends on #20126
* only allow enums to overload enums + extra test (#20126)metagn2022-09-031-2/+2
| | | mirror behavior without overloadableEnums
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-241-122/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* new .redefine pragma for templates, warn on redefinition without it (#20211)metagn2022-08-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test CI for template redefinitions * adapt asyncmacro * fix quote * fix again * try something else * revert * fix ioselectors_select, disable packages CI * adapt more tests & simplify * more * more * more * rename to redefine, warn on implicit redefinition * basic documentation [skip ci] * Update compiler/lineinfos.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* remove {.this.} pragma, deprecated since 0.19 (#20201)metagn2022-08-231-27/+0
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Warn when casting to a larger type (#20103)konsumlamm2022-07-281-8/+10
| | | | | * Warn when casting to a larger type * Revert change to error message to fix CI
* Change `styleCheck` to ignore foreign packages (#19822)quantimnot2022-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* allow dots in defined() (#20010)metagn2022-07-121-1/+13
| | | | | | | * allow dots in defined() refs https://github.com/nim-lang/RFCs/issues/181 * mention accents in older versions
* Allow recursive closure iterators (#19939)Tanguy2022-06-301-1/+2
|
* Fix fixAbstractType for user defined typeclasses, fixes #19730 & #18409 (#19732)nc-x2022-04-301-1/+1
|
* Make sure that field usage preserves the original line info (#19751)Ivan Yonchovski2022-04-291-0/+2
| | | | Currently `struct.field` will generate a node with `info` that points to the symbol definition instead of having the actual node location.
* fix stylecheck bug with nre (#19356)flywind2022-04-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests * fix stylecheck bug with nre * Update compiler/linter.nim * no need to check dotexpr again * neither did let/var/const
* fixes #19603; some pragmas were really only supported as top level ↵Andreas Rumpf2022-03-261-1/+7
| | | | statements. Now this is enforced properly. (#19646)
* apply changes from #18017 and some fixes (#19571)flywind2022-03-011-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/369 * deprecate unsafeAddr; extend addr addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr * follow @Vindaar's advice * change the signature of addr * unsafeAddr => addr (stdlib) * Update changelog.md * unsafeAddr => addr (tests) * Revert "unsafeAddr => addr (stdlib)" This reverts commit ab83c99c507048a8396e636bf22d55fdd84d7d1c. * doc changes; thanks to @konsumlamm Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * merge * remove * fix bug Co-authored-by: Araq <rumpf_a@web.de> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Fixed object field access of static objects in generics (#19283) [backport]Jason Beetham2021-12-231-1/+1
|
* accept object type node from macros (#19179)hlaaftana2021-11-241-1/+1
|
* add ghci like type annotation buildEchoStmt (1049) (#18875)林亦恩2021-10-131-0/+1
| | | | | | | | | | | | * add ghci like type annotation buildEchoStmt (1049) * Update compiler/semexprs.nim * Update compiler/semexprs.nim Co-authored-by: flywind <xzsflywind@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <xzsflywind@gmail.com>
* alternative to #18918 (#18927)flywind2021-09-301-0/+2
| | | | | * fix #16558 * add testcase
* closes #16132 [backport] (#18880)Andreas Rumpf2021-09-221-5/+8
| | | | | * closes #16132 [backport] * fixes #16132 [backport]
* fixes #18856 [backport] (#18879)Andreas Rumpf2021-09-221-1/+1
|
* Fixed borrowing dot from aliases (#18854)Jason Beetham2021-09-161-2/+2
|
* Dotborrow now works with generic distincts (#18848)Jason Beetham2021-09-141-2/+2
|
* Generic pointer procs now error if no types supplied (#18832)Jason Beetham2021-09-111-1/+1
| | | | | | | * more precise logic for pointer procs * added test for generic pointer procs * Fixed generic getting bracket expr if erroring
* Fixes implicit and explicit generics in procedures (#18808)Jason Beetham2021-09-061-5/+23
| | | | | | | | | | | * Fixes implicit and explicit generics * moved block logic into 'maybeInstantiateGeneric' * Added more tests * Update compiler/semexprs.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* '[]' can now be used for iterators (#18814)Jason Beetham2021-09-061-1/+1
|
* implements https://github.com/nim-lang/RFCs/issues/407 (#18793)Andreas Rumpf2021-09-031-4/+12
|
* implements overloadable enum values; WIP (#18470)Andreas Rumpf2021-07-281-1/+35
| | | | | * implements overloadable enum values * simpler code
* refactoring: removed dead code (#18567)Andreas Rumpf2021-07-241-12/+7
|
* undo RFC #294, it breaks code for no good reason, the compiler can wa… ↵Andreas Rumpf2021-07-211-3/+1
| | | | | | | | | | | | | (#18546) * undo RFC #294, it breaks code for no good reason, the compiler can warn about the construct instead * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * enable test case Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* improve `--declaredLocs` to help disambiguate types (generics, aliases etc) ↵Timothee Cour2021-07-081-1/+1
| | | | | | | | | (#18389) * improve --declaredlocs to help disambiguate types (generics, aliases etc) * avoid a cyclic deps * fix test after rebase
* fixes #16270 (#18388)Andreas Rumpf2021-06-291-0/+1
|
* add more APIs to compiler/debugutils; re-export it (#18243)Timothee Cour2021-06-181-0/+7
|
* Renamed `-d:nimCompilerStackraceHints` to `-d:nimCompilerStacktraceHints`. ↵Timothee Cour2021-06-171-2/+2
| | | | (#18283)
* fixes #15884 (#18230)Andreas Rumpf2021-06-101-1/+1
| | | | | * fixes #15884 * micro optimization
* fixes #18059 (#18140)Andreas Rumpf2021-06-021-2/+26
| | | | * fixes #18059
* feature: the compiler can warn when you use the implicit 'result' variable ↵Andreas Rumpf2021-05-101-0/+3
| | | | | (#17988) [backport:1.2] * implements #17855
* add colon (#17834)flywind2021-04-241-1/+1
|
* `typeof(voidStmt)` now works (#17807)Timothee Cour2021-04-231-1/+3
| | | | | | | | * `typeof(voidStmt)` now works * remove typeOrVoid * add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193 * fixup * changelog [skip ci] * fixup
* fix #7535(Poor error message for spawn when a procedure (without calling ↵flywind2021-04-211-2/+5
| | | | it)) (#17774)
* Revert localErrorNode param order changes (#17809)Clyybber2021-04-211-1/+1
| | | | | | | * Revert localErrorNode param order changes * Remove unused globalError overload * heh
* fix `hintMsgOrigin` regression + simplify msgs code (#17805)Timothee Cour2021-04-211-1/+1
|
* Introduce localErrorNode (#17785)Clyybber2021-04-191-4/+2
|
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-2/+2
| | | | cstring, not cString (#17744)
* Fix array's high & low return type for empty arrays (#17705)Tanguy Cizain2021-04-151-0/+2
| | | | | | | | | * fix array.high/low return type * Add test for empty array low return type Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-0/+1
| | | | | | | | | * IC: first steps towards 'nim check --def --ic:on' * IC navigator: deduplicate output lines * IC navigator: progress * IC navigator: use a different nimcache entry * IC navigator: special logic for templates/macros * IC navigator: proper error messages * IC navigator: prepare for testing code; document only what currently works somewhat
* iterable[T] (#17196)Timothee Cour2021-04-111-2/+7
| | | | | | | | * fix failing test toSeq in manual which now works * changelog * reject proc fn(a: iterable) * add iterable to spec * remove MCS/UFCS limitation that now works
* fixes #17656 (#17657)Andreas Rumpf2021-04-071-1/+2
|
* implement RFCs/294 ; disallow enum <=> enum conversion (#16351)Timothee Cour2021-04-031-0/+5
| | | | | | | | | | | * fix https://github.com/nim-lang/RFCs/issues/294 ; disallow enum <=> enum conversion * fix the runnableExamples that was the instigator of this RFC * legacy -d:nimLegacyConvEnumEnum * use -d:nimLegacyConvEnumEnum in important_package nimgame2 * add test for enum cast * improve changelog * add changelog: Changes affecting backward compatibility * cleanup changelog * fix changelog
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info