Merge branch 'devel' into pr_openmp

This commit is contained in:
ringabout
2026-02-27 11:17:26 +08:00
committed by GitHub
8 changed files with 44 additions and 19 deletions

View File

@@ -37,10 +37,10 @@ jobs:
with:
fetch-depth: 2
- name: 'Install node.js 20.x'
uses: actions/setup-node@v4
- name: 'Install node.js'
uses: actions/setup-node@v6
with:
node-version: '20.x'
node-version: 24
- name: 'Install dependencies (Linux amd64)'
if: runner.os == 'Linux' && matrix.cpu == 'amd64'

View File

@@ -22,9 +22,9 @@ jobs:
fetch-depth: 2
- name: 'Install node.js'
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ''
node-version: 24
- name: 'Install dependencies (Linux amd64)'
if: runner.os == 'Linux' && matrix.cpu == 'amd64'

View File

@@ -1550,6 +1550,7 @@ proc track(tracked: PEffects, n: PNode) =
# Check for implicit range conversions
if n.kind == nkHiddenStdConv and (not tracked.isArrayIndexing) and
n[1].kind notin {nkCharLit..nkUInt64Lit, nkFloatLit..nkFloat128Lit} and
shouldWarnRangeConversion(tracked.config, n.info, n.typ, n[1].typ):
message(tracked.config, n.info, warnImplicitRangeConversion,
typeToString(n[1].typ) & " -> " & typeToString(n.typ))

View File

@@ -1203,7 +1203,15 @@ proc addImplicitGeneric(c: PContext; typeClass: PType, typId: PIdent;
# is this a bindOnce type class already present in the param list?
for i in 0..<genericParams.len:
if genericParams[i].sym.name.id == finalTypId.id:
return genericParams[i].typ
if typeClass.kind == tyStatic and genericParams[i].typ.kind != tyStatic:
# The base type (e.g. from `auto`) was already added as a generic param,
# but `static[auto]` requires upgrading it to a `tyStatic` wrapper so
# it is instantiated as a compile-time value (`skConst`).
genericParams[i].sym.linkTo(typeClass)
typeClass.incl tfImplicitTypeParam
return typeClass
else:
return genericParams[i].typ
let owner = if typeClass.sym != nil: typeClass.sym
else: getCurrOwner(c)

View File

@@ -1159,8 +1159,8 @@ In Nim new types can be defined within a `type` statement:
```nim test = "nim c $1"
type
biggestInt = int64 # biggest integer type that is available
biggestFloat = float64 # biggest float type that is available
BiggestInt = int64 # biggest integer type that is available
BiggestFloat = float64 # biggest float type that is available
```
Enumeration and object types may only be defined within a

View File

@@ -1,11 +0,0 @@
discard """
matrix: "--warning:systemRangeConversion --warningaserror:systemRangeConversion"
action: "reject"
errormsg: "implicit range conversion int literal(12) -> Natural"
"""
proc foo(x: Natural) =
discard
foo(12)

View File

@@ -0,0 +1,14 @@
discard """
matrix: "--warning:systemRangeConversion --warningaserror:systemRangeConversion"
"""
proc foo(x: range[0..100]) = discard
foo(12)
type
Float = range[0.0..100.0]
proc bar(x: Float) = discard
bar(12.0)

13
tests/vm/t21281.nim Normal file
View File

@@ -0,0 +1,13 @@
discard """
nimout: '''
3
3
'''
"""
proc f(x: static[auto]) = # doesn't work
static: echo x
proc g[T](x: static[T]) = # works
static: echo x
f(3)
g(3)