diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-10-22 18:52:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-22 18:52:05 +0200 |
commit | 64016ddedcfc266c87d8fe7eece8b9476aa6db30 (patch) | |
tree | 18a31e58d0853bb5e168efc42bf61f7cde2999c2 | |
parent | 8358974b73afe8db06822779f2a28adbafc58280 (diff) | |
download | Nim-64016ddedcfc266c87d8fe7eece8b9476aa6db30.tar.gz |
fixes view types for sizeof() and --gc:orc (#15680)
-rw-r--r-- | compiler/ccgexprs.nim | 6 | ||||
-rw-r--r-- | compiler/sizealignoffsetimpl.nim | 2 | ||||
-rw-r--r-- | tests/views/tsplit_into_seq.nim | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index b2a325632..5c897e1a4 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2328,10 +2328,10 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = of mNewSeqOfCap: genNewSeqOfCap(p, e, d) of mSizeOf: let t = e[1].typ.skipTypes({tyTypeDesc}) - putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t)]) + putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t, skVar)]) of mAlignOf: let t = e[1].typ.skipTypes({tyTypeDesc}) - putIntoDest(p, d, e, "((NI)NIM_ALIGNOF($1))" % [getTypeDesc(p.module, t)]) + putIntoDest(p, d, e, "((NI)NIM_ALIGNOF($1))" % [getTypeDesc(p.module, t, skVar)]) of mOffsetOf: var dotExpr: PNode if e[1].kind == nkDotExpr: @@ -2341,7 +2341,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = else: internalError(p.config, e.info, "unknown ast") let t = dotExpr[0].typ.skipTypes({tyTypeDesc}) - let tname = getTypeDesc(p.module, t) + let tname = getTypeDesc(p.module, t, skVar) let member = if t.kind == tyTuple: "Field" & rope(dotExpr[1].sym.position) diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim index be35247f7..3e536f5d7 100644 --- a/compiler/sizealignoffsetimpl.nim +++ b/compiler/sizealignoffsetimpl.nim @@ -242,7 +242,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = else: typ.size = conf.target.ptrSize typ.align = int16(conf.target.ptrSize) - of tyCString, tySequence, tyPtr, tyRef, tyVar, tyLent, tyOpenArray: + of tyCString, tySequence, tyPtr, tyRef, tyVar, tyLent: let base = typ.lastSon if base == typ: # this is not the correct location to detect ``type A = ptr A`` diff --git a/tests/views/tsplit_into_seq.nim b/tests/views/tsplit_into_seq.nim index 49968f4c2..a0861458b 100644 --- a/tests/views/tsplit_into_seq.nim +++ b/tests/views/tsplit_into_seq.nim @@ -4,7 +4,7 @@ asdf 231 231 ''' - cmd: "nim c $file" + cmd: "nim c --gc:orc $file" """ {.experimental: "views".} |