* fixes #20149; hintAsError/warningAsError ignores foreign packages
* add changelog
* fixes the test
* remove
* fixes tests again
* fix
* I'm careless
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
(cherry picked from commit 641381e3d4)
4.6 KiB
v1.8.x - yyyy-mm-dd
Changes affecting backward compatibility
-
addris now available for all addressable locations,unsafeAddris now deprecated and an alias foraddr. -
io,assertions,formatfloat, anddollars.`$`for objects are about to move out of thesystemmodule. You may instead importstd/syncio,std/assertions,std/formatfloatandstd/objectdollar. The-d:nimPreviewSlimSystemoption makes these imports required. -
The
gc:v2option is removed. -
The
mainmoduleandmoptions are removed. -
The
threads:onoption is now the default. -
Optional parameters in combination with
: bodysyntax (RFC #405) are now opt-in viaexperimental:flexibleOptionalParams.
Standard library additions and changes
-
Pointer to
cstringconversion now triggers a[PtrToCstringConv]warning. This warning will become an error in future versions! Use acastoperation likecast[cstring](x)instead. -
loggingwill default to flushing all log level messages. To get the legacy behaviour of only flushing Error and Fatal messages, use-d:nimV1LogFlushBehavior. -
Object fields now support default values, see https://nim-lang.github.io/Nim/manual.html#types-default-values-for-object-fields for details.
-
Redefining templates with the same signature was previously allowed to support certain macro code. To do this explicitly, the
{.redefine.}pragma has been added. Note that this is only for templates. Implicit redefinition of templates is now deprecated and will give an error in the future. -
Using an unnamed break in a block is deprecated. This warning will become an error in future versions! Use a named block with a named break instead.
-
Several Standard libraries are moved to nimble packages, use
nimbleto install them:std/punycode=>punycodestd/asyncftpclient=>asyncftpclientstd/smtp=>smtpstd/db_common=>db_connector/db_commonstd/db_sqlite=>db_connector/db_sqlitestd/db_mysql=>db_connector/db_mysqlstd/db_postgres=>db_connector/db_postgresstd/db_odbc=>db_connector/db_odbc
-
Previously, calls like
foo(a, b): ...orfoo(a, b) do: ...where the final argument offoohad typeproc ()were assumed by the compiler to meanfoo(a, b, proc () = ...). This behavior is now deprecated. Usefoo(a, b) do (): ...orfoo(a, b, proc () = ...)instead. -
If no exception or any exception deriving from Exception but not Defect or CatchableError given in except, a
warnBareExceptwarning will be triggered.
Standard library additions and changes
macros.parseExprandmacros.parseStmtnow accept an optional filename argument for more informative errors.- Module
colorsexpanded with missing colors from the CSS color standard. - Fixed
lists.SinglyLinkedListbeing broken after removing the last node (#19353).
Language changes
-
Pragma macros on type definitions can now return
nnkTypeSectionnodes as well asnnkTypeDef, allowing multiple type definitions to be injected in place of the original type definition.import macros macro multiply(amount: static int, s: untyped): untyped = let name = $s[0].basename result = newNimNode(nnkTypeSection) for i in 1 .. amount: result.add(newTree(nnkTypeDef, ident(name & $i), s[1], s[2])) type Foo = object Bar {.multiply: 3.} = object x, y, z: int Baz = object # becomes type Foo = object Bar1 = object x, y, z: int Bar2 = object x, y, z: int Bar3 = object x, y, z: int Baz = object -
Case statement macros are no longer experimental, meaning you no longer need to enable the experimental switch
caseStmtMacrosto use them.
Compiler changes
-
nimcan now compile version 1.4.0 as follows:nim c --lib:lib --stylecheck:off compiler/nim, without requiring-d:nimVersion140which is now a noop. -
--styleCheck,--hintAsErrorand--warningAsErrornow only applies to the current package.
Tool changes
-
The
gcswitch has been renamed tomm("memory management") in order to reflect the reality better. (Nim moved away from all techniques based on "tracing".) -
Nim now supports Nimble version 0.14 which added support for lock-files. This is done by a simple configuration change setting that you can do yourself too. In
$nim/config/nim.cfgreplacepkgsbypkgs2. -
There is a new switch
--nimMainPrefix:prefixto influence theNimMainthat the compiler produces. This is particularly useful for generating static libraries.