summary refs log tree commit diff stats
path: root/tests/generics/t8694.nim
blob: da6c6dbed230983954ed789993cfafba6362bf56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
discard """
  output: '''
true
true
true
'''
"""

when true:
  # Error: undeclared identifier: '|'
  proc bar[T](t:T): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(0)

when true:
  # ok
  proc bar(t:int): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(0)

when true:
  # Error: undeclared identifier: '|'
  proc bar(t:typedesc): bool =
    runnableExamples:
      type Foo = int | float
    true
  echo bar(int)