diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..90e05c40d0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/bisects.yml b/.github/workflows/bisects.yml index d3fce02516..ef6e160a06 100644 --- a/.github/workflows/bisects.yml +++ b/.github/workflows/bisects.yml @@ -15,7 +15,7 @@ jobs: name: ${{ matrix.platform }}-bisects runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Install OpenSSL (Windows) if: | diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 4cf7c7a837..74dd234a28 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -53,7 +53,7 @@ jobs: steps: - name: 'Checkout' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 diff --git a/.github/workflows/ci_packages.yml b/.github/workflows/ci_packages.yml index afd8d0696c..51ed2773b2 100644 --- a/.github/workflows/ci_packages.yml +++ b/.github/workflows/ci_packages.yml @@ -33,7 +33,7 @@ jobs: NIM_TESTAMENT_BATCH: ${{ matrix.batch }} steps: - name: 'Checkout' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index 39fae32fea..d38a10d364 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: 'Checkout' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 2 @@ -60,7 +60,7 @@ jobs: run: nim c -r -d:release ci/action.nim - name: 'Comment' - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | const fs = require('fs'); diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0c5a533e1d..b918b21050 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@v10 with: days-before-pr-stale: 365 days-before-pr-close: 30 diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index b290faec78..5f846c80ac 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -563,6 +563,26 @@ proc eraseVoidParams*(t: PType) = setLen t.n.sons, pos break +proc eraseTupleVoidFields*(t: PType) = + ## Remove void fields from a named tuple type, compacting both `t.n` + ## (the field symbol nodes) and `t.sonsImpl` (the child types). + if t.n == nil: return # anonymous tuple, nothing to compact + for i in 0..= RootsThreshold and mayRunCycleCollect(): + if roots.len >= rootsThreshold and mayRunCycleCollect(): + let nRoots = roots.len var j: GcEnv init j.traceStack collectCyclesBacon(j, 0) @@ -434,8 +435,11 @@ proc collectCycles() = elif rootsThreshold < high(int) div 4: rootsThreshold = (if rootsThreshold <= 0: defaultThreshold else: rootsThreshold) rootsThreshold = rootsThreshold div 2 +% rootsThreshold - # Cap growth so threshold doesn't grow without bound when we rarely free cycles - #rootsThreshold = min(rootsThreshold, defaultThreshold *% 16) + # Cost-aware: if this run was expensive (large graph), raise threshold more so we don't run again too soon + if j.touched > nRoots *% 4: + rootsThreshold = rootsThreshold div 2 +% rootsThreshold + rootsThreshold = min(rootsThreshold, defaultThreshold *% 16) + rootsThreshold = min(rootsThreshold, nRoots *% 2) when logOrc: cfprintf(cstderr, "[collectCycles] end; freed %ld new threshold %ld\n", j.freed, rootsThreshold) when defined(nimOrcStats): diff --git a/tests/tuples/ttuples_issues.nim b/tests/tuples/ttuples_issues.nim index 70defdfce9..0a640bfb76 100644 --- a/tests/tuples/ttuples_issues.nim +++ b/tests/tuples/ttuples_issues.nim @@ -131,3 +131,47 @@ static: main() mainProc() + + +block: + type + Tuple[N] = tuple + a: int + b: N + + TupleVoid = Tuple[void] + + var x: TupleVoid = (a: 1, ) + doAssert x.a == 1 + +block: + type W[N] = seq[tuple[b: N]] + var _: W[void] + +block: + type Tuple2[N] = tuple + a: int + b: N + c: int + + var y: Tuple2[void] = (a: 10, c: 20) + doAssert y.a == 10 + doAssert y.c == 20 + +block: + type Outer[N] = tuple + inner: tuple[x: int, y: N] + + var o: Outer[void] = (inner: (x: 3, )) + doAssert o.inner.x == 3 + +block: + type Tup[T] = tuple + a: int + b: T + + proc f[T](t: Tup[T]): int = + result = t.a + + var z: Tup[void] = (a: 7, ) + doAssert f(z) == 7