Nim: pop pragma takes invalid input

Created on 29 Sep 2020  路  1Comment  路  Source: nim-lang/Nim

Found this minor bug, {.pop.} takes invalid input and silently wont work anymore,
I dont understand why it wont work anymore if given arguments.

{.pop.} must not take arguments according to documentation:
https://nim-lang.github.io/Nim/manual.html#pragmas-push-and-pop-pragmas

Probably just an assert here should fix it:

let a = create(int, sizeOf int)
{.push experimental: "implicitDeref".}
echo a
{.pop experimental.}
echo a

Current Output

0
0

Expected Output

Error: type mismatch: got <ptr int>

System Information

{
  "compiled": "2020-04-12T10:45:59",
  "NimVersion": "1.2.6",
  "hostCPU": "amd64",
  "hostOS": "linux",
  "cpuEndian": "littleEndian",
  "getTempDir": "/tmp/",
  "now": "2020-09-29T13:15:00-03:00",
  "getCurrentEncoding": "UTF-8",
  "getFreeMem": 397312,
  "getTotalMem": 528384,
  "getOccupiedMem": 72600,
  "countProcessors": 6,
  "arch": "x86_64",
  "FileSystemCaseSensitive": true,
  "nimcacheDir": "",
  "ccompilerPath": "",
  "nimpretty": "0.2",
  "nimble": "nimble v0.12.0 compiled at 2020-09-29 00:44:25\ngit hash: 26167cd3b7671006c8bd38cbef8708431ddf8687",
  "nimgrep": "1.5",
  "nimsuggest": "Nim Compiler Version 1.3.7 [Linux: amd64]\nCompiled at 2020-09-29\nCopyright (c) 2006-2020 by Andreas Rumpf\n\ngit hash: 50b6f6996ab604931d8ee7ca2a26bfdce5559933\nactive boot switches: -d:release -d:danger --gc:markAndSweep",
  "choosenim": "choosenim v0.6.0 (2020-03-06 18:24:57) [linux/amd64]",
  "gcc": "gcc (GCC) 10.2.0",
  "clang": "clang version 10.0.1",
  "git": "2.28.0",
  "node": "v14.12.0",
  "python": "3.8.5",
  "ssd": true
}

Proposed Labels

pragmas, takes invalid input
Easy Hacktoberfest

Most helpful comment

it's because {.pop experimental.} first pops, then applies everything in experimental which includes explicitDeref

my PR does not produce an error, but instead silently ignores anything after a pop

>All comments

it's because {.pop experimental.} first pops, then applies everything in experimental which includes explicitDeref

my PR does not produce an error, but instead silently ignores anything after a pop

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timotheecour picture timotheecour  路  3Comments

capocasa picture capocasa  路  3Comments

ghost picture ghost  路  4Comments

juancarlospaco picture juancarlospaco  路  3Comments

teroz picture teroz  路  3Comments