Skip to content

Commit 6864337

Browse files
committed
Revert "fixes nim-lang#24800; Invalid C code generation with a method, case object in refc (nim-lang#24809)"
This reverts commit 3a8b7d9.
1 parent ce67056 commit 6864337

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

compiler/ccgexprs.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,8 +2254,7 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc) =
22542254

22552255
proc genConv(p: BProc, e: PNode, d: var TLoc) =
22562256
let destType = e.typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink})
2257-
let srcType = e[1].typ.skipTypes({tyVar, tyLent, tyGenericInst, tyAlias, tySink})
2258-
if sameBackendTypeIgnoreRange(destType, srcType):
2257+
if sameBackendTypeIgnoreRange(destType, e[1].typ):
22592258
expr(p, e[1], d)
22602259
else:
22612260
genSomeCast(p, e, d)

tests/tuples/ttuples_various.nim

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
discard """
2-
matrix: "--mm:refc; --mm:arc"
32
output: '''
43
it's nil
54
@[1, 2, 3]
65
'''
76
"""
87

9-
import std/[options, macros]
8+
import macros
109

1110

1211
block anontuples:
@@ -210,21 +209,3 @@ block: # tuple unpacking assignment with underscore
210209
doAssert (a, b) == (6, 2)
211210
(b, _) = (7, 8)
212211
doAssert (a, b) == (6, 7)
213-
214-
# bug #24800
215-
type
216-
B[T] = object
217-
case r: bool
218-
of false:
219-
v: ref int
220-
of true:
221-
x: T
222-
U = ref object of RootObj
223-
224-
method y(_: U) {.base.} =
225-
var s = default(B[tuple[f: B[int], w: B[int]]])
226-
discard some(s.x)
227-
228-
proc foo =
229-
var s = U()
230-
y(s)

0 commit comments

Comments
 (0)