diff --git a/compiler/aliases.nim b/compiler/aliases.nim index fa9824c41e472..40d6e272c68fb 100644 --- a/compiler/aliases.nim +++ b/compiler/aliases.nim @@ -10,7 +10,9 @@ ## Simple alias analysis for the HLO and the code generators. import - ast, astalgo, types, trees, intsets + ast, astalgo, types, trees + +import std/intsets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/ast.nim b/compiler/ast.nim index 8d4511436ff3a..5ee9afa024ded 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -10,8 +10,10 @@ # abstract syntax tree + symbol table import - lineinfos, hashes, options, ropes, idents, int128, tables, wordrecg -from strutils import toLowerAscii + lineinfos, options, ropes, idents, int128, wordrecg + +import std/[tables, hashes] +from std/strutils import toLowerAscii when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 1873d231fe8cb..720f6087f9663 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -12,10 +12,11 @@ # the data structures here are used in various places of the compiler. import - ast, hashes, intsets, options, lineinfos, ropes, idents, rodutils, + ast, options, lineinfos, ropes, idents, rodutils, msgs -import strutils except addf +import std/[hashes, intsets] +import std/strutils except addf when defined(nimPreviewSlimSystem): import std/assertions @@ -408,7 +409,7 @@ proc symToYaml(conf: ConfigRef; n: PSym, indent: int = 0, maxRecDepth: int = - 1 var marker = initIntSet() result = symToYamlAux(conf, n, marker, indent, maxRecDepth) -import tables +import std/tables const backrefStyle = "\e[90m" const enumStyle = "\e[34m" diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index a591ce93ba39a..4103e0afb06c9 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -11,7 +11,7 @@ # ------------------------- Name Mangling -------------------------------- -import sighashes, modulegraphs, strscans +import sighashes, modulegraphs, std/strscans import ../dist/checksums/src/checksums/md5 type diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 87fed300bb1e0..bfb429f8277c6 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -10,9 +10,11 @@ # This module declares some helpers for the C code generator. import - ast, types, hashes, strutils, msgs, wordrecg, + ast, types, msgs, wordrecg, platform, trees, options, cgendata +import std/[hashes, strutils] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/cgen.nim b/compiler/cgen.nim index a2b2c429ef15d..0011cb90e3a91 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -10,11 +10,11 @@ ## This module implements the C code generator. import - ast, astalgo, hashes, trees, platform, magicsys, extccomp, options, intsets, + ast, astalgo, trees, platform, magicsys, extccomp, options, nversion, nimsets, msgs, bitsets, idents, types, - ccgutils, os, ropes, math, wordrecg, treetab, cgmeth, + ccgutils, ropes, wordrecg, treetab, cgmeth, rodutils, renderer, cgendata, aliases, - lowerings, tables, sets, ndi, lineinfos, pathutils, transf, + lowerings, ndi, lineinfos, pathutils, transf, injectdestructors, astmsgs, modulepaths, backendpragmas from expanddefaults import caseObjDefaultBranch @@ -27,10 +27,10 @@ when defined(nimPreviewSlimSystem): when not defined(leanCompiler): import spawn, semparallel -import strutils except `%`, addf # collides with ropes.`%` +import std/strutils except `%`, addf # collides with ropes.`%` from ic / ic import ModuleBackendFlag -import dynlib +import std/[dynlib, math, tables, sets, os, intsets, hashes] when not declared(dynlib.libCandidates): proc libCandidates(s: string, dest: var seq[string]) = @@ -121,7 +121,7 @@ proc getModuleDllPath(m: BModule, module: int): Rope = proc getModuleDllPath(m: BModule, s: PSym): Rope = result = getModuleDllPath(m.g.modules[s.itemId.module]) -import macros +import std/macros proc cgFormatValue(result: var string; value: string) = result.add value diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 9cc146c4db5f7..30d778bc23ac6 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -10,8 +10,10 @@ ## This module contains the data structures for the C code generation phase. import - ast, ropes, options, intsets, - tables, ndi, lineinfos, pathutils, modulegraphs, sets + ast, ropes, options, + ndi, lineinfos, pathutils, modulegraphs + +import std/[intsets, tables, sets] type TLabel* = Rope # for the C generator a label is just a rope diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index ed8f33630ef08..8ad6bf3f4b92d 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -10,9 +10,12 @@ ## This module implements code generation for methods. import - intsets, options, ast, msgs, idents, renderer, types, magicsys, + options, ast, msgs, idents, renderer, types, magicsys, sempass2, modulegraphs, lineinfos + +import std/intsets + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/closureiters.nim b/compiler/closureiters.nim index 15c627dcdf85b..63e8d2fe90d22 100644 --- a/compiler/closureiters.nim +++ b/compiler/closureiters.nim @@ -134,7 +134,9 @@ import ast, msgs, idents, renderer, magicsys, lowerings, lambdalifting, modulegraphs, lineinfos, - tables, options + options + +import std/tables when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/cmdlinehelper.nim b/compiler/cmdlinehelper.nim index e35e5d2db8ed6..031ad755e06b4 100644 --- a/compiler/cmdlinehelper.nim +++ b/compiler/cmdlinehelper.nim @@ -11,7 +11,9 @@ import options, idents, nimconf, extccomp, commands, msgs, - lineinfos, modulegraphs, condsyms, os, pathutils, parseopt + lineinfos, modulegraphs, condsyms, pathutils + +import std/[os, parseopt] proc prependCurDir*(f: AbsoluteFile): AbsoluteFile = when defined(unix): diff --git a/compiler/commands.nim b/compiler/commands.nim index 0e35cc3e8c278..e758ed09b99cb 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -27,7 +27,9 @@ bootSwitch(usedNoGC, defined(nogc), "--gc:none") import std/[setutils, os, strutils, parseutils, parseopt, sequtils, strtabs] import msgs, options, nversion, condsyms, extccomp, platform, - wordrecg, nimblecmd, lineinfos, pathutils, pathnorm + wordrecg, nimblecmd, lineinfos, pathutils + +import std/pathnorm from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect diff --git a/compiler/concepts.nim b/compiler/concepts.nim index 55088740c888b..d8b65720b6098 100644 --- a/compiler/concepts.nim +++ b/compiler/concepts.nim @@ -11,7 +11,9 @@ ## for details. Note this is a first implementation and only the "Concept matching" ## section has been implemented. -import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types, intsets +import ast, astalgo, semdata, lookups, lineinfos, idents, msgs, renderer, types + +import std/intsets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 520545a815340..aa619c93204b0 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -10,7 +10,7 @@ # This module handles the conditional symbols. import - strtabs + std/strtabs from options import Feature from lineinfos import hintMin, hintMax, warnMin, warnMax @@ -162,3 +162,4 @@ proc initDefines*(symbols: StringTableRef) = defineSymbol("nimHasNolineTooLong") defineSymbol("nimHasCastExtendedVm") + defineSymbol("nimHasWarnStdPrefix") diff --git a/compiler/depends.nim b/compiler/depends.nim index 84e66f78063be..638f1eb51aee2 100644 --- a/compiler/depends.nim +++ b/compiler/depends.nim @@ -14,7 +14,7 @@ import options, ast, ropes, pathutils, msgs, lineinfos import modulegraphs import std/[os, parseutils] -import strutils except addf +import std/strutils except addf import std/private/globs when defined(nimPreviewSlimSystem): diff --git a/compiler/dfa.nim b/compiler/dfa.nim index 4cae9ec42bf0f..1511628dd6f75 100644 --- a/compiler/dfa.nim +++ b/compiler/dfa.nim @@ -22,8 +22,9 @@ ## "A Graph–Free Approach to Data–Flow Analysis" by Markus Mohnen. ## https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf -import ast, intsets, lineinfos, renderer, aliasanalysis +import ast, lineinfos, renderer, aliasanalysis import std/private/asciitables +import std/intsets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 7edee1663f6b7..ea7cfad8cf000 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -15,15 +15,16 @@ ## For corresponding users' documentation see [Nim DocGen Tools Guide]. import - ast, strutils, strtabs, algorithm, sequtils, options, msgs, os, idents, + ast, options, msgs, idents, wordrecg, syntaxes, renderer, lexer, packages/docutils/[rst, rstidx, rstgen, dochelpers], - json, xmltree, trees, types, - typesrenderer, astalgo, lineinfos, intsets, - pathutils, tables, nimpaths, renderverbatim, osproc, packages + trees, types, + typesrenderer, astalgo, lineinfos, + pathutils, nimpaths, renderverbatim, packages import packages/docutils/rstast except FileIndex, TLineInfo -from uri import encodeUrl +import std/[os, strutils, strtabs, algorithm, json, osproc, tables, intsets, xmltree, sequtils] +from std/uri import encodeUrl from nodejs import findNodeJs when defined(nimPreviewSlimSystem): diff --git a/compiler/errorhandling.nim b/compiler/errorhandling.nim index a8361105ececd..2ad0f8806424a 100644 --- a/compiler/errorhandling.nim +++ b/compiler/errorhandling.nim @@ -10,7 +10,8 @@ ## This module contains support code for new-styled error ## handling via an `nkError` node kind. -import ast, renderer, options, strutils, types +import ast, renderer, options, types +import std/strutils when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 3f386f76ecce6..ab26ca1bbeabd 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -9,10 +9,12 @@ ## This file implements the FFI part of the evaluator for Nim code. -import ast, types, options, tables, dynlib, msgs, lineinfos -from os import getAppFilename +import ast, types, options, msgs, lineinfos +from std/os import getAppFilename import libffi/libffi +import std/[tables, dynlib] + when defined(windows): const libcDll = "msvcrt.dll" elif defined(linux): diff --git a/compiler/evaltempl.nim b/compiler/evaltempl.nim index a5d888858f3af..5ebb4fa553403 100644 --- a/compiler/evaltempl.nim +++ b/compiler/evaltempl.nim @@ -9,8 +9,8 @@ ## Template evaluation engine. Now hygienic. -import - strutils, options, ast, astalgo, msgs, renderer, lineinfos, idents, trees +import options, ast, astalgo, msgs, renderer, lineinfos, idents, trees +import std/strutils type TemplCtx = object diff --git a/compiler/filter_tmpl.nim b/compiler/filter_tmpl.nim index d04388b96a0c7..921a94b314363 100644 --- a/compiler/filter_tmpl.nim +++ b/compiler/filter_tmpl.nim @@ -10,9 +10,11 @@ # This module implements Nim's standard template filter. import - llstream, strutils, ast, msgs, options, + llstream, ast, msgs, options, filters, lineinfos, pathutils +import std/strutils + type TParseState = enum psDirective, psTempl diff --git a/compiler/filters.nim b/compiler/filters.nim index 8d8af6b1c87ca..3cd56e3be5dd3 100644 --- a/compiler/filters.nim +++ b/compiler/filters.nim @@ -10,9 +10,11 @@ # This module implements Nim's simple filters and helpers for filters. import - llstream, idents, strutils, ast, msgs, options, + llstream, idents, ast, msgs, options, renderer, pathutils +import std/strutils + proc invalidPragma(conf: ConfigRef; n: PNode) = localError(conf, n.info, "'$1' not allowed here" % renderTree(n, {renderNoComments})) diff --git a/compiler/gorgeimpl.nim b/compiler/gorgeimpl.nim index fb0fafc985302..da911c84cf513 100644 --- a/compiler/gorgeimpl.nim +++ b/compiler/gorgeimpl.nim @@ -9,8 +9,9 @@ ## Module that implements ``gorge`` for the compiler. -import msgs, os, osproc, streams, options, - lineinfos, pathutils +import msgs, options, lineinfos, pathutils + +import std/[os, osproc, streams] when defined(nimPreviewSlimSystem): import std/syncio diff --git a/compiler/guards.nim b/compiler/guards.nim index 1366a2382c439..21c7cd045bfa4 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -870,7 +870,7 @@ template isSub(x): untyped = x.getMagic in someSub template isVal(x): untyped = x.kind in {nkCharLit..nkUInt64Lit} template isIntVal(x, y): untyped = x.intVal == y -import macros +import std/macros macro `=~`(x: PNode, pat: untyped): bool = proc m(x, pat, conds: NimNode) = diff --git a/compiler/ic/bitabs.nim b/compiler/ic/bitabs.nim index edbaeb240ea65..65b1e5a0ed076 100644 --- a/compiler/ic/bitabs.nim +++ b/compiler/ic/bitabs.nim @@ -1,7 +1,8 @@ ## A BiTable is a table that can be seen as an optimized pair ## of `(Table[LitId, Val], Table[Val, LitId])`. -import hashes, rodfiles +import std/hashes +import rodfiles when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/ic/cbackend.nim b/compiler/ic/cbackend.nim index a1922c812d328..97462f0955f6e 100644 --- a/compiler/ic/cbackend.nim +++ b/compiler/ic/cbackend.nim @@ -18,7 +18,7 @@ ## also doing cross-module dependency tracking and DCE that we don't need ## anymore. DCE is now done as prepass over the entire packed module graph. -import std/packedsets, algorithm, tables +import std/[packedsets, algorithm, tables] when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim index 8b0a3105438ad..4d02822b2e30d 100644 --- a/compiler/ic/ic.nim +++ b/compiler/ic/ic.nim @@ -7,12 +7,12 @@ # distribution, for details about the copyright. # -import hashes, tables, intsets +import std/[hashes, tables, intsets] import packed_ast, bitabs, rodfiles import ".." / [ast, idents, lineinfos, msgs, ropes, options, pathutils, condsyms, packages, modulepaths] #import ".." / [renderer, astalgo] -from os import removeFile, isAbsolute +from std/os import removeFile, isAbsolute import ../../dist/checksums/src/checksums/sha1 diff --git a/compiler/ic/integrity.nim b/compiler/ic/integrity.nim index d341fd6536389..ed87ae59db60a 100644 --- a/compiler/ic/integrity.nim +++ b/compiler/ic/integrity.nim @@ -10,7 +10,7 @@ ## Integrity checking for a set of .rod files. ## The set must cover a complete Nim project. -import sets +import std/sets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/ic/navigator.nim b/compiler/ic/navigator.nim index ab49b3b7a18d2..aea5e12e7f76b 100644 --- a/compiler/ic/navigator.nim +++ b/compiler/ic/navigator.nim @@ -11,9 +11,9 @@ ## IDE-like features. It uses the set of .rod files to accomplish ## its task. The set must cover a complete Nim project. -import sets +import std/sets -from os import nil +from std/os import nil from std/private/miscdollars import toLocation when defined(nimPreviewSlimSystem): diff --git a/compiler/ic/packed_ast.nim b/compiler/ic/packed_ast.nim index b87348c5a0497..e7443c3c711e6 100644 --- a/compiler/ic/packed_ast.nim +++ b/compiler/ic/packed_ast.nim @@ -12,7 +12,7 @@ ## use this representation directly in all the transformations, ## it is superior. -import hashes, tables, strtabs +import std/[hashes, tables, strtabs] import bitabs import ".." / [ast, options] diff --git a/compiler/ic/replayer.nim b/compiler/ic/replayer.nim index 8eee0b3d89dad..3bbe4fa310476 100644 --- a/compiler/ic/replayer.nim +++ b/compiler/ic/replayer.nim @@ -14,7 +14,7 @@ import ".." / [ast, modulegraphs, trees, extccomp, btrees, msgs, lineinfos, pathutils, options, cgmeth] -import tables +import std/tables when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/ic/rodfiles.nim b/compiler/ic/rodfiles.nim index 3505bfdfb8617..db520527bce6d 100644 --- a/compiler/ic/rodfiles.nim +++ b/compiler/ic/rodfiles.nim @@ -14,7 +14,7 @@ ## compiler works and less a storage format, you're probably looking for ## the `ic` or `packed_ast` modules to understand the logical format. -from typetraits import supportsCopyMem +from std/typetraits import supportsCopyMem when defined(nimPreviewSlimSystem): import std/[syncio, assertions] diff --git a/compiler/idents.nim b/compiler/idents.nim index f36ce09f3c48a..34177e76defdf 100644 --- a/compiler/idents.nim +++ b/compiler/idents.nim @@ -11,8 +11,8 @@ # An identifier is a shared immutable string that can be compared by its # id. This module is essential for the compiler's performance. -import - hashes, wordrecg +import wordrecg +import std/hashes when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/importer.nim b/compiler/importer.nim index dcdd0bb49e430..ff1f9f63ef049 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -10,11 +10,12 @@ ## This module implements the symbol importing mechanism. import - intsets, ast, astalgo, msgs, options, idents, lookups, - semdata, modulepaths, sigmatch, lineinfos, sets, - modulegraphs, wordrecg, tables -from strutils import `%` -from sequtils import addUnique + ast, astalgo, msgs, options, idents, lookups, + semdata, modulepaths, sigmatch, lineinfos, + modulegraphs, wordrecg +from std/strutils import `%`, startsWith +from std/sequtils import addUnique +import std/[sets, tables, intsets] when defined(nimPreviewSlimSystem): import std/assertions @@ -301,6 +302,10 @@ proc myImportModule(c: PContext, n: var PNode, importStmtResult: PNode): PSym = var prefix = "" if realModule.constraint != nil: prefix = realModule.constraint.strVal & "; " message(c.config, n.info, warnDeprecated, prefix & realModule.name.s & " is deprecated") + let moduleName = getModuleName(c.config, n) + if belongsToStdlib(c.graph, result) and not startsWith(moduleName, stdPrefix) and + not startsWith(moduleName, "system/") and not startsWith(moduleName, "packages/"): + message(c.config, n.info, warnStdPrefix, realModule.name.s) suggestSym(c.graph, n.info, result, c.graph.usageSym, false) importStmtResult.add newSymNode(result, n.info) #newStrNode(toFullPath(c.config, f), n.info) diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index a5ec6c21a691e..6b3fdeca5aaca 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -14,11 +14,13 @@ ## See doc/destructors.rst for a spec of the implemented rewrite rules import - intsets, strtabs, ast, astalgo, msgs, renderer, magicsys, types, idents, - strutils, options, lowerings, tables, modulegraphs, + ast, astalgo, msgs, renderer, magicsys, types, idents, + options, lowerings, modulegraphs, lineinfos, parampatterns, sighashes, liftdestructors, optimizer, varpartitions, aliasanalysis, dfa, wordrecg +import std/[strtabs, tables, strutils, intsets] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/int128.nim b/compiler/int128.nim index 18e751f989644..ca06a3a9743b9 100644 --- a/compiler/int128.nim +++ b/compiler/int128.nim @@ -3,7 +3,7 @@ ## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This ## type is for that purpose. -from math import trunc +from std/math import trunc when defined(nimPreviewSlimSystem): import std/assertions @@ -358,7 +358,7 @@ proc `*`*(lhs, rhs: Int128): Int128 = proc `*=`*(a: var Int128, b: Int128) = a = a * b -import bitops +import std/bitops proc fastLog2*(a: Int128): int = result = 0 diff --git a/compiler/isolation_check.nim b/compiler/isolation_check.nim index 5fd1b8d51b5cb..b11d64a6b9dd3 100644 --- a/compiler/isolation_check.nim +++ b/compiler/isolation_check.nim @@ -11,7 +11,9 @@ ## https://github.com/nim-lang/RFCs/issues/244 for more details. import - ast, types, renderer, intsets + ast, types, renderer + +import std/intsets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 6b57c097f3b7c..74edb469485f9 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -37,8 +37,8 @@ import import pipelineutils -import json, sets, math, tables, intsets -import strutils except addf +import std/[json, sets, math, tables, intsets] +import std/strutils except addf when defined(nimPreviewSlimSystem): import std/[assertions, syncio] diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index fdba7ba3d1478..248effcaf8ff1 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -10,10 +10,12 @@ # This file implements lambda lifting for the transformator. import - intsets, strutils, options, ast, astalgo, msgs, - idents, renderer, types, magicsys, lowerings, tables, modulegraphs, lineinfos, + options, ast, astalgo, msgs, + idents, renderer, types, magicsys, lowerings, modulegraphs, lineinfos, transf, liftdestructors, typeallowed +import std/[strutils, tables, intsets] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 93a5f80406f98..5aed196362473 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -16,8 +16,10 @@ # DOS or Macintosh text files, even when it is not the native format. import - hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream, - wordrecg, lineinfos, pathutils, parseutils + options, msgs, platform, idents, nimlexbase, llstream, + wordrecg, lineinfos, pathutils + +import std/[hashes, parseutils, strutils] when defined(nimPreviewSlimSystem): import std/[assertions, formatfloat] diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index a73df046ef8d8..ea0d6e6f8b018 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -11,8 +11,9 @@ ## (`=sink`, `=copy`, `=destroy`, `=deepCopy`, `=wasMoved`, `=dup`). import modulegraphs, lineinfos, idents, ast, renderer, semdata, - sighashes, lowerings, options, types, msgs, magicsys, tables, ccgutils + sighashes, lowerings, options, types, msgs, magicsys, ccgutils +import std/tables from trees import isCaseObj when defined(nimPreviewSlimSystem): diff --git a/compiler/liftlocals.nim b/compiler/liftlocals.nim index 58c6189d40985..aaa0707e053dd 100644 --- a/compiler/liftlocals.nim +++ b/compiler/liftlocals.nim @@ -10,9 +10,11 @@ ## This module implements the '.liftLocals' pragma. import - strutils, options, ast, msgs, + options, ast, msgs, idents, renderer, types, lowerings, lineinfos +import std/strutils + from pragmas import getPragmaVal from wordrecg import wLiftLocals diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim index 544c5295c7bc5..ef3222288a22a 100644 --- a/compiler/lineinfos.nim +++ b/compiler/lineinfos.nim @@ -10,7 +10,8 @@ ## This module contains the `TMsgKind` enum as well as the ## `TLineInfo` object. -import ropes, tables, pathutils, hashes +import ropes, pathutils +import std/[hashes, tables] const explanationsBaseUrl* = "https://nim-lang.github.io/Nim" @@ -91,6 +92,7 @@ type warnStmtListLambda = "StmtListLambda", warnBareExcept = "BareExcept", warnImplicitDefaultValue = "ImplicitDefaultValue", + warnStdPrefix = "StdPrefix" warnUser = "User", # hints hintSuccess = "Success", hintSuccessX = "SuccessX", @@ -194,6 +196,7 @@ const warnStmtListLambda: "statement list expression assumed to be anonymous proc; this is deprecated, use `do (): ...` or `proc () = ...` instead", warnBareExcept: "$1", warnImplicitDefaultValue: "$1", + warnStdPrefix: "$1 needs the 'std' prefix", warnUser: "$1", hintSuccess: "operation successful: $#", # keep in sync with `testament.isSuccess` @@ -249,7 +252,7 @@ type proc computeNotesVerbosity(): array[0..3, TNoteKinds] = result = default(array[0..3, TNoteKinds]) - result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept} + result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept, warnStdPrefix} result[2] = result[3] - {hintStackTrace, hintExtendedContext, hintDeclaredLoc, hintProcessingStmt} result[1] = result[2] - {warnProveField, warnProveIndex, warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd, diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 2bdf3a1e07259..1a60de7e532b1 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -14,8 +14,10 @@ when defined(nimPreviewSlimSystem): import std/assertions import - intsets, ast, astalgo, idents, semdata, types, msgs, options, - renderer, lineinfos, modulegraphs, astmsgs, sets, wordrecg + ast, astalgo, idents, semdata, types, msgs, options, + renderer, lineinfos, modulegraphs, astmsgs, wordrecg + +import std/[intsets, sets] proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) @@ -464,7 +466,7 @@ proc mergeShadowScope*(c: PContext) = c.addInterfaceDecl(sym) -import std/editdistance, heapqueue +import std/[editdistance, heapqueue] type SpellCandidate = object dist: int diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim index c450af50f325e..325c0adb1d5f8 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modulegraphs.nim @@ -11,7 +11,7 @@ ## represents a complete Nim project. Single modules can either be kept in RAM ## or stored in a rod-file. -import intsets, tables, hashes +import std/[intsets, tables, hashes] import ../dist/checksums/src/checksums/md5 import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils, packages import ic / [packed_ast, ic] diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim index e80ea3fa66329..c29ed6793c2e9 100644 --- a/compiler/modulepaths.nim +++ b/compiler/modulepaths.nim @@ -7,9 +7,11 @@ # distribution, for details about the copyright. # -import ast, renderer, strutils, msgs, options, idents, os, lineinfos, +import ast, renderer, msgs, options, idents, lineinfos, pathutils +import std/[strutils, os] + proc getModuleName*(conf: ConfigRef; n: PNode): string = # This returns a short relative module name without the nim extension # e.g. like "system", "importer" or "somepath/module" diff --git a/compiler/nilcheck.nim b/compiler/nilcheck.nim index 96e0967702cb2..1713a888f80fc 100644 --- a/compiler/nilcheck.nim +++ b/compiler/nilcheck.nim @@ -7,8 +7,8 @@ # distribution, for details about the copyright. # -import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes -import sequtils, strutils, sets +import ast, renderer, msgs, options, lineinfos, idents, treetab +import std/[intsets, tables, sequtils, strutils, sets, strformat, hashes] when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/nim.cfg b/compiler/nim.cfg index 04005368512c1..e4425065e704c 100644 --- a/compiler/nim.cfg +++ b/compiler/nim.cfg @@ -41,6 +41,7 @@ define:useStdoutAsStdmsg @end @if nimHasWarnBareExcept: + warning[BareExcept]:on warningAserror[BareExcept]:on @end @@ -51,3 +52,7 @@ define:useStdoutAsStdmsg warningAsError[ProveInit]:on @end +@if nimHasWarnStdPrefix: + warning[StdPrefix]:on + warningAsError[StdPrefix]:on +@end diff --git a/compiler/nim.nim b/compiler/nim.nim index 7ec6f3e77d4f7..184303f8eab7a 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -28,7 +28,7 @@ import commands, options, msgs, extccomp, main, idents, lineinfos, cmdlinehelper, pathutils, modulegraphs -from browsers import openDefaultBrowser +from std/browsers import openDefaultBrowser from nodejs import findNodeJs when hasTinyCBackend: diff --git a/compiler/nimblecmd.nim b/compiler/nimblecmd.nim index 97a66f1cd99f8..4b6e22bc9d775 100644 --- a/compiler/nimblecmd.nim +++ b/compiler/nimblecmd.nim @@ -9,8 +9,9 @@ ## Implements some helper procs for Nimble (Nim's package manager) support. -import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils, - tables +import options, msgs, lineinfos, pathutils + +import std/[parseutils, strutils, os, tables, sequtils] when defined(nimPreviewSlimSystem): import std/[syncio, assertions] diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index 78215d281a664..3a811a106168f 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -10,8 +10,10 @@ # This module handles the reading of the config file. import - llstream, commands, os, strutils, msgs, lexer, ast, - options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig + llstream, commands, msgs, lexer, ast, + options, idents, wordrecg, lineinfos, pathutils, scriptconfig + +import std/[os, strutils, strtabs] when defined(nimPreviewSlimSystem): import std/syncio diff --git a/compiler/nimlexbase.nim b/compiler/nimlexbase.nim index 3bc9af9c905a1..6708b57f805d1 100644 --- a/compiler/nimlexbase.nim +++ b/compiler/nimlexbase.nim @@ -12,8 +12,9 @@ # handling that exists! Only at line endings checks are necessary # if the buffer needs refilling. -import - llstream, strutils +import llstream + +import std/strutils when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/nimpaths.nim b/compiler/nimpaths.nim index 3756f956b57c0..0a66c3c1fdfb3 100644 --- a/compiler/nimpaths.nim +++ b/compiler/nimpaths.nim @@ -17,7 +17,7 @@ interpolation variables: Unstable API ]## -import os, strutils +import std/[os, strutils] when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/nir/nir.nim b/compiler/nir/nir.nim index c4fb5322d5a03..1efa6719a11ac 100644 --- a/compiler/nir/nir.nim +++ b/compiler/nir/nir.nim @@ -10,7 +10,7 @@ ## Nim Intermediate Representation, designed to capture all of Nim's semantics without losing too much ## precious information. Can easily be translated into C. And to JavaScript, hopefully. -from os import addFileExt, `/`, createDir +from std/os import addFileExt, `/`, createDir import std / assertions import ".." / [ast, modulegraphs, renderer, transf, options, msgs, lineinfos] diff --git a/compiler/nir/stringcases.nim b/compiler/nir/stringcases.nim index 9417d613d0a9a..afdf8fda4f4a9 100644 --- a/compiler/nir/stringcases.nim +++ b/compiler/nir/stringcases.nim @@ -49,7 +49,7 @@ afterCase: ... # Every string of length > position for which s[position] <= char is in one # set else it is in the other set. -from sequtils import addUnique +from std/sequtils import addUnique type Key = (LitId, LabelId) diff --git a/compiler/nodejs.nim b/compiler/nodejs.nim index c1feb196a070b..9753e1c99127c 100644 --- a/compiler/nodejs.nim +++ b/compiler/nodejs.nim @@ -1,4 +1,4 @@ -import os +import std/os proc findNodeJs*(): string {.inline.} = ## Find NodeJS executable and return it as a string. diff --git a/compiler/optimizer.nim b/compiler/optimizer.nim index 7e46f3d0b5f41..d39d598ba8caa 100644 --- a/compiler/optimizer.nim +++ b/compiler/optimizer.nim @@ -12,11 +12,11 @@ ## - recognize "all paths lead to 'wasMoved(x)'" import - ast, renderer, idents, intsets + ast, renderer, idents from trees import exprStructuralEquivalent -import std/strutils +import std/[strutils, intsets] const nfMarkForDeletion = nfNone # faster than a lookup table diff --git a/compiler/options.nim b/compiler/options.nim index b36f72693adfa..f2d93a9b3a096 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -8,11 +8,12 @@ # import - os, strutils, strtabs, sets, lineinfos, platform, - prefixmatches, pathutils, nimpaths, tables + lineinfos, platform, + prefixmatches, pathutils, nimpaths -from terminal import isatty -from times import utc, fromUnix, local, getTime, format, DateTime +import std/[tables, os, strutils, strtabs, sets] +from std/terminal import isatty +from std/times import utc, fromUnix, local, getTime, format, DateTime from std/private/globs import nativeToUnixPath when defined(nimPreviewSlimSystem): @@ -890,7 +891,7 @@ const stdlibDirs* = [ const pkgPrefix = "pkg/" - stdPrefix = "std/" + stdPrefix* = "std/" proc getRelativePathFromConfigPath*(conf: ConfigRef; f: AbsoluteFile, isTitle = false): RelativeFile = result = RelativeFile("") diff --git a/compiler/parampatterns.nim b/compiler/parampatterns.nim index 98f5099d688ee..84c2980c465cd 100644 --- a/compiler/parampatterns.nim +++ b/compiler/parampatterns.nim @@ -10,9 +10,11 @@ ## This module implements the pattern matching features for term rewriting ## macro support. -import strutils, ast, types, msgs, idents, renderer, wordrecg, trees, +import ast, types, msgs, idents, renderer, wordrecg, trees, options +import std/strutils + # we precompile the pattern here for efficiency into some internal # stack based VM :-) Why? Because it's fun; I did no benchmarks to see if that # actually improves performance. diff --git a/compiler/parser.nim b/compiler/parser.nim index 7caeca95e15cf..20f6868cd2c8b 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -49,9 +49,11 @@ when isMainModule or defined(nimTestGrammar): checkGrammarFile() import - llstream, lexer, idents, strutils, ast, msgs, options, lineinfos, + llstream, lexer, idents, ast, msgs, options, lineinfos, pathutils +import std/strutils + when defined(nimpretty): import layouter diff --git a/compiler/pathutils.nim b/compiler/pathutils.nim index d9779deabdaef..5f6212bb22219 100644 --- a/compiler/pathutils.nim +++ b/compiler/pathutils.nim @@ -10,7 +10,7 @@ ## Path handling utilities for Nim. Strictly typed code in order ## to avoid the never ending time sink in getting path handling right. -import os, pathnorm, strutils +import std/[os, pathnorm, strutils] when defined(nimPreviewSlimSystem): import std/[syncio, assertions] diff --git a/compiler/platform.nim b/compiler/platform.nim index 613ebf7ecd034..03d0cc461c28d 100644 --- a/compiler/platform.nim +++ b/compiler/platform.nim @@ -14,7 +14,7 @@ # Feel free to test for your excentric platform! import - strutils + std/strutils when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index e6867aa5d2860..53b4f53a8a878 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -10,10 +10,12 @@ # This module implements semantic checking for pragmas import - os, condsyms, ast, astalgo, idents, semdata, msgs, renderer, - wordrecg, ropes, options, strutils, extccomp, math, magicsys, trees, + condsyms, ast, astalgo, idents, semdata, msgs, renderer, + wordrecg, ropes, options, extccomp, magicsys, trees, types, lookups, lineinfos, pathutils, linter, modulepaths +import std/[os, math, strutils] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/prefixmatches.nim b/compiler/prefixmatches.nim index 71ae9a844c963..bfbe3d888b214 100644 --- a/compiler/prefixmatches.nim +++ b/compiler/prefixmatches.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # -from strutils import toLowerAscii +from std/strutils import toLowerAscii type PrefixMatch* {.pure.} = enum diff --git a/compiler/procfind.nim b/compiler/procfind.nim index 0bdb3dae6d5b0..468879ba2ddba 100644 --- a/compiler/procfind.nim +++ b/compiler/procfind.nim @@ -11,7 +11,9 @@ # This is needed for proper handling of forward declarations. import - ast, astalgo, msgs, semdata, types, trees, strutils, lookups + ast, astalgo, msgs, semdata, types, trees, lookups + +import std/strutils proc equalGenericParams(procA, procB: PNode): bool = if procA.len != procB.len: return false diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 3a6d0ae6502eb..43ac91e92e68c 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -14,7 +14,9 @@ {.used.} import - lexer, options, idents, strutils, ast, msgs, lineinfos, wordrecg + lexer, options, idents, ast, msgs, lineinfos, wordrecg + +import std/[strutils] when defined(nimPreviewSlimSystem): import std/[syncio, assertions, formatfloat] diff --git a/compiler/renderverbatim.nim b/compiler/renderverbatim.nim index 00d546198aaba..c12595156a16f 100644 --- a/compiler/renderverbatim.nim +++ b/compiler/renderverbatim.nim @@ -1,4 +1,4 @@ -import strutils +import std/strutils import ast, options, msgs diff --git a/compiler/reorder.nim b/compiler/reorder.nim index aedebc7d420a4..f5ec0b2d32937 100644 --- a/compiler/reorder.nim +++ b/compiler/reorder.nim @@ -1,9 +1,11 @@ import - intsets, ast, idents, algorithm, renderer, strutils, + ast, idents, renderer, msgs, modulegraphs, syntaxes, options, modulepaths, lineinfos +import std/[algorithm, strutils, intsets] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim index ed51268598074..e1b56800c25d5 100644 --- a/compiler/rodutils.nim +++ b/compiler/rodutils.nim @@ -8,7 +8,7 @@ # ## Serialization utilities for the compiler. -import strutils, math +import std/[strutils, math] when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index c89767296b268..e3d2bcd45841e 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -13,14 +13,16 @@ import ast, modules, idents, condsyms, options, llstream, vm, vmdef, commands, - os, times, osproc, wordrecg, strtabs, modulegraphs, + wordrecg, modulegraphs, pathutils, pipelines when defined(nimPreviewSlimSystem): import std/[syncio, assertions] +import std/[strtabs, os, times, osproc] + # we support 'cmpIgnoreStyle' natively for efficiency: -from strutils import cmpIgnoreStyle, contains +from std/strutils import cmpIgnoreStyle, contains proc listDirs(a: VmArgs, filter: set[PathComponent]) = let dir = getString(a, 0) diff --git a/compiler/sem.nim b/compiler/sem.nim index 55c6a427f5194..1908b5a0de728 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -9,19 +9,18 @@ # This module implements the semantic checking pass. -import tables - import - ast, strutils, options, astalgo, trees, - wordrecg, ropes, msgs, idents, renderer, types, platform, math, + ast, options, astalgo, trees, + wordrecg, ropes, msgs, idents, renderer, types, platform, magicsys, nversion, nimsets, semfold, modulepaths, importer, procfind, lookups, pragmas, semdata, semtypinst, sigmatch, - intsets, transf, vmdef, vm, aliases, cgmeth, lambdalifting, + transf, vmdef, vm, aliases, cgmeth, lambdalifting, evaltempl, patterns, parampatterns, sempass2, linter, semmacrosanity, - lowerings, plugins/active, lineinfos, strtabs, int128, + lowerings, plugins/active, lineinfos, int128, isolation_check, typeallowed, modulegraphs, enumtostr, concepts, astmsgs, extccomp +import std/[strtabs, math, tables, intsets, strutils] when not defined(leanCompiler): import spawn diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 32e557f1860f4..91b15d5c77298 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -9,14 +9,14 @@ ## This module contains the data structures for the semantic checking phase. -import tables +import std/[tables, intsets, sets] when defined(nimPreviewSlimSystem): import std/assertions import - intsets, options, ast, astalgo, msgs, idents, renderer, - magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils + options, ast, astalgo, msgs, idents, renderer, + magicsys, vmdef, modulegraphs, lineinfos, pathutils import ic / ic diff --git a/compiler/semfold.nim b/compiler/semfold.nim index f1a1c8a82f662..e722f932fd20b 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -11,10 +11,11 @@ # and evaluation phase import - strutils, options, ast, trees, nimsets, - platform, math, msgs, idents, renderer, types, - commands, magicsys, modulegraphs, strtabs, lineinfos, wordrecg + options, ast, trees, nimsets, + platform, msgs, idents, renderer, types, + commands, magicsys, modulegraphs, lineinfos, wordrecg +import std/[strutils, math, strtabs] from system/memory import nimCStrLen when defined(nimPreviewSlimSystem): diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index ebc8be0c332d6..33278af2fbc33 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -11,7 +11,7 @@ # included from sem.nim -from sugar import dup +from std/sugar import dup type ObjConstrContext = object diff --git a/compiler/semparallel.nim b/compiler/semparallel.nim index 41ec3e4809af3..af77a197273f5 100644 --- a/compiler/semparallel.nim +++ b/compiler/semparallel.nim @@ -26,7 +26,7 @@ import renderer, types, modulegraphs, options, spawn, lineinfos from trees import getMagic, getRoot -from strutils import `%` +from std/strutils import `%` discard """ diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 423cfbb3419af..54f46fa73c2c9 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -8,11 +8,13 @@ # import - intsets, ast, astalgo, msgs, renderer, magicsys, types, idents, trees, - wordrecg, strutils, options, guards, lineinfos, semfold, semdata, - modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, tables, + ast, astalgo, msgs, renderer, magicsys, types, idents, trees, + wordrecg, options, guards, lineinfos, semfold, semdata, + modulegraphs, varpartitions, typeallowed, nilcheck, errorhandling, semstrictfuncs +import std/[tables, intsets, strutils] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim index dbf16df3d70d3..2f1a72fd65fba 100644 --- a/compiler/sighashes.nim +++ b/compiler/sighashes.nim @@ -9,8 +9,9 @@ ## Computes hash values for routine (proc, method etc) signatures. -import ast, tables, ropes, modulegraphs, options, msgs, pathutils -from hashes import Hash +import ast, ropes, modulegraphs, options, msgs, pathutils +from std/hashes import Hash +import std/tables import types import ../dist/checksums/src/checksums/md5 diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 3867a67b70474..77f8de68bdfe3 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -11,10 +11,12 @@ ## the call to overloaded procs, generic procs and operators. import - intsets, ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst, - magicsys, idents, lexer, options, parampatterns, strutils, trees, + ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst, + magicsys, idents, lexer, options, parampatterns, trees, linter, lineinfos, lowerings, modulegraphs, concepts +import std/[intsets, strutils] + when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 5554991bd7369..5714c6d211022 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -32,11 +32,13 @@ # included from sigmatch.nim -import algorithm, sets, prefixmatches, parseutils, tables +import prefixmatches from wordrecg import wDeprecated, wError, wAddr, wYield +import std/[algorithm, sets, parseutils, tables] + when defined(nimsuggest): - import tables, pathutils # importer + import std/tables, pathutils # importer const sep = '\t' diff --git a/compiler/syntaxes.nim b/compiler/syntaxes.nim index 1c8acf2a6420c..ef6b1da586936 100644 --- a/compiler/syntaxes.nim +++ b/compiler/syntaxes.nim @@ -10,9 +10,10 @@ ## Implements the dispatcher for the different parsers. import - strutils, llstream, ast, idents, lexer, options, msgs, parser, + llstream, ast, idents, lexer, options, msgs, parser, filters, filter_tmpl, renderer, lineinfos, pathutils +import std/strutils when defined(nimPreviewSlimSystem): import std/[syncio, assertions] diff --git a/compiler/treetab.nim b/compiler/treetab.nim index 92e04c13a6544..6685c4a8997c8 100644 --- a/compiler/treetab.nim +++ b/compiler/treetab.nim @@ -9,8 +9,9 @@ # Implements a table from trees to trees. Does structural equivalence checking. -import - hashes, ast, astalgo, types +import ast, astalgo, types + +import std/hashes when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/typeallowed.nim b/compiler/typeallowed.nim index fe0d7b8855a67..d0df66f1851f5 100644 --- a/compiler/typeallowed.nim +++ b/compiler/typeallowed.nim @@ -10,8 +10,8 @@ ## This module contains 'typeAllowed' and friends which check ## for invalid types like `openArray[var int]`. -import - intsets, ast, renderer, options, semdata, types +import ast, renderer, options, semdata, types +import std/intsets when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/types.nim b/compiler/types.nim index cdb3067c307f1..31563b71f7e43 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -10,9 +10,11 @@ # this module contains routines for accessing and iterating over types import - intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options, + ast, astalgo, trees, msgs, platform, renderer, options, lineinfos, int128, modulegraphs, astmsgs +import std/[intsets, strutils] + when defined(nimPreviewSlimSystem): import std/[assertions, formatfloat] diff --git a/compiler/typesrenderer.nim b/compiler/typesrenderer.nim index ff8ec8d5767f4..72bcddb059727 100644 --- a/compiler/typesrenderer.nim +++ b/compiler/typesrenderer.nim @@ -7,7 +7,8 @@ # distribution, for details about the copyright. # -import renderer, strutils, ast, types +import renderer, ast, types +import std/strutils when defined(nimPreviewSlimSystem): import std/assertions diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index a47d034c7a46b..18f9fe5caddf4 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -7,9 +7,11 @@ # distribution, for details about the copyright. # -import ast, types, msgs, os, options, idents, lineinfos +import ast, types, msgs, options, idents, lineinfos from pathutils import AbsoluteFile +import std/os + when defined(nimPreviewSlimSystem): import std/syncio diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index efcd0ec35b04b..53b2974bab738 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -26,14 +26,14 @@ # solves the opcLdConst vs opcAsgnConst issue. Of course whether we need # this copy depends on the involved types. -import tables +import std/[tables, intsets, strutils] when defined(nimPreviewSlimSystem): import std/assertions import - strutils, ast, types, msgs, renderer, vmdef, trees, - intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs + ast, types, msgs, renderer, vmdef, trees, + magicsys, options, lowerings, lineinfos, transf, astmsgs from modulegraphs import getBody diff --git a/compiler/vmmarshal.nim b/compiler/vmmarshal.nim index e1e69f6cc503f..8ce1133691ef0 100644 --- a/compiler/vmmarshal.nim +++ b/compiler/vmmarshal.nim @@ -9,9 +9,11 @@ ## Implements marshaling for the VM. -import streams, json, intsets, tables, ast, astalgo, idents, types, msgs, +import ast, astalgo, idents, types, msgs, options, lineinfos +import std/[streams, json, intsets, tables] + when defined(nimPreviewSlimSystem): import std/[assertions, formatfloat] diff --git a/compiler/vmprofiler.nim b/compiler/vmprofiler.nim index edbd71813a4fe..3f0db84bddb5c 100644 --- a/compiler/vmprofiler.nim +++ b/compiler/vmprofiler.nim @@ -1,7 +1,7 @@ -import - options, vmdef, times, lineinfos, strutils, tables, - msgs +import options, vmdef, lineinfos, msgs + +import std/[times, strutils, tables] proc enter*(prof: var Profiler, c: PCtx, tos: PStackFrame) {.inline.} = if optProfileVM in c.config.globalOptions: diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index aa25f7fd1aa70..55a8921af909b 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -145,6 +145,6 @@ const from std/enumutils import genEnumCaseStmt -from strutils import normalize +from std/strutils import normalize proc findStr*[T: enum](a, b: static[T], s: string, default: T): T = genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)