Commit Graph

62 Commits

Author SHA1 Message Date
metagn
2f547afb0f import brackets support as and prefixes [backport] (#21636)
* import brackets support `as` and prefixes

fixes #21635

* copyTree -> copyNode
2023-04-18 10:35:35 +02:00
metagn
3f51b6f73d set module symbol type to None instead of nil for discard check (#21657)
* set module symbol type to None instead of nil

fixes #19225

* alright
2023-04-13 11:56:16 +02: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
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
7739e23420 defaults to ORC (#19972)
* defaults to Orc

* bootstrap using refc

* use gc

* init orc defines

* unregister orc

* fix gc

* fix commands

* add prepareMutation for orc

* enable deepcopy for orc

* prepareMutation

* more fixes

* some cases

* bug #20081

* partial fixes

* partial fixes

* fixes command line

* more fixes

* build Nim with refc

* use gc

* more fixes

* rstore

* orc doesn't support threadpool

* more shallowCopy

* more fixes

* fixes unsafeNew

* workarounds

* small

* more fixes

* fixes some megatest

* tcodegenbugs1 refc

* fxies megatest

* build nimble with refc

* workaround tensordsl tests

* replace shallowCopy with move

* fixes action

* workaround

* add todo

* fixes important packages

* unpublic unregisterArcOrc

* fixes cpp

* enable windows

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-09-23 13:05:05 +02:00
quantimnot
d30c6419a0 Refactor and doc package handling, module name mangling (#19821)
* Refactor and doc package handling, module name mangling

* Consolidate, de-duplicate and extend package handling
* Alter how duplicate module names of a package are handled
* Alter how module names are mangled
* Fix crash when another package is named 'stdlib' (test case added)
* Doc what defines a package in the manual

Modules with duplicate names within a package used to be given 'fake'
packages to resolve conflicts. That prevented the ability to discern if
a module belonged to the current project package or a foreign package.
They now have the proper package owner and the names are mangled in a
consistent manner to prevent codegen clashes.

All module names are now mangled the same. Stdlib was treated special
before, but now it is same as any other package. This fixes a crash
when a foreign package is named 'stdlib'.

Module mangling is altered for both file paths and symbols used by the
backends.

Removed an unused module name to package mapping that may have been
intended for IC. The mapping was removed because it wasn't being used
and was complicating the issue of package modules with duplicate names
not having the proper package owner assigned.

* Fix some tests

* Refactor `packagehandling`

* Remove `packagehandling.withPackageName` and its uses
* Move module path mangling from `packagehandling` to `modulepaths`
* Move `options.toRodFile` to `ic` to break import cycle

* Changed import style to match preferred style

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-05-30 18:52:19 +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
fb677bf5c9 fix #17952: fix both false positives and false negatives for reInvalidSpec (#17956)
* fix #17952: fix both false positives and false negatives for reInvalidSpec

* handle megatest properly

* fix for tests/stdlib/tbase64.nim
2021-05-08 00:22:21 +02:00
Andreas Rumpf
979148e863 refactorings to prepare the compiler for IC (#15935)
* added ic specific Nim code; WIP
* make the symbol import mechanism lazy; WIP
* ensure that modules can be imported multiple times
* ambiguity checking
* handle converters and TR macros properly
* make 'enum' test category green again
* special logic for semi-pure enums
* makes nimsuggest tests green again
* fixes nimdata
* makes nimpy green again
* makes more important packages work
2020-12-17 08:01:36 +01:00
Bung
e2b1491905 Fix #11352 strutil.insertSep() fails on negative numbers (#15087)
* fix #11352 strutil.insertSep handle negtive number

* test for #11352

* optimize

* not parts string var

* Update lib/pure/strutils.nim

Thanks!

Co-authored-by: alaviss <leorize+oss@disroot.org>

* need to be countdown

Co-authored-by: alaviss <leorize+oss@disroot.org>
2020-07-28 11:47:22 +02:00
Clyybber
0a9a639230 Add testcase for #4796 (#14784)
* Add testcase for #4796

* Fix test
2020-06-25 15:12:30 +02:00
Andreas Rumpf
832b0a0232 fixes #12420 [backport] (#12456) 2019-10-18 22:13:24 +02:00
nc-x
b68380f09b fixes #11872; include now gives a proper error message for all invalid infix operators (#11965) 2019-08-17 19:45:47 +02:00
nc-x
cf09ef47b8 Remove duplicate line number from 'invalid forward declaration' error (#11966) 2019-08-17 10:35:25 +02:00
Andreas Rumpf
7e53c1c5c5 fixes #11188 (#11319) 2019-05-24 22:50:43 +02:00
Andreas Rumpf
39a3dbb16b fixes #11187 (#11315) 2019-05-24 08:19:05 +02:00
jrfondren
8cadeb9605 Merge branch 'devel' into expand-amb-identifier-output 2019-05-03 13:03:45 -05:00
narimiran
515ab81477 add whitespace on the right-hand side of --
This is an em-dash, not some `--use` flag.
2019-05-03 11:33:29 +02:00
Julian Fondren
6dfde0e931 fix test expecting ambiguous-identifier error
the test is only against the first line, but testament doens't
support multi-line error messages yet.
2019-04-29 23:15:10 -05:00
Andreas Rumpf
0121dda9ba remove the restriction that module names need to be unique per Nimble… (#11064)
* remove the restriction that module names need to be unique per Nimble package

* make tests green again

* use the 'response' linker file also on Unix in order to fix megatest
2019-04-20 15:19:02 +02:00
Andreas Rumpf
444f2231c9 make tests green again 2019-02-08 16:54:12 +01:00
Timothee Cour
ab72d68ec8 fix off by 1 error in col shown by toFileLineCol (#10138)
* fix off by 1 error in `col` shown by toFileLineCol
* fix test failures
2018-12-31 15:42:01 +01:00
Andreas Rumpf
b53327c92a fixes #9994 2018-12-15 14:30:21 +01:00
Andreas Rumpf
675b6f0773 fixes #9978 2018-12-14 17:15:03 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Neelesh Chandola
96647618c2 Fix compilation of test on linux and mac 2018-12-09 15:44:18 +05:30
Neelesh Chandola
81427b535d Add final newlines 2018-12-09 13:57:17 +05:30
Neelesh Chandola
f77ddccb6c add tests 2018-12-09 13:56:11 +05:30
Arne Döring
031bfdec6f make run the default action of a test in tester 2018-11-23 11:58:28 +01:00
Arne Döring
77a0f3768b adopt tests 2018-11-08 22:28:29 +01:00
awr
02306020b2 fix test 2018-09-04 18:25:54 -05:00
Oscar Nihlgård
96363ecaf3 Fix nkImportAs regression (#8796) 2018-08-28 11:35:52 +02:00
Oscar Nihlgård
d6d3f092a3 Fix for module alias inside brackets (#8726) 2018-08-23 10:23:02 +02:00
LemonBoy
bbe5e8326b sfForward is also sfReorder for skModule symbols (#8692)
Take this into account while searching for undefined forward references.

Fixes #8665
2018-08-21 14:51:23 +02:00
Zahary Karadjov
cf13c5fba4 implement the export/except statement 2018-05-07 09:37:49 +02:00
Andreas Rumpf
eeea000582 make the 'canimport' template work 2018-03-06 15:57:46 +01:00
Araq
f3a895f043 fixes #6965 2017-12-28 00:50:45 +01:00
Araq
8db5b32ff7 make type vs proc ambiguous handling more consistent; fixes #6726; fixes #6693 2017-12-15 12:16:03 +01:00
BigEpsilon
e2af486434 Add sections (type, var, let, const, using) support for reorder pragma (#6326) 2017-10-28 11:33:35 +02:00
Andreas Rumpf
dfe067a74a reorder pass: consider the 'using' statement; disabled debug output 2017-08-11 20:14:44 +02:00
Andreas Rumpf
50f62ff44a distinguish between 'reorder' and 'noforward' 2017-07-26 08:20:11 +02:00
Arne Döring
52f092d02b Lineinfo change (#6084) 2017-07-17 08:12:15 +02:00
Araq
280941aca6 make tests green again 2017-06-09 13:34:45 +02:00
Lolo Iccl
b6b5a11be7 Fixes #5112 (Fix error messages raised when multiple modules have the same original name) (#5220)
Fixes #5112
2017-01-17 16:58:50 +01:00
Araq
b1b2dd606b fixes #5076 2016-11-30 11:00:51 +01:00
Andreas Rumpf
01ae0d28d4 recursive modules are only detected to improve error messages 2016-11-24 12:27:21 +01:00
Araq
074f276c8a disallow recursive module dependencies 2016-11-23 23:23:31 +01:00
Andreas Rumpf
e9eab32e54 new language feature: explicit 'import system' statements are allowed 2016-07-07 01:02:12 +02:00
Adam Strzelecki
be991ed413 Rename rawsockets module to nativesockets
This change was done to avoid confusion with TCP/IP raw sockets. Native sockets
module represents handling native system low level socket API in general and is
not just limited anyhow to TCP/IP raw sockets.

A stub lib/deprecated/pure/rawsockets.nim module has been added as
compatibility layer for old code using rawsockets, so this change will not
break existing code.
2015-10-03 19:45:41 +02:00
Adam Strzelecki
e80465dacf tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:04:32 +02:00