From 25ebc73d77bfc499755f80223ec8b1009d4c5066 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 26 Mar 2025 09:24:51 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"fixes=20#24800;=20Invalid=20C=20code?= =?UTF-8?q?=20generation=20with=20a=20method,=20case=20object=20in?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ddd83f8d8afc58a17bee2558d6a26b0b5c54a601. --- compiler/ccgexprs.nim | 3 +-- tests/tuples/ttuples_various.nim | 21 +-------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 6f69a45c5e..07d2ca453f 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2638,8 +2638,7 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc) = proc genConv(p: BProc, e: PNode, d: var TLoc) = let destType = e.typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink}) - let srcType = e[1].typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink}) - if sameBackendTypeIgnoreRange(destType, srcType): + if sameBackendTypeIgnoreRange(destType, e[1].typ): expr(p, e[1], d) else: genSomeCast(p, e, d) diff --git a/tests/tuples/ttuples_various.nim b/tests/tuples/ttuples_various.nim index 498d624edb..e392731d2f 100644 --- a/tests/tuples/ttuples_various.nim +++ b/tests/tuples/ttuples_various.nim @@ -1,12 +1,11 @@ discard """ -matrix: "--mm:refc; --mm:arc" output: ''' it's nil @[1, 2, 3] ''' """ -import std/[options, macros] +import macros block anontuples: @@ -210,21 +209,3 @@ block: # tuple unpacking assignment with underscore doAssert (a, b) == (6, 2) (b, _) = (7, 8) doAssert (a, b) == (6, 7) - -# bug #24800 -type - B[T] = object - case r: bool - of false: - v: ref int - of true: - x: T - U = ref object of RootObj - -method y(_: U) {.base.} = - var s = default(B[tuple[f: B[int], w: B[int]]]) - discard some(s.x) - -proc foo = - var s = U() - y(s)