support useVersion:1.6 (#19601)

This commit is contained in:
flywind
2022-03-11 00:01:27 +08:00
committed by GitHub
parent 6773ffa63d
commit 4c76f9f152
6 changed files with 57 additions and 9 deletions

View File

@@ -1043,6 +1043,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
defineSymbol(conf.symbols, "NimMajor", "1")
defineSymbol(conf.symbols, "NimMinor", "2")
conf.globalOptions.incl optNimV12Emulation
of "1.6":
defineSymbol(conf.symbols, "NimMajor", "1")
defineSymbol(conf.symbols, "NimMinor", "6")
conf.globalOptions.incl optNimV16Emulation
else:
localError(conf, info, "unknown Nim version; currently supported values are: `1.0`, `1.2`")
# always be compatible with 1.x.100:

View File

@@ -96,6 +96,7 @@ type # please make sure we have under 32 options
optPanics # turn panics (sysFatal) into a process termination
optNimV1Emulation # emulate Nim v1.0
optNimV12Emulation # emulate Nim v1.2
optNimV16Emulation # emulate Nim v1.6
optSourcemap
optProfileVM # enable VM profiler
optEnableDeepCopy # ORC specific: enable 'deepcopy' for all types.

View File

@@ -161,7 +161,7 @@ Advanced options:
enable experimental language feature
--legacy:$2
enable obsolete/legacy language feature
--useVersion:1.0|1.2 emulate Nim version X of the Nim compiler, for testing
--useVersion:1.0|1.2|1.6 emulate Nim version X of the Nim compiler, for testing
--benchmarkVM:on|off turn benchmarking of VM code with cpuTime() on|off
--profileVM:on|off turn compile time VM profiler on|off
--sinkInference:on|off turn sink parameter inference on|off (default: on)

View File

@@ -5797,11 +5797,6 @@ However, this means that the method call syntax is not available for
tmp(12)
**Note**: The Nim compiler prior to version 1 was more lenient about this
requirement. Use the `--useVersion:0.19`:option: switch for a transition period.
Limitations of the method call syntax
-------------------------------------

View File

@@ -1,6 +1,5 @@
discard """
cmd: "nim c --useVersion:1.0 -r $file"
output: "1.0.100"
matrix: "--useVersion:1.0"
"""
{.warning[UnusedImport]: off.}
@@ -47,4 +46,4 @@ import std/[
]
echo NimVersion
doAssert NimVersion == "1.0.100"

View File

@@ -0,0 +1,49 @@
discard """
matrix: "--useVersion:1.6"
"""
{.warning[UnusedImport]: off.}
import std/[
# Core:
bitops, typetraits, lenientops, macros, volatile,
# Algorithms:
algorithm, sequtils,
# Collections:
critbits, deques, heapqueue, intsets, lists, options, sets,
sharedlist, tables,
# Strings:
editdistance, wordwrap, parseutils, ropes,
pegs, punycode, strformat, strmisc, strscans, strtabs,
strutils, unicode, unidecode,
# Generic operator system services:
os, streams,
# Math libraries:
complex, math, mersenne, random, rationals, stats, sums,
# Internet protocols:
httpcore, mimetypes, uri,
# Parsers:
htmlparser, json, lexbase, parsecfg, parsecsv, parsesql, parsexml,
# XML processing:
xmltree, xmlparser,
# Generators:
htmlgen,
# Hashing:
base64, hashes,
# Miscellaneous:
colors, sugar, varints,
]
doAssert NimVersion == "1.6.100"