summary refs log tree commit diff stats
path: root/tests/vm/tgorgeex.sh
blob: 36ba0a02f055960f21fc3b0991c48f9c1aaadc87 (plain) (blame)
1
2
3
#!/bin/sh
echo "gorgeex test"
exit 1
*/ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  nimout: '''1
2
3
1
2
3
1
2
3
1
2
3
aa
bb
11
22
aa
bb
24
2147483647 2147483647
5'''
"""

const s = @[1,2,3]

macro foo() =
  for e in s:
    echo e

foo()

static:
  for e in s:
    echo e

macro bar(x: static[seq[int]]): untyped =
  for e in x:
    echo e

bar s
bar(@[1, 2, 3])

type
  TData = tuple
    letters: seq[string]
    numbers: seq[int]

const data: TData = (@["aa", "bb"], @[11, 22])

static:
  var m1 = data
  for x in m1.letters: echo x

  var m2: TData = data
  for x in m2.numbers: echo x

macro ff(d: static[TData]) =
  for x in d.letters:
    echo x

ff(data)

# bug #1010

proc `*==`(x: var int, y: int) {.inline, noSideEffect.} =
  ## Binary `*=` operator for ordinals
  x = x * y

proc fac: int =
  var x = 1;
  for i in 1..4:
    x *== i;
  return x

const y = fac()

static:
  echo y

static:
  var foo2 = int32.high
  echo foo2, " ", int32.high

# bug #1329

static:
    var a: ref int
    new(a)
    a[] = 5

    echo a[]